2024-09-09 00:22:14 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
inputs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-09-13 01:50:53 +00:00
|
|
|
with lib; let
|
2024-09-09 00:22:14 +00:00
|
|
|
cfg = config.custom.services.geoclue2;
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
|
|
|
options.custom.services.geoclue2.enable = mkOption {default = false;};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-09-13 01:50:53 +00:00
|
|
|
age.secrets = let
|
|
|
|
secret = filename: {
|
|
|
|
file = "${inputs.self}/secrets/${filename}";
|
|
|
|
owner = "geoclue";
|
|
|
|
group = "geoclue";
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
|
|
|
"desktop/geoclue2/geolocation" = secret "desktop/geoclue2/geolocation";
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
# https://gitlab.freedesktop.org/geoclue/geoclue
|
|
|
|
# FIXME: geoclue2 relies on MLS, which is retired
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/321121
|
|
|
|
# TODO: Use static source option when merged into unstable
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/329654
|
|
|
|
services.geoclue2 = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
# Overriden by static source
|
|
|
|
enable3G = false;
|
|
|
|
enableCDMA = false;
|
|
|
|
enableModemGPS = false;
|
|
|
|
enableNmea = false;
|
|
|
|
enableWifi = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Manually use static source from coordinates
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/311595#issuecomment-2247989491
|
|
|
|
environment.etc = {
|
|
|
|
"geolocation".source = config.age.secrets."desktop/geoclue2/geolocation".path;
|
|
|
|
|
|
|
|
"geoclue/conf.d/00-config.conf".text = ''
|
|
|
|
[static-source]
|
|
|
|
enable=true
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|