-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
105 lines (97 loc) · 2.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{
description = "A collection of casper related packages";
nixConfig = {
extra-substituters = [
];
extra-trusted-public-keys = [
];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, rust-overlay, agenix, ... }:
let
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"
];
in
nixpkgs.lib.recursiveUpdate
{
herculesCI.ciSystems = [ "x86_64-linux" "aarch64-linux" ];
overlays.default = import ./overlay.nix;
nixosModules.casper-node =
{ pkgs, lib, ... }:
{
imports = [ ./nixos/modules/casper-node.nix ];
services.casper-node.package = self.packages.${pkgs.system}.casper-node;
};
checks.x86_64-linux =
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
casper-node-smoke-test =
pkgs.callPackage ./nixos/tests/casper-node/smoke-test.nix {
casperNodeModule = self.nixosModules.casper-node;
agenixModule = agenix.nixosModules.age;
};
casper-node-private-network-test =
pkgs.callPackage ./nixos/tests/casper-node/private-network-test.nix {
casperNodeModule = self.nixosModules.casper-node;
inherit (self.packages.x86_64-linux) casper-client-rs;
};
};
}
(eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend (import rust-overlay);
csprpkgs = pkgs.callPackage ./scope.nix { makeScope = pkgs.lib.makeScope; };
in
{
packages = {
inherit (csprpkgs)
casper-node
casper-node_2
casper-node-contracts
casper-node-launcher
casper-client-rs
casper-client-rs_2
casper-sidecar
;
};
formatter = pkgs.nixpkgs-fmt;
checks.format = pkgs.runCommand "format-check" { buildInputs = [ pkgs.nixpkgs-fmt ]; } ''
set -euo pipefail
cd ${self}
nixpkgs-fmt --check .
touch $out
'';
})
);
}