nixos/geoclue2: add option to manage whitelisted agents

The geoclue2 module recommends that the guest agent be disabled when the
desktop environment provides their own geoclue2 agent. But when a
desktop environment uses the demo agent directly, like COSMIC does, the
demo agent must be whitelisted. But disabling the demo agent also
removes it from the whitelisted agents.

This commit adds an option which holds a list of all whitelisted
geoclue2 agents. It allows for consumers like COSMIC to have the demo
agent disabled but still whitelisted for such use cases.
This commit is contained in:
Pratham Patel
2025-06-15 12:01:51 +05:30
parent a3cd7c8a3c
commit 1c19cb81e7
+14 -6
View File
@@ -8,11 +8,6 @@
let
cfg = config.services.geoclue2;
defaultWhitelist = [
"gnome-shell"
"io.elementary.desktop.agent-geoclue2"
];
appConfigModule = lib.types.submodule (
{ name, ... }:
{
@@ -85,6 +80,16 @@ in
that provides location information for accessing.
'';
};
whitelistedAgents = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
"gnome-shell"
"io.elementary.desktop.agent-geoclue2"
];
description = ''
Desktop IDs (without the .desktop extension) of whitelisted agents.
'';
};
enableDemoAgent = lib.mkOption {
type = lib.types.bool;
@@ -321,7 +326,10 @@ in
{
agent = {
whitelist = lib.concatStringsSep ";" (
lib.optional cfg.enableDemoAgent "geoclue-demo-agent" ++ defaultWhitelist
lib.lists.unique (
cfg.whitelistedAgents
++ lib.optionals config.services.geoclue2.enableDemoAgent [ "geoclue-demo-agent" ]
)
);
};
network-nmea = {