1
1
Fork 0

geoclue2: add static option

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2024-12-21 13:45:02 -05:00
parent 5b5a6d823b
commit 71d72af36c
Signed by: myned
GPG key ID: C7224454F7881A34
2 changed files with 21 additions and 16 deletions

View file

@ -8,6 +8,7 @@ with lib; {
(mkIf config.custom.default {
#// automatic-timezoned.enable = true;
#// agenix.enable = true;
geoclue2.enable = true;
#// netbird.enable = true;
tailscale.enable = true;
tzupdate.enable = true;
@ -17,7 +18,6 @@ with lib; {
dbus.enable = true;
flatpak.enable = true;
fwupd.enable = true;
geoclue2.enable = true;
#// kdeconnect.enable = true;
libinput.enable = true;
logind.enable = true;

View file

@ -7,7 +7,10 @@
with lib; let
cfg = config.custom.services.geoclue2;
in {
options.custom.services.geoclue2.enable = mkOption {default = false;};
options.custom.services.geoclue2 = {
enable = mkOption {default = false;};
static = mkOption {default = true;};
};
config = mkIf cfg.enable {
age.secrets = let
@ -17,17 +20,19 @@ in {
group = "geoclue";
};
in {
"common/geoclue2/geolocation" = secret "common/geoclue2/geolocation";
"common/geoclue2/geolocation" = mkIf cfg.static (secret "common/geoclue2/geolocation");
};
# https://gitlab.freedesktop.org/geoclue/geoclue
# FIXME: geoclue2 relies on MLS, which is retired
# https://github.com/NixOS/nixpkgs/issues/321121
services.geoclue2 =
{
enable = true;
}
// optionalAttrs cfg.static {
# 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;
@ -38,7 +43,7 @@ in {
# Manually use static source from coordinates
# https://github.com/NixOS/nixpkgs/issues/311595#issuecomment-2247989491
environment.etc = {
environment.etc = mkIf cfg.static {
"geolocation".source = config.age.secrets."common/geoclue2/geolocation".path;
"geoclue/conf.d/00-config.conf".text = ''