about summary refs log tree commit diff
path: root/nixos/modules/programs/mepo.nix
blob: 22596892ff5dc261b1a5e17f43fe3ad23e2172b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ pkgs, config, lib, ...}:
with lib;
let
  cfg = config.programs.mepo;
in
{
  options.programs.mepo = {
    enable = mkEnableOption "Mepo, a fast, simple and hackable OSM map viewer";

    locationBackends = {
      gpsd = mkOption {
        type = types.bool;
        default = false;
        description = ''
          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 = "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 ];
}