| 25 Mar 2025 |
damccull | Hello. Trying to set up a new bevy project in a flake. Getting this error:
target/debug/bevy-tut: error while loading shared libraries: libudev.so.1: cannot open shared object file: No such file or directory
With this flake:
{
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs/nixos-unstable";
};
flake-parts.url = "github:hercules-ci/flake-parts";
rust-overlay.url = "github:oxalica/rust-overlay";
surrealdb-gh.url = "github:surrealdb/surrealdb/v2.1.4";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
perSystem =
{
config,
self',
pkgs,
lib,
system,
...
}:
let
runtimeDeps = with pkgs; [
alsa-lib
libxkbcommon
udev
vulkan-loader
wayland
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
];
buildDeps = with pkgs; [
clang
lld
lldb
pkg-config
rustPlatform.bindgenHook
stdenv.cc.cc.lib
# (wasm-bindgen-cli.overrideAttrs (oldAttrs: rec {
# version = "0.2.100";
# src = fetchCrate {
# pname = "wasm-bindgen-cli";
# version = version;
# hash = "sha256-3RJzK7mkYFrs7C/WkhW9Rr4LdP5ofb2FdYGz1P7Uxog=";
# };
#
# cargoDeps = rustPlatform.fetchCargoVendor {
# inherit src;
# inherit (src) pname version;
# hash = "sha256-qsO12332HSjWCVKtf1cUePWWb9IdYUmT+8OPj/XP2WE=";
# };
# }))
];
devDeps =
with pkgs;
[
# Libraries and programs needed for dev work; included in dev shell
# NOT included in the nix build operation
bacon
bashInteractive
bunyan-rs
cargo-deny
cargo-edit
cargo-expand
cargo-msrv
cargo-nextest
(cargo-whatfeatures.overrideAttrs (oldAttrs: rec {
version = "0.9.13";
src = fetchCrate {
pname = "cargo-whatfeatures";
version = "${version}";
hash = "sha256-Nbyr7u47c6nImzYJvPVLfbqgDvzyXqR1C1tOLximuHU=";
};
cargoDeps = rustPlatform.fetchCargoVendor {
inherit src;
inherit (src) pname version;
hash = "sha256-p95aYXsZM9xwP/OHEFwq4vRiXoO1n1M0X3TNbleH+Zw=";
};
}))
gdb
just
nushell
panamax
zellij
]
++ [
inputs.surrealdb-gh.packages.${system}.default
];
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
msrv = cargoToml.package.rust-version;
rustPackage =
features:
(pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.stable.latest.minimal;
rustc = pkgs.rust-bin.stable.latest.minimal;
}).buildRustPackage
{
inherit (cargoToml.package) name version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
buildFeatures = features;
buildInputs = runtimeDeps;
nativeBuildInputs = buildDeps;
# Uncomment if your cargo tests require networking or otherwise
# don't play nicely with the nix build sandbox:
# doCheck = false;
};
ldpath = with pkgs; [
stdenv.cc.cc.lib
];
mkDevShell =
rustc:
pkgs.mkShell {
shellHook = ''
# TODO: figure out if it's possible to remove this or allow a user's preferred shell
exec env SHELL=${pkgs.bashInteractive}/bin/bash zellij --layout ./zellij_layout.kdl
'';
LD_LIBRARY_PATH = lib.makeLibraryPath ldpath;
GIO_MODULE_DIR = "${pkgs.glib-networking}/lib/gio/modules/";
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
buildInputs = runtimeDeps;
nativeBuildInputs = buildDeps ++ devDeps ++ [ rustc ];
};
rustTargets = [
"x86_64-unknown-linux-gnu"
"x86_64-linux-android"
"aarch64-linux-android"
"wasm32-unknown-unknown"
];
rustExtensions = [
"rust-analyzer"
"rust-src"
];
in
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ (import inputs.rust-overlay) ];
config = {
allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) ([
"surrealdb"
]);
android_sdk.accept_license = true;
};
};
packages.default = self'.packages.base;
devShells.default = self'.devShells.stable;
packages.base = (rustPackage "");
packages.bunyan = (rustPackage "bunyan");
packages.tokio-console = (rustPackage "tokio-console");
devShells.nightly = (
mkDevShell (
pkgs.rust-bin.selectLatestNightlyWith (
toolchain:
toolchain.default.override {
extensions = rustExtensions;
targets = rustTargets;
}
)
)
);
devShells.stable = (
mkDevShell (
pkgs.rust-bin.stable.latest.default.override {
extensions = rustExtensions;
targets = rustTargets;
}
)
);
devShells.msrv = (
mkDevShell (
pkgs.rust-bin.stable.${msrv}.default.override {
extensions = rustExtensions;
targets = rustTargets;
}
)
);
};
};
}
Really not sure why since I have udev in the place it's supposed to be according to bevy docs, and I've tried it in all the places I can think of anyways. Suggestions?
| 00:49:39 |
damccull | Ah, nevermind. It was an LD_PATH issue. | 01:23:03 |
damccull | * Ah, nevermind. It was an LD_LIBRARY_PATH issue. | 01:23:16 |
Ralith | sounds like they're using dlopen when they should be linking | 02:45:09 |
Toma | There are a few packages (around 3) still using the first cargo lockfile format in-tree, so I made this
https://github.com/NixOS/nixpkgs/pull/393016 | 12:41:11 |
K900 | Can we just delete them instead lol | 12:42:00 |
emily | we already removed tons of packages for that | 12:43:10 |
emily | are the remaining ones that important? | 12:43:20 |
emily | kubernix looks like something that probably won't even work any more and that is likely using ancient/insecure versions if it does | 12:44:25 |
Toma | okay, I don't really care if it doesn't get merged,
the main thing is that the PR exists so in case someone really wants it they can take the changes | 12:46:13 |
K900 | What's the packages? | 12:46:44 |
K900 | Do we have a list? | 12:46:52 |
Toma | see the linked issue | 12:46:51 |
K900 | https://github.com/yxdunc/lipl has a v3 lockfile in master and hasn't been touched in 3 years otherwise | 12:47:56 |
K900 | kubernix author is also its maintainer in nixpkgs | 12:48:40 |
K900 | We can probably ask for a tag? | 12:48:43 |
K900 | system-syzygy has a 1.0.2 tag with a v3 lockfile | 12:49:29 |
K900 | I feel like we can just bump the two and ask the author about the third one | 12:50:53 |
K900 | And never have this problem again | 12:51:01 |
Toma | I guess also, since importCargoLock supports v1 anyways, weird old software can fall back to that | 12:51:50 |
K900 | Oh let's rip that out too lol | 12:52:12 |
Toma | I don't really agree: it's very simple to support because importCargoLock is written in nix and can use laziness | 12:54:33 |
K900 | I'm not thinking about it in terms of difficulty to support tbh | 12:55:04 |
K900 | I'm thinking about it in terms of policy | 12:55:11 |
K900 | Any software that still has a pre-v3 lockfile hasn't been touched since what, 2020? | 12:55:33 |
K900 | We probably don't want to be shipping that | 12:55:44 |
K900 | Even if we technically can + | 12:55:51 |
K900 | * Even if we
technically can | 12:56:01 |
emily | Alyssa removed like 50 packages for having old lock file versions | 13:16:42 |
emily | so it seems a bit late to start caring about :P | 13:16:47 |