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