diff --git a/flake.lock b/flake.lock index b39f6bf..90b99fc 100644 --- a/flake.lock +++ b/flake.lock @@ -1,9 +1,54 @@ { "nodes": { - "flake-utils": { + "agenix": { "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": [ + "nixpkgs" + ], "systems": "systems" }, + "locked": { + "lastModified": 1712079060, + "narHash": "sha256-/JdiT9t+zzjChc5qQiF+jhrVhRt8figYH29rZO7pFe4=", + "owner": "ryantm", + "repo": "agenix", + "rev": "1381a759b205dff7a6818733118d02253340fd5e", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, "locked": { "lastModified": 1705309234, "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", @@ -18,6 +63,27 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1712192574, @@ -36,6 +102,7 @@ }, "root": { "inputs": { + "agenix": "agenix", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } @@ -75,6 +142,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 8daae61..d130819 100644 --- a/flake.nix +++ b/flake.nix @@ -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 @@ -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 + ''; + }) + ); }