feat: Allow setting a password on cmdline for pxe boot

This commit is contained in:
Flo
2024-11-24 15:12:14 +01:00
committed by GitHub
parent 76193bc2e9
commit 65dc95e52f
@@ -141,6 +141,17 @@ with lib;
# /etc/NIXOS tag.
touch /etc/NIXOS
${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
# Set password for user nixos if specified on cmdline
# Allows using nixos-anywhere in headless environments
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
'';
};