Syncthing: allow the syncthing user to stop syncthing service
This commit is contained in:
parent
008f1bc36f
commit
5f983678dc
1 changed files with 14 additions and 0 deletions
|
|
@ -8,4 +8,18 @@
|
||||||
dataDir = config.users.users.toast.home;
|
dataDir = config.users.users.toast.home;
|
||||||
folders."passwords".path = "~/Documents/Passwords";
|
folders."passwords".path = "~/Documents/Passwords";
|
||||||
};
|
};
|
||||||
|
# Allow regular users to stop syncthing
|
||||||
|
# https://stackoverflow.com/questions/61480914/using-policykit-to-allow-non-root-users-to-start-and-stop-a-service
|
||||||
|
security.polkit.extraConfig = ''
|
||||||
|
polkit.addRule(function(action, subject) {
|
||||||
|
if (
|
||||||
|
action.id == "org.freedesktop.systemd1.manage-units" &&
|
||||||
|
action.lookup("unit") == "syncthing.service" &&
|
||||||
|
subject.user == "${config.services.syncthing.user}"
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return polkit.Result.YES;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue