nixos/installer-test: Add writable store test
This commit is contained in:
parent
c6bd6d6d89
commit
e07e1c3fdf
@ -35,7 +35,8 @@ let
|
|||||||
|
|
||||||
|
|
||||||
# The configuration to install.
|
# The configuration to install.
|
||||||
makeConfig = { testChannel, useEFI, grubVersion, grubDevice, grubIdentifier }:
|
makeConfig = { testChannel, useEFI, grubVersion, grubDevice, grubIdentifier
|
||||||
|
, readOnly ? true, forceGrubReinstallCount ? 0 }:
|
||||||
pkgs.writeText "configuration.nix" ''
|
pkgs.writeText "configuration.nix" ''
|
||||||
{ config, pkgs, modulesPath, ... }:
|
{ config, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
@ -57,6 +58,10 @@ let
|
|||||||
boot.loader.grub.fsIdentifier = "${grubIdentifier}";
|
boot.loader.grub.fsIdentifier = "${grubIdentifier}";
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
boot.loader.grub.configurationLimit = 100 + ${toString forceGrubReinstallCount};
|
||||||
|
|
||||||
|
${optionalString (!readOnly) "nix.readOnlyStore = false;"}
|
||||||
|
|
||||||
environment.systemPackages = [ ${optionalString testChannel "pkgs.rlwrap"} ];
|
environment.systemPackages = [ ${optionalString testChannel "pkgs.rlwrap"} ];
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
@ -198,6 +203,11 @@ let
|
|||||||
$machine->succeed("type -tP ls | tee /dev/stderr") =~ /.nix-profile/
|
$machine->succeed("type -tP ls | tee /dev/stderr") =~ /.nix-profile/
|
||||||
or die "nix-env failed";
|
or die "nix-env failed";
|
||||||
|
|
||||||
|
# We need to a writable nix-store on next boot
|
||||||
|
$machine->copyFileFromHost(
|
||||||
|
"${ makeConfig { inherit testChannel useEFI grubVersion grubDevice grubIdentifier; readOnly = false; forceGrubReinstallCount = 1; } }",
|
||||||
|
"/etc/nixos/configuration.nix");
|
||||||
|
|
||||||
# Check whether nixos-rebuild works.
|
# Check whether nixos-rebuild works.
|
||||||
$machine->succeed("nixos-rebuild switch >&2");
|
$machine->succeed("nixos-rebuild switch >&2");
|
||||||
|
|
||||||
@ -208,6 +218,15 @@ let
|
|||||||
|
|
||||||
$machine->shutdown;
|
$machine->shutdown;
|
||||||
|
|
||||||
|
# Check whether a writable store build works
|
||||||
|
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
|
||||||
|
$machine->waitForUnit("multi-user.target");
|
||||||
|
$machine->copyFileFromHost(
|
||||||
|
"${ makeConfig { inherit testChannel useEFI grubVersion grubDevice grubIdentifier; readOnly = false; forceGrubReinstallCount = 2; } }",
|
||||||
|
"/etc/nixos/configuration.nix");
|
||||||
|
$machine->succeed("nixos-rebuild boot >&2");
|
||||||
|
$machine->shutdown;
|
||||||
|
|
||||||
# And just to be sure, check that the machine still boots after
|
# And just to be sure, check that the machine still boots after
|
||||||
# "nixos-rebuild switch".
|
# "nixos-rebuild switch".
|
||||||
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
|
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user