diff --git a/marker.nix b/marker.nix index 83db38a..1a69602 100644 --- a/marker.nix +++ b/marker.nix @@ -6,6 +6,12 @@ let type = lib.types.nullOr lib.types.str; default = null; }; + + style.label = lib.mkOption { + type = lib.types.nullOr + (lib.types.strMatching "[0-9A-Z]"); + default = null; + }; }; }; @@ -31,8 +37,15 @@ in config = { users = { - manuel.departure.location = "Switzerland"; - ganondorf.departure.location = "Argentinia"; + manuel.departure = { + location = "Switzerland"; + style.label = "M"; + }; + + ganondorf.departure = { + location = "Argentinia"; + style.label = "G"; + }; }; map = { @@ -54,12 +67,19 @@ in requestParams = let - paramsForMarkers = builtins.map - (marker: "$(${config.scripts.geocode}/bin/geocode ${ - lib.escapeShellArg marker.location})") - config.map.markers; - in [ - "markers=\"${lib.concatStringsSep "|" paramsForMarkers}\"" - ]; + paramForMarker = + marker: + let + attributes = + lib.optional (marker.style.label != null) + "label:${marker.style.label}" + ++ [ + "$(${config.scripts.geocode}/bin/geocode ${ + lib.escapeShellArg marker.location + })" + ]; + in + "markers=\"${lib.concatStringsSep "|" attributes}\""; + in builtins.map paramForMarker config.map.markers; }; }