snowhawk: relocate sudo-rules to module

This commit is contained in:
Zynh Ludwig 2024-09-13 17:12:13 -07:00
parent c612a81db7
commit ddd17ae4af
2 changed files with 25 additions and 10 deletions

View file

@ -81,16 +81,6 @@
user = "ravenshade"; user = "ravenshade";
}; };
security.sudo.extraRules = lib.mkIf false [
{
users = [ "ravenshade" ];
commands = [{
command = "${pkgs.nixos-rebuild}/bin/nixos-rebuild";
options = [ "SETENV" "NOPASSWD" ];
}];
}
];
security.polkit.enable = true; security.polkit.enable = true;
home-manager.users = { "ravenshade" = import ./home.nix; }; home-manager.users = { "ravenshade" = import ./home.nix; };

25
modules/sudo-rules.nix Normal file
View file

@ -0,0 +1,25 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.snowhawk.sudo-rules;
in
{
options.snowhawk.sudo-rules = {
enable = mkEnableOption "sudo-rules nixos module";
};
config = mkIf cfg.enable {
security.sudo.extraRules = lib.mkIf false [
{
users = [ "ravenshade" ];
commands = [{
command = "${pkgs.nixos-rebuild}/bin/nixos-rebuild";
options = [ "SETENV" "NOPASSWD" ];
}];
}
];
};
}