-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathflake.nix
69 lines (60 loc) · 2.18 KB
/
flake.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
description = "Bevy GGRS Rapier Example";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/master";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, nixpkgs-unstable, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
pkgsUnstable = import nixpkgs-unstable { inherit system overlays; };
rusts = pkgs.rust-bin.stable."1.80.1".complete.override {
extensions = [ "rust-src" ];
targets = [ "wasm32-unknown-unknown" ];
};
in {
devShells.default = with pkgs;
mkShell.override { stdenv = clangStdenv; } rec {
nativeBuildInputs = [ pkg-config ];
buildInputs = [
alsa-lib
libxkbcommon
udev
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
# debugger
zlib
];
packages = [
mold
rusts
pkgsUnstable.wasm-bindgen-cli
pkgsUnstable.binaryen
simple-http-server
nix-ld
];
# Run-time paths for libs
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
# For running the debugger
NIX_LD_LIBRARY_PATH =
lib.makeLibraryPath ([ clangStdenv.cc.cc ] ++ buildInputs);
# Requires impure flake
# NIX_LD = lib.fileContents "${clangStdenv.cc}/nix-support/dynamic-linker";
# Magic from discord
NIX_LD = "${clangStdenv.cc.libc_bin}/bin/ld.so";
RUST_BACKTRACE = 1;
CARGO_BUILD_JOBS = 7;
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER = "clang";
# TODO: requires nightly "-Zshare-generics=y"
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS =
"-C link-arg=-fuse-ld=${lib.getExe mold}";
};
});
}