summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2014-09-05 20:01:08 -0500
committerThomas Tuegel <ttuegel@gmail.com>2014-09-05 20:01:08 -0500
commit53fa51717658830f466b539a21d5401056b8adce (patch)
tree6f3f49b764bcc9b9417d88bacf7db5f8285c5113 /nixos/tests
parentf4ebb3ebac9ccaf1dacebba0550c21818101be3d (diff)
parent6fb6ba48f85f7ec8f954428468e96ce55f5535a3 (diff)
Merge pull request #3961 from wkennington/master.grub
nixos/install-grub: Read correct mountpoints
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/installer.nix25
1 files changed, 22 insertions, 3 deletions
diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
index 66ab2567e197f..3e29bc2a45b0f 100644
--- a/nixos/tests/installer.nix
+++ b/nixos/tests/installer.nix
@@ -35,7 +35,8 @@ let
 
 
   # The configuration to install.
-  makeConfig = { testChannel, useEFI, grubVersion, grubDevice, grubIdentifier }:
+  makeConfig = { testChannel, useEFI, grubVersion, grubDevice, grubIdentifier
+    , readOnly ? true, forceGrubReinstallCount ? 0 }:
     pkgs.writeText "configuration.nix" ''
       { config, pkgs, modulesPath, ... }:
 
@@ -57,6 +58,10 @@ let
           boot.loader.grub.fsIdentifier = "${grubIdentifier}";
         ''}
 
+        boot.loader.grub.configurationLimit = 100 + ${toString forceGrubReinstallCount};
+
+        ${optionalString (!readOnly) "nix.readOnlyStore = false;"}
+
         environment.systemPackages = [ ${optionalString testChannel "pkgs.rlwrap"} ];
       }
     '';
@@ -198,16 +203,30 @@ let
       $machine->succeed("type -tP ls | tee /dev/stderr") =~ /.nix-profile/
           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.
       $machine->succeed("nixos-rebuild switch >&2");
 
       # Test nixos-option.
       $machine->succeed("nixos-option boot.initrd.kernelModules | grep virtio_console");
-      $machine->succeed("nixos-option -d boot.initrd.kernelModules | grep 'List of modules'");
-      $machine->succeed("nixos-option -l boot.initrd.kernelModules | grep qemu-guest.nix");
+      $machine->succeed("nixos-option boot.initrd.kernelModules | grep 'List of modules'");
+      $machine->succeed("nixos-option  boot.initrd.kernelModules | grep qemu-guest.nix");
 
       $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
       # "nixos-rebuild switch".
       $machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });