* That wasn't quite right.

svn path=/nixos/branches/modular-nixos/; revision=15770
This commit is contained in:
Eelco Dolstra 2009-05-28 14:57:31 +00:00
parent fdbe09e914
commit e86b066625

View File

@ -33,9 +33,10 @@ let
}; };
}; };
}; };
inherit (pkgs.lib) concatStringsSep optional optionalString;
inherit (config.services.guestUsers) enable users includeRoot extraGroups; inherit (pkgs.lib) concatStringsSep optionalString;
cfg = config.services.guestUsers;
userEntry = user: userEntry = user:
{ {
@ -44,25 +45,29 @@ let
home = "/home/${user}"; home = "/home/${user}";
createHome = true; createHome = true;
group = "users"; group = "users";
extraGroups = extraGroups; extraGroups = cfg.extraGroups;
shell = "/bin/sh"; shell = "/bin/sh";
}; };
nameString = (concatStringsSep " " users) + optionalString includeRoot " root"; nameString = (concatStringsSep " " cfg.users) + optionalString cfg.includeRoot " root";
in in
{ pkgs.lib.mkIf cfg.enable {
require = options; require = options;
system.activationScripts = pkgs.lib.fullDepEntry system.activationScripts = {
clearPasswords = pkgs.lib.fullDepEntry
'' ''
for i in ${nameString}; do for i in ${nameString}; do
echo | ${pkgs.pwdutils}/bin/passwd --stdin $i echo | ${pkgs.pwdutils}/bin/passwd --stdin $i
done done
'' ["defaultPath" "users" "groups"]; '' ["defaultPath" "users" "groups"];
services.mingetty.helpLine = optionalString enable "\nThese users have empty passwords: ${nameString}"; };
users.extraUsers = map userEntry users; services.mingetty.helpLine = "\nThese users have empty passwords: ${nameString}";
users.extraUsers = map userEntry cfg.users;
} }