mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-30 09:00:19 +02:00
nixos/users: Allow mutable shells for declarative users
I want to manage users centrally via declarativeUsers, but allow users to change their shell as they please, similar to how they can change passwords at will if none of the password-related NixOS settings are set for their user.
This commit is contained in:
parent
f5ab71ba28
commit
a709b1a373
|
@ -228,6 +228,15 @@ foreach my $u (@{$spec->{users}}) {
|
|||
$u->{hashedPassword} = hashPassword($u->{password});
|
||||
}
|
||||
|
||||
if (!defined $u->{shell}) {
|
||||
if (defined $existing) {
|
||||
$u->{shell} = $existing->{shell};
|
||||
} else {
|
||||
warn "warning: no declarative or previous shell for ‘$name’, setting shell to nologin\n";
|
||||
$u->{shell} = "/run/current-system/sw/bin/nologin";
|
||||
}
|
||||
}
|
||||
|
||||
$u->{fakePassword} = $existing->{fakePassword} // "x";
|
||||
$usersOut{$name} = $u;
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ let
|
|||
};
|
||||
|
||||
shell = mkOption {
|
||||
type = types.either types.shellPackage types.path;
|
||||
type = types.nullOr (types.either types.shellPackage types.path);
|
||||
default = pkgs.shadow;
|
||||
defaultText = "pkgs.shadow";
|
||||
example = literalExample "pkgs.bashInteractive";
|
||||
|
|
Loading…
Reference in a new issue