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
{
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)