-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
44 lines (36 loc) · 1.13 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ system ? builtins.currentSystem
, pkgs ? import <nixpkgs> { inherit system; config = {}; overlays = []; }
}:
let
lib = pkgs.lib;
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
buildInputs = with pkgs; [
cargo
rustc
udev alsa-lib vulkan-loader
xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr # To use the x11 feature
libxkbcommon wayland # To use the wayland feature
];
nativeBuildInputs = with pkgs; [ pkg-config ];
# see https://github.com/bevyengine/bevy/blob/main/docs/linux_dependencies.md#nix
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
rustPackage = pkgs.rustPlatform.buildRustPackage rec {
inherit buildInputs nativeBuildInputs;
shellHooks = ''
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}
'';
passthru = {
inherit shell;
};
pname = manifest.name;
version = manifest.version;
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
};
shell = pkgs.mkShell rec {
inherit buildInputs nativeBuildInputs LD_LIBRARY_PATH;
# inputsFrom = [ rustPackage ];
# ^ I know this exists but it doesn't work
};
in
rustPackage