mirror of
https://github.com/divnix/digga.git
synced 2024-11-23 20:22:04 +03:00
flake/tests: improve multi arch support for flake checks
This commit is contained in:
parent
aec7c92cc7
commit
3c8d22a528
19
flake.nix
19
flake.nix
@ -62,20 +62,21 @@
|
||||
defaultTemplate = self.templates.flk;
|
||||
|
||||
deploy.nodes = os.mkNodes deploy self.nixosConfigurations;
|
||||
|
||||
checks =
|
||||
let
|
||||
tests = import ./tests { inherit self pkgs; };
|
||||
deployChecks = builtins.mapAttrs
|
||||
(system: deployLib: deployLib.deployChecks self.deploy)
|
||||
deploy.lib;
|
||||
in
|
||||
nixos.lib.recursiveUpdate tests deployChecks;
|
||||
};
|
||||
|
||||
systemOutputs = utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = multiPkgs.${system}; in
|
||||
{
|
||||
checks =
|
||||
let
|
||||
tests = nixos.lib.optionalAttrs (system == "x86_64-linux")
|
||||
(import ./tests { inherit self pkgs; });
|
||||
deployHosts = nixos.lib.filterAttrs
|
||||
(n: _: self.nixosConfigurations.${n}.config.nixpkgs.system == system) self.deploy.nodes;
|
||||
deployChecks = deploy.lib.${system}.deployChecks { nodes = deployHosts; };
|
||||
in
|
||||
nixos.lib.recursiveUpdate tests deployChecks;
|
||||
|
||||
packages = utils.lib.flattenTreeSystem system
|
||||
(os.mkPackages { inherit pkgs; });
|
||||
|
||||
|
@ -59,45 +59,44 @@ let
|
||||
nixosTesting.makeTest calledTest;
|
||||
in
|
||||
{
|
||||
x86_64-linux = {
|
||||
profilesTest = mkTest {
|
||||
name = "profiles";
|
||||
profilesTest = mkTest {
|
||||
name = "profiles";
|
||||
|
||||
machine = { suites, ... }: {
|
||||
imports = suites.allProfiles ++ suites.allUsers;
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.systemctl("is-system-running --wait")
|
||||
'';
|
||||
machine = { suites, ... }: {
|
||||
imports = suites.allProfiles ++ suites.allUsers;
|
||||
};
|
||||
|
||||
libTests = pkgs.runCommandNoCC "devos-lib-tests"
|
||||
{
|
||||
buildInputs = [
|
||||
pkgs.nix
|
||||
(
|
||||
let tests = import ./lib.nix { inherit self pkgs; };
|
||||
in
|
||||
if tests == [ ]
|
||||
then null
|
||||
else throw (builtins.toJSON tests)
|
||||
)
|
||||
];
|
||||
} ''
|
||||
datadir="${pkgs.nix}/share"
|
||||
export TEST_ROOT=$(pwd)/test-tmp
|
||||
export NIX_BUILD_HOOK=
|
||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
|
||||
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
|
||||
export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||
export NIX_STORE_DIR=$TEST_ROOT/store
|
||||
export PAGER=cat
|
||||
cacheDir=$TEST_ROOT/binary-cache
|
||||
nix-store --init
|
||||
|
||||
touch $out
|
||||
testScript = ''
|
||||
machine.systemctl("is-system-running --wait")
|
||||
'';
|
||||
};
|
||||
|
||||
libTests = pkgs.runCommandNoCC "devos-lib-tests"
|
||||
{
|
||||
buildInputs = [
|
||||
pkgs.nix
|
||||
(
|
||||
let tests = import ./lib.nix { inherit self pkgs; };
|
||||
in
|
||||
if tests == [ ]
|
||||
then null
|
||||
else throw (builtins.toJSON tests)
|
||||
)
|
||||
];
|
||||
} ''
|
||||
datadir="${pkgs.nix}/share"
|
||||
export TEST_ROOT=$(pwd)/test-tmp
|
||||
export NIX_BUILD_HOOK=
|
||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
|
||||
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
|
||||
export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||
export NIX_STORE_DIR=$TEST_ROOT/store
|
||||
export PAGER=cat
|
||||
cacheDir=$TEST_ROOT/binary-cache
|
||||
nix-store --init
|
||||
|
||||
touch $out
|
||||
'';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user