Deploy without sudo password

This commit is contained in:
Andreas Zweili 2023-06-26 14:05:47 +02:00
parent 35b9bd3fde
commit 695a0043e2

View File

@ -113,17 +113,31 @@
}; };
security.sudo = { security.sudo = {
extraRules = [ extraRules =
{ let
users = [ "%wheel" ]; storePrefix = "/nix/store/*";
commands = [ systemName = "nixos-system-${config.networking.hostName}-*";
{ in
command = "ALL"; [
options = [ "SETENV" "NOPASSWD" ]; {
} commands = [
]; {
} command = "${storePrefix}-nix-*/bin/nix-env -p /nix/var/nix/profiles/system --set ${storePrefix}-${systemName}";
]; options = [ "NOPASSWD" ];
}
];
groups = [ "wheel" ];
}
{
commands = [
{
command = "${storePrefix}-${systemName}/bin/switch-to-configuration";
options = [ "NOPASSWD" ];
}
];
groups = [ "wheel" ];
}
];
}; };