diff --git a/flake.nix b/flake.nix index 4c0fcead..605bf123 100644 --- a/flake.nix +++ b/flake.nix @@ -46,18 +46,7 @@ targets.wasm32-unknown-unknown.stable.rust-std ]; craneLib = inputs.crane.lib.${system}.overrideToolchain rustToolchain; - - # TODO reuse in nixos tests - cctlConfig = { - chainspec = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/cspr-rad/casper-node/a8ba82edc949959ea3240f06cc9d64db50d42d64/resources/production/chainspec.toml"; - hash = "sha256-tStzzhCa/NtmmvMcPjkpB23RN8qhDjAYkMOjo2Tvess="; - }; - config = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/config.toml"; - hash = "sha256-ZuNbxw0nBjuONEZRK8Ru96zZQak4MEQ/eM1fA6esyCM="; - }; - }; + cctl = inputs'.cctl.packages.cctl.override { casper-node = inputs'.csprpkgs.packages.casper-node; }; kairosContractsAttrs = { src = lib.cleanSourceWith { @@ -180,8 +169,8 @@ PATH_TO_WASM_BINARIES = "${self'.packages.kairos-contracts}/bin"; PATH_TO_SESSION_BINARIES = "${self'.packages.kairos-session-code}/bin"; - CCTL_CONFIG = "${cctlConfig.config}"; - CCTL_CHAINSPEC = "${cctlConfig.chainspec}"; + CCTL_CONFIG = self'.packages.casper-node-config; + CCTL_CHAINSPEC = self'.packages.casper-chainspec; KAIROS_SERVER_MIGRATIONS = kairosServerMigrations; meta.mainProgram = "kairos-server"; @@ -194,8 +183,8 @@ CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld"; PATH_TO_WASM_BINARIES = "${self'.packages.kairos-contracts}/bin"; PATH_TO_SESSION_BINARIES = "${self'.packages.kairos-session-code}/bin"; - CCTL_CONFIG = "${cctlConfig.config}"; - CCTL_CHAINSPEC = "${cctlConfig.chainspec}"; + CCTL_CONFIG = self'.packages.casper-node-config; + CCTL_CHAINSPEC = self'.packages.casper-chainspec; KAIROS_SERVER_MIGRATIONS = kairosServerMigrations; inputsFrom = [ self'.packages.kairos self'.packages.kairos-contracts ]; packages = [ pkgs.diesel-cli ]; @@ -252,6 +241,15 @@ kairos-session-code = craneLib.buildPackage (kairosSessionCodeAttrs // { pname = "kairos-session-code"; }); + + casper-chainspec = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/cspr-rad/casper-node/a8ba82edc949959ea3240f06cc9d64db50d42d64/resources/production/chainspec.toml"; + hash = "sha256-tStzzhCa/NtmmvMcPjkpB23RN8qhDjAYkMOjo2Tvess="; + }; + casper-node-config = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/config.toml"; + hash = "sha256-ZuNbxw0nBjuONEZRK8Ru96zZQak4MEQ/eM1fA6esyCM="; + }; }; checks = { diff --git a/nixos/default.nix b/nixos/default.nix index ad6c74e8..0a153cfc 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -48,7 +48,7 @@ in ./tests/end-to-end.nix { inherit mkKairosHostConfig; - inherit (self.packages.${pkgs.system}) kairos kairos-contracts casper-client-rs; + inherit (self.packages.${pkgs.system}) kairos kairos-contracts casper-client-rs casper-node-config casper-chainspec; cctlModule = self.nixosModules.cctl; }; }; diff --git a/nixos/tests/end-to-end.nix b/nixos/tests/end-to-end.nix index c57cbbe8..9ef6ab28 100644 --- a/nixos/tests/end-to-end.nix +++ b/nixos/tests/end-to-end.nix @@ -6,6 +6,8 @@ , fetchurl , casper-client-rs , writeShellScript +, casper-chainspec +, casper-node-config , jq }: let @@ -44,14 +46,8 @@ nixosTest { port = cctlPort; workingDirectory = cctlWorkingDirectory; contract = { "${contractHashName}" = kairos-contracts + "/bin/demo-contract-optimized.wasm"; }; - chainspec = fetchurl { - url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/chainspec.toml.in"; - hash = "sha256-b/6c5o3JXFlaTgTHxs8JepaHzjMG75knzlKKqRd/7pc="; - }; - config = fetchurl { - url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/config.toml"; - hash = "sha256-ZuNbxw0nBjuONEZRK8Ru96zZQak4MEQ/eM1fA6esyCM="; - }; + chainspec = casper-chainspec; + config = casper-node-config; }; services.kairos = {