-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
64 lines (52 loc) · 1.68 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
{
description = "Cab, the reproducible derivation composer and realizer-protocol client.";
nixConfig = {
extra-substituters = [
"https://cache.garnix.io/"
"https://nix-community.cachix.org/"
];
extra-trusted-public-keys = [
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
inputs = {
systems.url = "github:nix-systems/default";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, systems, nixpkgs, fenix }: let
inherit (nixpkgs.lib) genAttrs makeLibraryPath optionals;
eachPkgs = callback: genAttrs (import systems) (system: callback (import nixpkgs {
inherit system;
overlays = [
fenix.overlays.default
];
}));
in {
devShells = eachPkgs (pkgs: let
cab = pkgs.mkShell {
packages = [
# You will need a nightly Rust compiler.
pkgs.fenix.complete.toolchain
# Fuzzing.
pkgs.cargo-fuzz
];
env.${if pkgs.stdenv.hostPlatform.isLinux then "LD_LIBRARY_PATH" else "DYLD_FALLBACK_LIBRARY_PATH"} = makeLibraryPath (optionals pkgs.stdenv.targetPlatform.isLinux [
pkgs.stdenv.cc.cc.lib
]);
shellHook = ''
# So we can do `{bin}` instead of `./target/{optimization}/{bin}`
root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
export PATH=$PATH:$root/target/debug:$root/target/release
'';
};
in {
inherit cab;
default = cab;
});
};
}