blob: f2401b9f53cbbfbb1715f0dfa4174da2099e51c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
{ ... }:
{
security.sudo.extraRules = [
{ groups = "wheel";
commands = map (command: { inherit command; options = "NOPASSWD"; }) [
"/run/current-system/sw/sbin/shutdown"
"/run/current-system/sw/sbin/reboot"
"/run/current-system/sw/sbin/halt"
"/run/current-system/sw/bin/systemctl"
];
}
];
users.extraGroups.network = {};
security.polkit = {
enable = true;
extraConfig = ''
polkit.addRule(function(action, subject) {
if ( action.id == "org.freedesktop.systemd1.manage-units"
&& subject.isInGroup("wheel")
) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if ((action.id == "org.blueman.rfkill.setstate" ||
action.id == "org.blueman.network.setup" ||
action.id == "org.freedesktop.NetworkManager.settings.modify.system"
) && subject.local
&& subject.active && subject.isInGroup("network")
) {
return polkit.Result.YES;
}
});
'';
};
}
|