about summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorlaalsaas <laalsaas@systemli.org>2022-10-21 18:00:53 +0200
committerlaalsaas <laalsaas@systemli.org>2022-11-07 20:27:00 +0100
commit5f07247a07387d29e2323e4856d5992b67efdac6 (patch)
tree2b991cc0927ac75487a09f7495ff6e39edf2c7d4 /nixos/modules/programs
parente6b77730725277ce96284c715ac26d0c10215876 (diff)
mepo: init module
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/mepo.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/nixos/modules/programs/mepo.nix b/nixos/modules/programs/mepo.nix
new file mode 100644
index 0000000000000..4b1706a2a0e53
--- /dev/null
+++ b/nixos/modules/programs/mepo.nix
@@ -0,0 +1,46 @@
+{ pkgs, config, lib, ...}:
+with lib;
+let
+  cfg = config.programs.mepo;
+in
+{
+  options.programs.mepo = {
+    enable = mkEnableOption (mdDoc "Mepo");
+
+    locationBackends = {
+      gpsd = mkOption {
+        type = types.bool;
+        default = false;
+        description = mdDoc ''
+          Whether to enable location detection via gpsd.
+          This may require additional configuration of gpsd, see [here](#opt-services.gpsd.enable)
+        '';
+      };
+
+      geoclue = mkOption {
+        type = types.bool;
+        default = true;
+        description = mdDoc "Whether to enable location detection via geoclue";
+      };
+    };
+  };
+
+  config = mkIf cfg.enable {
+    environment.systemPackages = with pkgs; [
+      mepo
+    ] ++ lib.optional cfg.locationBackends.geoclue geoclue2-with-demo-agent
+    ++ lib.optional cfg.locationBackends.gpsd gpsd;
+
+    services.geoclue2 = mkIf cfg.locationBackends.geoclue {
+      enable = true;
+      appConfig.where-am-i = {
+        isAllowed = true;
+        isSystem = false;
+      };
+    };
+
+    services.gpsd.enable = cfg.locationBackends.gpsd;
+  };
+
+  meta.maintainers = with maintainers; [ laalsaas ];
+}