-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
76 lines (70 loc) · 2.42 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
# maintain with
# nix flake lock --update-input cargo2nix
# nix run github:cargo2nix/cargo2nix
# patch -p1 -R -i zvariant.patch
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
cargo2nix.url = "github:cargo2nix/cargo2nix";
};
outputs = { self, nixpkgs, flake-utils, cargo2nix, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
systemTargets = {
"x86_64-linux" = "x86_64-unknown-linux-gnu";
"x86_64-darwin" = "x86_64-apple-darwin";
};
in let
pkgs = import nixpkgs {
inherit system;
overlays =
[ cargo2nix.overlays.default rust-overlay.overlays.default ];
};
libPath = with pkgs;
lib.makeLibraryPath [
libGL
libxkbcommon
wayland
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
];
rustPkgs = pkgs.rustBuilder.makePackageSet {
rustVersion = "1.69.0";
packageFun = import ./Cargo.nix;
target = systemTargets.${system};
# Use the existing all list of overrides and append your override
packageOverrides = pkgs:
pkgs.rustBuilder.overrides.all ++ [
# parentheses disambiguate each makeOverride call as a single list element
(pkgs.rustBuilder.rustLib.makeOverride {
name = "crabcassonne";
overrideAttrs = drv: {
propagatedBuildInputs = drv.propagatedBuildInputs or [ ]
++ [ pkgs.glibc pkgs.makeWrapper pkgs.gcc-unwrapped ];
};
})
];
};
crab-wrapped = pkgs.runCommand "crabcassonne" {
meta = rustPkgs.workspace.crabcassonne.meta or { };
passthru = (rustPkgs.workspace.crabcassonne.passthru or { }) // {
unwrapped = rustPkgs.workspace.crabcassonne;
};
nativeBuildInputs = [ pkgs.makeWrapper ];
makeWrapperArgs = [ ];
} ''
cp -rs --no-preserve=mode,ownership "${
rustPkgs.workspace.crabcassonne { }
}" $out
wrapProgram "$out/bin/crabcassonne" --prefix LD_LIBRARY_PATH : "${libPath}"
'';
in rec {
packages = {
crabcassonne = crab-wrapped;
default = packages.crabcassonne;
};
});
}