Skip to content

Commit

Permalink
flake: add casper-node nixos-module and nixos-test
Browse files Browse the repository at this point in the history
  • Loading branch information
marijanp committed Apr 11, 2024
1 parent 4f9bbaa commit edac32f
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 27 deletions.
84 changes: 83 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 49 additions & 26 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, rust-overlay, ... }:
outputs = { self, nixpkgs, rust-overlay, agenix, ... }:
let
eachSystem = systems: f:
let
Expand All @@ -43,31 +47,50 @@
"x86_64-linux"
];
in
{
herculesCI.ciSystems = [ "x86_64-linux" ];
overlays.default = import ./overlay.nix;
}
// eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend (import rust-overlay);
csprpkgs = pkgs.callPackage ./scope.nix { makeScope = pkgs.lib.makeScope; };
in
nixpkgs.lib.recursiveUpdate
{
packages = {
inherit (csprpkgs)
casper-node
casper-node-contracts
casper-node-launcher
casper-client-rs
;
};
formatter = pkgs.nixpkgs-fmt;
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.casper-node-smoke-test =
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
pkgs.callPackage ./nixos/tests/casper-node/smoke-test.nix {
casperNodeModule = self.nixosModules.casper-node;
agenixModule = agenix.nixosModules.age;
};
}
(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-contracts
casper-node-launcher
casper-client-rs
;
};
formatter = pkgs.nixpkgs-fmt;

checks.format = pkgs.runCommand "format-check" { buildInputs = [ pkgs.nixpkgs-fmt ]; } ''
set -euo pipefail
cd ${self}
nixpkgs-fmt --check .
touch $out
'';
});
checks.format = pkgs.runCommand "format-check" { buildInputs = [ pkgs.nixpkgs-fmt ]; } ''
set -euo pipefail
cd ${self}
nixpkgs-fmt --check .
touch $out
'';
})
);
}

0 comments on commit edac32f

Please sign in to comment.