-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
87 lines (82 loc) · 2.36 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { flake-utils, nixpkgs, naersk, fenix, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ fenix.overlays.default ];
pkgs = import nixpkgs {
inherit system overlays;
config = {
permittedInsecurePackages = [
"freeimage-unstable-2021-11-01"
];
};
};
trenchbroom-working = pkgs.runCommand "trenchbroom"
{ buildInputs = [ pkgs.makeWrapper pkgs.tree pkgs.gnused ]; } ''
makeWrapper ${pkgs.trenchbroom}/bin/trenchbroom $out/bin/trenchbroom --set QT_QPA_PLATFORM xcb
'';
toolchain = with fenix.packages.${system}; combine [
minimal.cargo
minimal.rustc
latest.clippy
latest.rust-src
latest.rustfmt
targets.wasm32-unknown-unknown.latest.rust-std
];
min-pkgs = with pkgs; [
pkg-config
openssl
gcc
udev
alsa-lib
xorg.libX11
xorg.libXi
xorg.libXcursor
xorg.libXrandr
vulkan-tools
vulkan-headers
vulkan-loader
vulkan-validation-layers
graphviz
trenchbroom-working
libxkbcommon
wayland
];
in
{
defaultPackage = (naersk.lib.${system}.override {
cargo = toolchain;
rustc = toolchain;
}).buildPackage {
src = ./.;
nativeBuildInputs = with pkgs; [ ] ++ min-pkgs;
};
devShell = (naersk.lib.${system}.override {
cargo = toolchain;
rustc = toolchain;
}).buildPackage {
src = ./.;
mode = "fmt";
dontPatchELF = true;
nativeBuildInputs = with pkgs; [ ] ++ min-pkgs;
shellHook = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
pkgs.lib.makeLibraryPath [
pkgs.udev
pkgs.alsa-lib
pkgs.vulkan-loader
pkgs.libxkbcommon
]
}"'';
};
});
}