NixTutorial/marker.nix

38 lines
751 B
Nix
Raw Normal View History

2024-04-26 16:17:35 +00:00
{ lib, config, ... }:
let
markerType = lib.types.submodule {
options = {
location = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
};
};
in
{
options = {
map.markers = lib.mkOption {
type = lib.types.listOf markerType;
};
};
config = {
map = {
markers = [
{ location = "Switzerland"; }
{ location = "New York"; }
];
};
requestParams =
let
paramsForMarkers = builtins.map
(marker: "$(${config.scripts.geocode}/bin/geocode ${
lib.escapeShellArg marker.location})")
config.map.markers;
in [
"markers=\"${lib.concatStringsSep "|" paramsForMarkers}\""
];
};
}