forked from leftwm/leftwm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
77 lines (71 loc) · 1.97 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
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, fenix, flake-utils, naersk, nixpkgs }:
(flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
deps = with pkgs; [
xorg.libX11
xorg.libXinerama
];
devToolchain = fenix.packages.${system}.stable;
leftwm = ((naersk.lib.${system}.override {
inherit (fenix.packages.${system}.minimal) cargo rustc;
}).buildPackage {
name = "leftwm";
src = ./.;
buildInputs = deps;
postFixup = ''
for p in $out/bin/left*; do
patchelf --set-rpath "${pkgs.lib.makeLibraryPath deps}" $p
done
'';
GIT_HASH = self.shortRev or "dirty";
});
in
rec {
# `nix build`
packages = {
inherit leftwm;
default = leftwm;
};
# `nix run`
apps = {
leftwm = flake-utils.lib.mkApp {
drv = packages.leftwm;
};
default = apps.leftwm;
};
# `nix develop`
devShells.default = pkgs.mkShell
{
buildInputs = deps ++ [ pkgs.pkg-config pkgs.systemd ];
nativeBuildInputs = with pkgs; [
gnumake
(devToolchain.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
])
fenix.packages.${system}.rust-analyzer
];
};
})) // {
overlay = final: prev: {
leftwm = self.packages.${final.system}.leftwm;
};
};
}