50 lines
1.4 KiB
Nix
Raw Normal View History

{ config, pkgs, lib, ... }: {
2023-01-26 00:23:55 +03:00
# FIXME: completely remove sudo
2019-09-14 22:12:56 +04:00
security.sudo = {
enable = true;
2022-12-07 22:13:34 +03:00
extraRules = [{
2022-12-10 22:34:39 +03:00
users = [ config.mainuser ];
2022-12-07 22:13:34 +03:00
commands = [{
command = "/run/current-system/sw/bin/nixos-rebuild";
options = [ "SETENV" "NOPASSWD" ];
} {
command = "/run/current-system/sw/bin/nix";
options = [ "SETENV" "NOPASSWD" ];
} {
command = "/run/current-system/sw/bin/nix-shell";
options = [ "SETENV" "NOPASSWD" ];
2023-02-14 07:04:20 +03:00
} {
command = "/run/current-system/sw/bin/extra-container";
options = [ "SETENV" "NOPASSWD" ];
} {
command = "/run/current-system/sw/bin/chown ${config.mainuser} /tmp/.X11-unix";
options = [ "SETENV" "NOPASSWD" ];
2023-01-26 00:23:55 +03:00
}
];
2022-12-07 22:13:34 +03:00
}];
2019-09-14 22:12:56 +04:00
};
2022-12-07 22:13:34 +03:00
security.doas = {
enable = true;
extraRules = [{
2022-12-10 22:34:39 +03:00
users = [ config.mainuser ];
2022-12-07 22:13:34 +03:00
keepEnv = true;
persist = true;
} {
2022-12-10 22:34:39 +03:00
users = [ config.mainuser ];
2022-12-07 22:13:34 +03:00
noPass = true;
keepEnv = true;
cmd = "/run/current-system/sw/bin/btrfs";
args = [ "fi" "usage" "/" ];
}] ++ lib.optionals config.deviceSpecific.isLaptop [{
2022-12-10 22:34:39 +03:00
users = [ config.mainuser ];
2022-12-07 22:13:34 +03:00
noPass = true;
keepEnv = true;
cmd = "/run/current-system/sw/bin/tlp";
} {
2022-12-10 22:34:39 +03:00
users = [ config.mainuser ];
2022-12-07 22:13:34 +03:00
noPass = true;
keepEnv = true;
cmd = "/run/current-system/sw/bin/tlp-stat";
}];
2021-09-16 01:03:52 +03:00
};
}