summary refs log tree commit diff
path: root/nixos/modules/installer/cd-dvd/installation-cd-base.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/installer/cd-dvd/installation-cd-base.nix')
-rw-r--r--nixos/modules/installer/cd-dvd/installation-cd-base.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix
index 6c7ea293e8a..aecb65b8c57 100644
--- a/nixos/modules/installer/cd-dvd/installation-cd-base.nix
+++ b/nixos/modules/installer/cd-dvd/installation-cd-base.nix
@@ -30,5 +30,16 @@ with lib;
   # Add Memtest86+ to the CD.
   boot.loader.grub.memtest86.enable = true;
 
+  boot.postBootCommands = ''
+    for o in $(</proc/cmdline); do
+      case "$o" in
+        live.nixos.passwd=*)
+          set -- $(IFS==; echo $o)
+          echo "nixos:$2" | ${pkgs.shadow}/bin/chpasswd
+          ;;
+      esac
+    done
+  '';
+
   system.stateVersion = mkDefault "18.03";
 }