diff options
author | Peter Hoeg <peter@hoeg.com> | 2019-10-30 10:50:52 +0800 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2019-10-30 10:50:52 +0800 |
commit | d7ebe004536f319b6408e86bee90f5fdc63846a9 (patch) | |
tree | f37f6f1f90e780c87d0b36e79081007e5520749a /nixos | |
parent | 4cd2cb43fb3a87f48c1e10bb65aee99d8f24cb9d (diff) | |
download | nixpkgs-d7ebe004536f319b6408e86bee90f5fdc63846a9.tar nixpkgs-d7ebe004536f319b6408e86bee90f5fdc63846a9.tar.gz nixpkgs-d7ebe004536f319b6408e86bee90f5fdc63846a9.tar.bz2 nixpkgs-d7ebe004536f319b6408e86bee90f5fdc63846a9.tar.lz nixpkgs-d7ebe004536f319b6408e86bee90f5fdc63846a9.tar.xz nixpkgs-d7ebe004536f319b6408e86bee90f5fdc63846a9.tar.zst nixpkgs-d7ebe004536f319b6408e86bee90f5fdc63846a9.zip |
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
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/desktops/geoclue2.nix | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/nixos/modules/services/desktops/geoclue2.nix b/nixos/modules/services/desktops/geoclue2.nix index 6007dddf50c..df20360a110 100644 --- a/nixos/modules/services/desktops/geoclue2.nix +++ b/nixos/modules/services/desktops/geoclue2.nix @@ -188,34 +188,41 @@ in systemd.packages = [ package ]; - users.users.geoclue = { - isSystemUser = true; - home = "/var/lib/geoclue"; - group = "geoclue"; - description = "Geoinformation service"; - }; - - users.groups.geoclue = {}; + # we cannot use DynamicUser as we need the the geoclue user to exist for the dbus policy to work + users = { + users.geoclue = { + isSystemUser = true; + home = "/var/lib/geoclue"; + group = "geoclue"; + description = "Geoinformation service"; + }; - systemd.tmpfiles.rules = [ - "d /var/lib/geoclue 0755 geoclue geoclue" - ]; + groups.geoclue = {}; + }; - # restart geoclue service when the configuration changes - systemd.services.geoclue.restartTriggers = [ - config.environment.etc."geoclue/geoclue.conf".source - ]; + systemd.services.geoclue = { + # restart geoclue service when the configuration changes + restartTriggers = [ + config.environment.etc."geoclue/geoclue.conf".source + ]; + serviceConfig.StateDirectory = "geoclue"; + }; # this needs to run as a user service, since it's associated with the # user who is making the requests systemd.user.services = mkIf cfg.enableDemoAgent { geoclue-agent = { description = "Geoclue agent"; - script = "${package}/libexec/geoclue-2.0/demos/agent"; # this should really be `partOf = [ "geoclue.service" ]`, but # we can't be part of a system service, and the agent should # be okay with the main service coming and going wantedBy = [ "default.target" ]; + serviceConfig = { + Type = "exec"; + ExecStart = "${package}/libexec/geoclue-2.0/demos/agent"; + Restart = "on-failure"; + PrivateTmp = true; + }; }; }; |