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