diff options
author | Michael Peyton Jones <me@michaelpj.com> | 2018-08-09 15:29:07 +0100 |
---|---|---|
committer | Michael Peyton Jones <me@michaelpj.com> | 2018-08-14 15:55:04 +0100 |
commit | 316669327c6cb0e85dc522f0b7af55db33474553 (patch) | |
tree | a82f47430065b270c1345ef115db7e6dc210e7a4 /nixos/modules/services/desktops | |
parent | 284fc9b4496aa2032ac1bb82a2556a3055084398 (diff) | |
download | nixlib-316669327c6cb0e85dc522f0b7af55db33474553.tar nixlib-316669327c6cb0e85dc522f0b7af55db33474553.tar.gz nixlib-316669327c6cb0e85dc522f0b7af55db33474553.tar.bz2 nixlib-316669327c6cb0e85dc522f0b7af55db33474553.tar.lz nixlib-316669327c6cb0e85dc522f0b7af55db33474553.tar.xz nixlib-316669327c6cb0e85dc522f0b7af55db33474553.tar.zst nixlib-316669327c6cb0e85dc522f0b7af55db33474553.zip |
geoclue2 service: add option to run demo agent
Diffstat (limited to 'nixos/modules/services/desktops')
-rw-r--r-- | nixos/modules/services/desktops/geoclue2.nix | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/nixos/modules/services/desktops/geoclue2.nix b/nixos/modules/services/desktops/geoclue2.nix index c5a000d5c6a7..dafb0af20756 100644 --- a/nixos/modules/services/desktops/geoclue2.nix +++ b/nixos/modules/services/desktops/geoclue2.nix @@ -4,6 +4,10 @@ with lib; +let + # the demo agent isn't built by default, but we need it here + package = pkgs.geoclue2.override { withDemoAgent = config.services.geoclue2.enableDemoAgent; }; +in { ###### interface @@ -21,21 +25,42 @@ with lib; ''; }; + enableDemoAgent = mkOption { + type = types.bool; + default = true; + description = '' + Whether to use the GeoClue demo agent. This should be + overridden by desktop environments that provide their own + agent. + ''; + }; + }; }; ###### implementation - config = mkIf config.services.geoclue2.enable { - environment.systemPackages = [ pkgs.geoclue2 ]; - - services.dbus.packages = [ pkgs.geoclue2 ]; - - systemd.packages = [ pkgs.geoclue2 ]; - + environment.systemPackages = [ package ]; + + services.dbus.packages = [ package ]; + + systemd.packages = [ package ]; + + # this needs to run as a user service, since it's associated with the + # user who is making the requests + systemd.user.services = mkIf config.services.geoclue2.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" ]; + }; + }; }; } |