Basic deployment test: Reduce the flake's participation to a minimum
This commit is contained in:
parent
1d40dcfc0e
commit
9c6e542dd4
4 changed files with 66 additions and 46 deletions
8
deployment/check/basic/constants.nix
Normal file
8
deployment/check/basic/constants.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
targetMachines = [
|
||||||
|
"hello"
|
||||||
|
"cowsay"
|
||||||
|
];
|
||||||
|
pathToRoot = ../../..;
|
||||||
|
pathFromRoot = ./.;
|
||||||
|
}
|
14
deployment/check/basic/default.nix
Normal file
14
deployment/check/basic/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
runNixOSTest,
|
||||||
|
inputs,
|
||||||
|
sources,
|
||||||
|
}:
|
||||||
|
|
||||||
|
runNixOSTest {
|
||||||
|
imports = [
|
||||||
|
../common/nixosTest.nix
|
||||||
|
./nixosTest.nix
|
||||||
|
];
|
||||||
|
_module.args = { inherit inputs sources; };
|
||||||
|
inherit (import ./constants.nix) targetMachines pathToRoot pathFromRoot;
|
||||||
|
}
|
36
deployment/check/basic/deployment.nix
Normal file
36
deployment/check/basic/deployment.nix
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
sources,
|
||||||
|
lib,
|
||||||
|
providers,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (import ./constants.nix) targetMachines pathToRoot pathFromRoot;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
providers = {
|
||||||
|
inherit (inputs.nixops4.modules.nixops4Provider) local;
|
||||||
|
};
|
||||||
|
|
||||||
|
resources = lib.genAttrs targetMachines (nodeName: {
|
||||||
|
type = providers.local.exec;
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
||||||
|
../common/targetResource.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
_module.args = { inherit inputs sources; };
|
||||||
|
|
||||||
|
inherit nodeName pathToRoot pathFromRoot;
|
||||||
|
|
||||||
|
nixos.module =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
environment.systemPackages = [ pkgs.${nodeName} ];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,57 +1,19 @@
|
||||||
{
|
{ inputs, sources, ... }:
|
||||||
self,
|
|
||||||
inputs,
|
|
||||||
lib,
|
|
||||||
sources,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (lib) genAttrs;
|
|
||||||
|
|
||||||
targetMachines = [
|
|
||||||
"hello"
|
|
||||||
"cowsay"
|
|
||||||
];
|
|
||||||
pathToRoot = /. + (builtins.unsafeDiscardStringContext self);
|
|
||||||
pathFromRoot = ./.;
|
|
||||||
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
_class = "flake";
|
_class = "flake";
|
||||||
|
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
checks.deployment-basic = pkgs.testers.runNixOSTest {
|
checks.deployment-basic = import ./. {
|
||||||
imports = [
|
inherit (pkgs.testers) runNixOSTest;
|
||||||
../common/nixosTest.nix
|
inherit inputs sources;
|
||||||
./nixosTest.nix
|
|
||||||
];
|
|
||||||
_module.args = { inherit inputs sources; };
|
|
||||||
inherit targetMachines pathToRoot pathFromRoot;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixops4Deployments.check-deployment-basic =
|
nixops4Deployments.check-deployment-basic = {
|
||||||
{ providers, ... }:
|
imports = [ ./deployment.nix ];
|
||||||
{
|
_module.args = { inherit inputs sources; };
|
||||||
providers = {
|
};
|
||||||
inherit (inputs.nixops4.modules.nixops4Provider) local;
|
|
||||||
};
|
|
||||||
resources = genAttrs targetMachines (nodeName: {
|
|
||||||
type = providers.local.exec;
|
|
||||||
imports = [
|
|
||||||
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
|
||||||
../common/targetResource.nix
|
|
||||||
];
|
|
||||||
_module.args = { inherit inputs sources; };
|
|
||||||
inherit nodeName pathToRoot pathFromRoot;
|
|
||||||
nixos.module =
|
|
||||||
{ pkgs, ... }:
|
|
||||||
{
|
|
||||||
environment.systemPackages = [ pkgs.${nodeName} ];
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue