Allow setting markers on a per-user basis
This commit is contained in:
parent
2b84d5bbed
commit
16d97b8a29
1 changed files with 24 additions and 4 deletions
28
marker.nix
28
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)
|
||||
|
|
Loading…
Reference in a new issue