1{
2 pkgs,
3 config,
4 lib,
5 ...
6}:
7let
8 cfg = config.programs.mepo;
9in
10{
11 options.programs.mepo = {
12 enable = lib.mkEnableOption "Mepo, a fast, simple and hackable OSM map viewer";
13
14 locationBackends = {
15 gpsd = lib.mkOption {
16 type = lib.types.bool;
17 default = false;
18 description = ''
19 Whether to enable location detection via gpsd.
20 This may require additional configuration of gpsd, see [here](#opt-services.gpsd.enable)
21 '';
22 };
23
24 geoclue = lib.mkOption {
25 type = lib.types.bool;
26 default = true;
27 description = "Whether to enable location detection via geoclue";
28 };
29 };
30 };
31
32 config = lib.mkIf cfg.enable {
33 environment.systemPackages =
34 with pkgs;
35 [
36 mepo
37 ]
38 ++ lib.optional cfg.locationBackends.geoclue geoclue2-with-demo-agent
39 ++ lib.optional cfg.locationBackends.gpsd gpsd;
40
41 services.geoclue2 = lib.mkIf cfg.locationBackends.geoclue {
42 enable = true;
43 appConfig.where-am-i = {
44 isAllowed = true;
45 isSystem = false;
46 };
47 };
48
49 services.gpsd.enable = cfg.locationBackends.gpsd;
50 };
51
52 meta.maintainers = with lib.maintainers; [ laalsaas ];
53}