Allow setting markers on a per-user basis

This commit is contained in:
Manuel Thalmann 2024-04-27 00:14:19 +02:00
parent 2b84d5bbed
commit 16d97b8a29

View file

@ -8,20 +8,40 @@ let
}; };
}; };
}; };
userType = lib.types.submodule {
options = {
departure = lib.mkOption {
type = markerType;
default = {};
};
};
};
in in
{ {
options = { options = {
users = lib.mkOption {
type = lib.types.attrsOf userType;
};
map.markers = lib.mkOption { map.markers = lib.mkOption {
type = lib.types.listOf markerType; type = lib.types.listOf markerType;
}; };
}; };
config = { config = {
users = {
manuel.departure.location = "Switzerland";
ganondorf.departure.location = "Argentinia";
};
map = { map = {
markers = [ markers = lib.filter
{ location = "Switzerland"; } (marker: marker.location != null)
{ location = "New York"; } (
]; lib.concatMap (user: [
user.departure
]) (lib.attrValues config.users));
center = lib.mkIf center = lib.mkIf
(lib.length config.map.markers >= 1) (lib.length config.map.markers >= 1)