2022-10-21 16:00:53 +00:00
|
|
|
{ pkgs, config, lib, ...}:
|
|
|
|
let
|
|
|
|
cfg = config.programs.mepo;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.mepo = {
|
2024-04-17 11:37:58 +00:00
|
|
|
enable = lib.mkEnableOption "Mepo, a fast, simple and hackable OSM map viewer";
|
2022-10-21 16:00:53 +00:00
|
|
|
|
|
|
|
locationBackends = {
|
2024-04-17 11:37:58 +00:00
|
|
|
gpsd = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2022-10-21 16:00:53 +00:00
|
|
|
default = false;
|
2024-04-13 12:54:15 +00:00
|
|
|
description = ''
|
2022-10-21 16:00:53 +00:00
|
|
|
Whether to enable location detection via gpsd.
|
|
|
|
This may require additional configuration of gpsd, see [here](#opt-services.gpsd.enable)
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
geoclue = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2022-10-21 16:00:53 +00:00
|
|
|
default = true;
|
2024-04-13 12:54:15 +00:00
|
|
|
description = "Whether to enable location detection via geoclue";
|
2022-10-21 16:00:53 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2022-10-21 16:00:53 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
mepo
|
|
|
|
] ++ lib.optional cfg.locationBackends.geoclue geoclue2-with-demo-agent
|
|
|
|
++ lib.optional cfg.locationBackends.gpsd gpsd;
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
services.geoclue2 = lib.mkIf cfg.locationBackends.geoclue {
|
2022-10-21 16:00:53 +00:00
|
|
|
enable = true;
|
|
|
|
appConfig.where-am-i = {
|
|
|
|
isAllowed = true;
|
|
|
|
isSystem = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.gpsd.enable = cfg.locationBackends.gpsd;
|
|
|
|
};
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
meta.maintainers = with lib.maintainers; [ laalsaas ];
|
2022-10-21 16:00:53 +00:00
|
|
|
}
|