-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
56 lines (51 loc) · 1.58 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, flake-utils, crane, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
buildInputs = with pkgs; [
cbqn
xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
beacon = crane.lib.${system}.buildPackage {
inherit buildInputs;
src = pkgs.lib.cleanSourceWith {
src = ./.;
filter = path: type:
(pkgs.lib.hasInfix "/src/" path)
|| (crane.lib.${system}.filterCargoSources path type);
};
};
in
with pkgs; {
# nix build, nix run, …
packages = {
inherit beacon;
default = pkgs.symlinkJoin {
name = "beacon";
paths = [ beacon ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/beacon \
--prefix LD_LIBRARY_PATH : "${LD_LIBRARY_PATH}"
'';
cargoExtraArgs = "--release";
};
};
# nix develop
devShells.default = mkShell {
inherit LD_LIBRARY_PATH;
buildInputs = buildInputs ++ [ cargo rustc rust-analyzer ];
};
}
);
}