nixos/geoclue2: add package option (#326882)

authored by

Colin and committed by
GitHub
67fe3c23 768c6ed0

+15 -7
+15 -7
nixos/modules/services/desktops/geoclue2.nix
··· 5 with lib; 6 7 let 8 - # the demo agent isn't built by default, but we need it here 9 - package = pkgs.geoclue2.override { withDemoAgent = config.services.geoclue2.enableDemoAgent; }; 10 - 11 cfg = config.services.geoclue2; 12 13 defaultWhitelist = [ "gnome-shell" "io.elementary.desktop.agent-geoclue2" ]; ··· 132 ''; 133 }; 134 135 submitData = mkOption { 136 type = types.bool; 137 default = false; ··· 180 ###### implementation 181 config = mkIf cfg.enable { 182 183 - environment.systemPackages = [ package ]; 184 185 - services.dbus.packages = [ package ]; 186 187 - systemd.packages = [ package ]; 188 189 # we cannot use DynamicUser as we need the the geoclue user to exist for the 190 # dbus policy to work ··· 223 unitConfig.ConditionUser = "!@system"; 224 serviceConfig = { 225 Type = "exec"; 226 - ExecStart = "${package}/libexec/geoclue-2.0/demos/agent"; 227 Restart = "on-failure"; 228 PrivateTmp = true; 229 };
··· 5 with lib; 6 7 let 8 cfg = config.services.geoclue2; 9 10 defaultWhitelist = [ "gnome-shell" "io.elementary.desktop.agent-geoclue2" ]; ··· 129 ''; 130 }; 131 132 + package = mkOption { 133 + type = types.package; 134 + default = pkgs.geoclue2; 135 + defaultText = literalExpression "pkgs.geoclue2"; 136 + apply = pkg: pkg.override { 137 + # the demo agent isn't built by default, but we need it here 138 + withDemoAgent = cfg.enableDemoAgent; 139 + }; 140 + description = "The geoclue2 package to use"; 141 + }; 142 + 143 submitData = mkOption { 144 type = types.bool; 145 default = false; ··· 188 ###### implementation 189 config = mkIf cfg.enable { 190 191 + environment.systemPackages = [ cfg.package ]; 192 193 + services.dbus.packages = [ cfg.package ]; 194 195 + systemd.packages = [ cfg.package ]; 196 197 # we cannot use DynamicUser as we need the the geoclue user to exist for the 198 # dbus policy to work ··· 231 unitConfig.ConditionUser = "!@system"; 232 serviceConfig = { 233 Type = "exec"; 234 + ExecStart = "${cfg.package}/libexec/geoclue-2.0/demos/agent"; 235 Restart = "on-failure"; 236 PrivateTmp = true; 237 };