-
Notifications
You must be signed in to change notification settings - Fork 5
/
flake.nix
72 lines (66 loc) · 2.08 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
{
description = "cctl - Bash application to work with a local casper-node network.";
nixConfig = {
extra-substituters = [
"https://cspr.cachix.org"
];
extra-trusted-public-keys = [
"cspr.cachix.org-1:vEZlmbOsmTXkmEi4DSdqNVyq25VPNpmSm6qCs4IuTgE="
];
};
inputs = {
csprpkgs.url = "github:cspr-rad/csprpkgs";
# We follow csprpkgs/nixpkgs because we want to avoid recompiling its packages
# by injecting a different revision of nixpkgs. Most (and the largest)
# of the runtime dependencies of cctl are from csprpkgs.
nixpkgs.follows = "csprpkgs/nixpkgs";
rust-overlay.follows = "csprpkgs/rust-overlay";
};
outputs = { self, nixpkgs, csprpkgs, rust-overlay }:
let
# eachSystem :: [ System ] -> (System -> FlakeOutputs)
eachSystem = systems: f:
let
# Merge together the outputs for all systems.
op = attrs: system:
let
ret = f system;
op = attrs: key: attrs //
{
${key} = (attrs.${key} or { })
// { ${system} = ret.${key}; };
}
;
in
builtins.foldl' op attrs (builtins.attrNames ret);
in
builtins.foldl' op { } systems;
eachDefaultSystem = eachSystem [
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
"aarch64-linux"
];
in
{
herculesCI.ciSystems = [ "x86_64-linux" "aarch64-linux" ];
overlays.default = import ./overlay.nix;
}
// eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default csprpkgs.overlays.default rust-overlay.overlays.default ]; };
in
{
packages = {
inherit (pkgs) cctl;
default = pkgs.cctl;
};
formatter = pkgs.nixpkgs-fmt;
checks.format = pkgs.runCommand "format-check" { buildInputs = [ pkgs.nixpkgs-fmt ]; } ''
set -euo pipefail
cd ${self}
nixpkgs-fmt --check .
touch $out
'';
});
}