Added more advanced and flexible users management. Upgraded NixOS to 21.05

This commit is contained in:
Illia Chub 2021-06-21 13:24:50 +03:00
parent a422dee8e0
commit cc3d1e4d5e

View file

@ -42,6 +42,7 @@ makeConf() {
$network_import $network_import
$NIXOS_IMPORT $NIXOS_IMPORT
./files.nix ./files.nix
./users.nix
./mailserver/system/mailserver.nix ./mailserver/system/mailserver.nix
./mailserver/system/alps.nix ./mailserver/system/alps.nix
./vpn/ocserv.nix ./vpn/ocserv.nix
@ -92,7 +93,7 @@ makeConf() {
}; };
system.autoUpgrade.enable = true; system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = false; system.autoUpgrade.allowReboot = false;
system.autoUpgrade.channel = https://nixos.org/channels/nixos-20.09-small; system.autoUpgrade.channel = https://nixos.org/channels/nixos-21.05-small;
nix = { nix = {
optimise.automatic = true; optimise.automatic = true;
gc = { gc = {
@ -115,13 +116,6 @@ makeConf() {
enable = true; enable = true;
}; };
}; };
users.mutableUsers = false;
users.users = {
"$LUSER" = {
isNormalUser = true;
hashedPassword = "$HASHED_PASSWORD";
};
};
} }
EOF EOF
# If you rerun this later, be sure to prune the filesSystems attr # If you rerun this later, be sure to prune the filesSystems attr
@ -173,6 +167,23 @@ EOF
"f /var/cloudflareCredentials.ini 0440 nginx acmerecievers - \${cloudflareCredentials}" "f /var/cloudflareCredentials.ini 0440 nginx acmerecievers - \${cloudflareCredentials}"
]; ];
} }
EOF
cat > /etc/nixos/users.nix << EOF
{ pkgs, ... }:
{
users.mutableUsers = false;
users = {
users = {
#begin
"$LUSER" = {
isNormalUser = true;
hashedPassword = "$HASHED_PASSWORD";
};
#end
};
};
}
EOF EOF
cat > /etc/nixos/mailserver/system/mailserver.nix << EOF cat > /etc/nixos/mailserver/system/mailserver.nix << EOF