improvedDef/sshAuth: avoid root auth warning on installers too

main
Felix Stupp 2 months ago
parent b2b34a1bc7
commit a6fa19293d
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -53,6 +53,8 @@ in
isRootAuthed = isUserAuthed users."root"; isRootAuthed = isUserAuthed users."root";
doRootAuth = !isNonRootAuthed; doRootAuth = !isNonRootAuthed;
otherUserExists = nonRootUsers != [ ]; otherUserExists = nonRootUsers != [ ];
# explicit installer check required because installer set ups user "nixos" for installation
isInstaller = config.system.nixos.variant_id == "installer";
in in
{ {
@ -66,7 +68,7 @@ in
# warn only if other users exist -> multi-user machine # warn only if other users exist -> multi-user machine
# compared to "root"-only systems (e.g. installer, embedded systems) # compared to "root"-only systems (e.g. installer, embedded systems)
warnings = lib.mkIf (doRootAuth && otherUserExists) [ warnings = lib.mkIf (doRootAuth && otherUserExists && !isInstaller) [
'' ''
roots authorized keys were automatically configured roots authorized keys were automatically configured
because no other user with wheel permission has authorized keys configured because no other user with wheel permission has authorized keys configured

Loading…
Cancel
Save