* Move the configuration of the pwdutils (passwd, useradd etc.) to

modules/programs/pwdutils.
* Renamed config.system.shell to config.users.defaultUserShell and
  updated the description to make clear it has to be a non-store
  path.

svn path=/nixos/branches/modular-nixos/; revision=15761
This commit is contained in:
Eelco Dolstra 2009-05-28 12:24:56 +00:00
parent dfe03fc7f9
commit ec55562ec3
9 changed files with 54 additions and 39 deletions

View File

@ -72,26 +72,6 @@ let
target = "hosts";
}
{ # Configuration for pwdutils (login, passwd, useradd, etc.).
# You cannot login without it!
source = ./login.defs;
target = "login.defs";
}
{ # Configuration for passwd and friends (e.g., hash algorithm
# for /etc/passwd).
source = ./default/passwd;
target = "default/passwd";
}
{ # Configuration for useradd.
source = pkgs.substituteAll {
src = ./default/useradd;
defaultShell = config.system.shell;
};
target = "default/useradd";
}
]
# A bunch of PAM configuration files for various programs.

View File

@ -1,3 +0,0 @@
GROUP=100
HOME=/home
SHELL=@defaultShell@

View File

@ -42,7 +42,6 @@ in
###### implementation
let
ids = import ../../system/ids.nix;
defaultShell = config.system.shell;
# User accounts to be created/updated by NixOS.
users =
@ -53,7 +52,7 @@ let
uid = ids.uids.root;
description = "System administrator";
home = "/root";
shell = defaultShell;
shell = config.users.defaultUserShell;
group = "root";
}
{ name = "nobody";
@ -78,7 +77,7 @@ let
, group ? "nogroup"
, extraGroups ? []
, home ? "/var/empty"
, shell ? (if useDefaultShell then defaultShell else "/noshell")
, shell ? (if useDefaultShell then config.users.defaultUserShell else "/noshell")
, createHome ? false
, useDefaultShell ? false
}:

View File

@ -9,6 +9,7 @@
./installer/grub/grub.nix
./legacy.nix
./programs/bash/bash.nix
./programs/pwdutils/pwdutils.nix
./programs/ssh.nix
./programs/ssmtp.nix
./security/setuid-wrappers.nix

View File

@ -0,0 +1,50 @@
# Configuration for the pwdutils suite of tools: passwd, useradd, etc.
{config, pkgs, ...}:
let
options = {
users.defaultUserShell = pkgs.lib.mkOption {
default = "/var/run/current-system/sw/bin/bash";
description = ''
This option defined the default shell assigned to user
accounts. This must not be a store path, since the path is
used outside the store (in particular in /etc/passwd).
Rather, it should be the path of a symlink that points to the
actual shell in the Nix store.
'';
};
};
in
{
require = [options];
environment.etc =
[ { # /etc/login.defs: global configuration for pwdutils. You
# cannot login without it!
source = ./login.defs;
target = "login.defs";
}
{ # /etc/default/passwd: configuration for passwd and friends
# (e.g., hash algorithm for /etc/passwd).
source = ./passwd.conf;
target = "default/passwd";
}
{ # /etc/default/useradd: configuration for useradd.
source = pkgs.writeText "useradd"
''
GROUP=100
HOME=/home
SHELL=${config.users.defaultUserShell}
'';
target = "default/useradd";
}
];
}

View File

@ -106,7 +106,7 @@ let
touch /etc/shadow; chmod 0600 /etc/shadow
# Can't use useradd, since it complains that it doesn't know us
# (bootstrap problem!).
echo "root:x:0:0:System administrator:$rootHome:${config.system.shell}" >> /etc/passwd
echo "root:x:0:0:System administrator:$rootHome:${config.users.defaultUserShell}" >> /etc/passwd
echo "root::::::::" >> /etc/shadow
echo | passwd --stdin root
fi

View File

@ -15,18 +15,6 @@ let
Attribute set of derivations used to setup the system.
'';
};
shell = mkOption {
default = "/var/run/current-system/sw/bin/bash";
description = ''
This option defines the path to the Bash shell. It should
generally not be overriden.
'';
merge = list:
assert list != [] && builtins.tail list == [];
builtins.head list;
};
};
};
in