mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 21:32:23 +03:00
nixos/geoclue: minor cleanups
- spawn the geoclue-agent directly instead of running it via bash - document why we cannot use DynamicUser = true - have systemd create the home directory instead of using an explicit tmpfiles.d fragment
This commit is contained in:
parent
4cd2cb43fb
commit
d7ebe00453
@ -188,34 +188,41 @@ in
|
|||||||
|
|
||||||
systemd.packages = [ package ];
|
systemd.packages = [ package ];
|
||||||
|
|
||||||
users.users.geoclue = {
|
# we cannot use DynamicUser as we need the the geoclue user to exist for the dbus policy to work
|
||||||
isSystemUser = true;
|
users = {
|
||||||
home = "/var/lib/geoclue";
|
users.geoclue = {
|
||||||
group = "geoclue";
|
isSystemUser = true;
|
||||||
description = "Geoinformation service";
|
home = "/var/lib/geoclue";
|
||||||
|
group = "geoclue";
|
||||||
|
description = "Geoinformation service";
|
||||||
|
};
|
||||||
|
|
||||||
|
groups.geoclue = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
users.groups.geoclue = {};
|
systemd.services.geoclue = {
|
||||||
|
# restart geoclue service when the configuration changes
|
||||||
systemd.tmpfiles.rules = [
|
restartTriggers = [
|
||||||
"d /var/lib/geoclue 0755 geoclue geoclue"
|
config.environment.etc."geoclue/geoclue.conf".source
|
||||||
];
|
];
|
||||||
|
serviceConfig.StateDirectory = "geoclue";
|
||||||
# restart geoclue service when the configuration changes
|
};
|
||||||
systemd.services.geoclue.restartTriggers = [
|
|
||||||
config.environment.etc."geoclue/geoclue.conf".source
|
|
||||||
];
|
|
||||||
|
|
||||||
# this needs to run as a user service, since it's associated with the
|
# this needs to run as a user service, since it's associated with the
|
||||||
# user who is making the requests
|
# user who is making the requests
|
||||||
systemd.user.services = mkIf cfg.enableDemoAgent {
|
systemd.user.services = mkIf cfg.enableDemoAgent {
|
||||||
geoclue-agent = {
|
geoclue-agent = {
|
||||||
description = "Geoclue agent";
|
description = "Geoclue agent";
|
||||||
script = "${package}/libexec/geoclue-2.0/demos/agent";
|
|
||||||
# this should really be `partOf = [ "geoclue.service" ]`, but
|
# this should really be `partOf = [ "geoclue.service" ]`, but
|
||||||
# we can't be part of a system service, and the agent should
|
# we can't be part of a system service, and the agent should
|
||||||
# be okay with the main service coming and going
|
# be okay with the main service coming and going
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "exec";
|
||||||
|
ExecStart = "${package}/libexec/geoclue-2.0/demos/agent";
|
||||||
|
Restart = "on-failure";
|
||||||
|
PrivateTmp = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user