tests/vmTest: fix and deduplicate code #18
3 changed files with 89 additions and 75 deletions
|
@ -14,6 +14,7 @@
|
|||
nixpkgsFor = forAllSystems (system: pkgs: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
|
||||
in rec
|
||||
{
|
||||
herculesCI.ciSystems = [ "x86_64-linux" ];
|
||||
overlay = final: prev: {
|
||||
generateApps = flake:
|
||||
let
|
||||
|
|
14
tests/vmTest/common.nix
Normal file
14
tests/vmTest/common.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Configuration that will be added to both the nixinatee node and the nixinator
|
||||
# node.
|
||||
{ inputs }:
|
||||
{
|
||||
nix = {
|
||||
extraOptions =
|
||||
let empty_registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}''; in
|
||||
''
|
||||
experimental-features = nix-command flakes
|
||||
flake-registry = ${empty_registry}
|
||||
'';
|
||||
registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
};
|
||||
}
|
|
@ -22,6 +22,8 @@ let
|
|||
((import (path + "/flake.nix")).outputs (inputs // {self = r;}));
|
||||
in
|
||||
r;
|
||||
mkNixinateTest = buildOn:
|
||||
let
|
||||
exampleFlake = pkgs.writeTextFile {
|
||||
name = "nixinate-example-flake";
|
||||
destination = "/flake.nix";
|
||||
|
@ -38,7 +40,7 @@ let
|
|||
_module.args.nixinate = {
|
||||
host = "nixinatee";
|
||||
sshUser = "nixinator";
|
||||
buildOn = "local"; # valid args are "local" or "remote"
|
||||
buildOn = "${buildOn}"; # valid args are "local" or "remote"
|
||||
};
|
||||
}
|
||||
];
|
||||
|
@ -54,32 +56,29 @@ let
|
|||
};
|
||||
deployScript = inputs.self.nixinate.${pkgs.hostPlatform.system} (callLocklessFlake "${exampleFlake}" { nixpkgs = inputs.nixpkgs; });
|
||||
exampleSystem = (callLocklessFlake "${exampleFlake}" { nixpkgs = inputs.nixpkgs; }).nixosConfigurations.nixinatee.config.system.build.toplevel;
|
||||
mkNixinateTest = buildOn: makeTest {
|
||||
in
|
||||
makeTest {
|
||||
nodes = {
|
||||
nixinatee = { ... }: {
|
||||
imports = [
|
||||
./nixinateeBase.nix
|
||||
(import ./common.nix { inherit inputs; })
|
||||
];
|
||||
virtualisation = {
|
||||
writableStore = true;
|
||||
additionalPaths = [] ++ pkgs.lib.optional (buildOn == "remote") (allDrvOutputs exampleSystem);
|
||||
};
|
||||
};
|
||||
nixinator = { ... }: {
|
||||
imports = [
|
||||
(import ./common.nix { inherit inputs; })
|
||||
];
|
||||
virtualisation = {
|
||||
additionalPaths = [
|
||||
(allDrvOutputs exampleSystem)
|
||||
]
|
||||
++ pkgs.lib.optional (buildOn == "remote") exampleFlake;
|
||||
};
|
||||
nix = {
|
||||
extraOptions =
|
||||
let empty_registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}''; in
|
||||
''
|
||||
experimental-features = nix-command flakes
|
||||
flake-registry = ${empty_registry}
|
||||
'';
|
||||
registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
};
|
||||
};
|
||||
};
|
||||
testScript =
|
||||
|
|
Loading…
Add table
Reference in a new issue