Skip to content

Commit 1858c3a

Browse files
committed
make system-to-install re-usuable for other tests
this is needed for the ubuntu test.
1 parent 597a900 commit 1858c3a

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

tests/flake-module.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
{
44
flake.checks.x86_64-linux = withSystem "x86_64-linux" ({ pkgs, system, inputs', config, ... }:
55
let
6+
system-to-install = pkgs.nixos [
7+
./modules/system-to-install.nix
8+
inputs.disko.nixosModules.disko
9+
];
610
testInputsUnstable = {
711
inherit pkgs;
812
inherit (inputs.disko.nixosModules) disko;
913
nixos-anywhere = config.packages.nixos-anywhere;
1014
kexec-installer = "${inputs'.nixos-images.packages.kexec-installer-nixos-unstable-noninteractive}/nixos-kexec-installer-noninteractive-${system}.tar.gz";
15+
inherit system-to-install;
1116
};
1217
testInputsStable = testInputsUnstable // {
1318
kexec-installer = "${inputs'.nixos-images.packages.kexec-installer-nixos-stable-noninteractive}/nixos-kexec-installer-noninteractive-${system}.tar.gz";

tests/lib/test-base.nix

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
test:
2-
{ pkgs ? import <nixpkgs> { }
3-
, nixos-anywhere ? pkgs.callPackage ../../src { }
4-
, disko ? "${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix"
5-
, kexec-installer ? builtins.fetchurl "https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-kexec-installer-noninteractive-${pkgs.stdenv.hostPlatform.system}.tar.gz"
2+
{ pkgs
3+
, nixos-anywhere
4+
, disko
5+
, kexec-installer
6+
, system-to-install
67
, ...
78
}:
89
let
@@ -14,6 +15,6 @@ in
1415
# speed-up evaluation
1516
defaults.documentation.enable = lib.mkDefault false;
1617
# to accept external dependencies such as disko
17-
node.specialArgs.inputs = { inherit nixos-anywhere disko kexec-installer; };
18+
node.specialArgs.inputs = { inherit nixos-anywhere disko kexec-installer system-to-install; };
1819
imports = [ test ];
1920
}).config.result

tests/modules/installer.nix

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
{ pkgs, inputs, ... }:
2-
let
3-
disko = inputs.disko;
4-
kexec-installer = inputs.kexec-installer;
5-
system-to-install = pkgs.nixos [
6-
./system-to-install.nix
7-
disko
8-
];
9-
in
102
{
113
system.activationScripts.rsa-key = ''
124
${pkgs.coreutils}/bin/install -D -m600 ${./ssh-keys/ssh} /root/.ssh/install_key
@@ -15,8 +7,8 @@ in
157
environment.systemPackages = [ inputs.nixos-anywhere ];
168

179
environment.etc = {
18-
"nixos-anywhere/disko".source = system-to-install.config.system.build.diskoScriptNoDeps;
19-
"nixos-anywhere/system-to-install".source = system-to-install.config.system.build.toplevel;
20-
"nixos-anywhere/kexec-installer".source = kexec-installer;
10+
"nixos-anywhere/disko".source = inputs.system-to-install.config.system.build.diskoScriptNoDeps;
11+
"nixos-anywhere/system-to-install".source = inputs.system-to-install.config.system.build.toplevel;
12+
"nixos-anywhere/kexec-installer".source = inputs.kexec-installer;
2113
};
2214
}

0 commit comments

Comments
 (0)