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 5 with lib; 6 6 7 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 8 cfg = config.services.geoclue2; 12 9 13 10 defaultWhitelist = [ "gnome-shell" "io.elementary.desktop.agent-geoclue2" ]; ··· 132 129 ''; 133 130 }; 134 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 + 135 143 submitData = mkOption { 136 144 type = types.bool; 137 145 default = false; ··· 180 188 ###### implementation 181 189 config = mkIf cfg.enable { 182 190 183 - environment.systemPackages = [ package ]; 191 + environment.systemPackages = [ cfg.package ]; 184 192 185 - services.dbus.packages = [ package ]; 193 + services.dbus.packages = [ cfg.package ]; 186 194 187 - systemd.packages = [ package ]; 195 + systemd.packages = [ cfg.package ]; 188 196 189 197 # we cannot use DynamicUser as we need the the geoclue user to exist for the 190 198 # dbus policy to work ··· 223 231 unitConfig.ConditionUser = "!@system"; 224 232 serviceConfig = { 225 233 Type = "exec"; 226 - ExecStart = "${package}/libexec/geoclue-2.0/demos/agent"; 234 + ExecStart = "${cfg.package}/libexec/geoclue-2.0/demos/agent"; 227 235 Restart = "on-failure"; 228 236 PrivateTmp = true; 229 237 };