From 16d97b8a29f13e66e6dd075273655d619074457e Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 27 Apr 2024 00:14:19 +0200 Subject: [PATCH] Allow setting markers on a per-user basis --- marker.nix | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/marker.nix b/marker.nix index 1b5e344..83db38a 100644 --- a/marker.nix +++ b/marker.nix @@ -8,20 +8,40 @@ let }; }; }; + + userType = lib.types.submodule { + options = { + departure = lib.mkOption { + type = markerType; + default = {}; + }; + }; + }; in { options = { + users = lib.mkOption { + type = lib.types.attrsOf userType; + }; + map.markers = lib.mkOption { type = lib.types.listOf markerType; }; }; config = { + users = { + manuel.departure.location = "Switzerland"; + ganondorf.departure.location = "Argentinia"; + }; + map = { - markers = [ - { location = "Switzerland"; } - { location = "New York"; } - ]; + markers = lib.filter + (marker: marker.location != null) + ( + lib.concatMap (user: [ + user.departure + ]) (lib.attrValues config.users)); center = lib.mkIf (lib.length config.map.markers >= 1)