introduce lib.rad-dev.mapAttrsToString, fix mc-router
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
parent
3eb1b759fe
commit
680b2b036d
@ -58,5 +58,20 @@
|
|||||||
# fileList :: Path -> String -> [Path]
|
# fileList :: Path -> String -> [Path]
|
||||||
fileList = dir: map (file: dir + "/${file}") (ls dir);
|
fileList = dir: map (file: dir + "/${file}") (ls dir);
|
||||||
|
|
||||||
|
# reduce an attribute set to a string
|
||||||
|
#
|
||||||
|
# example:
|
||||||
|
# given attrset {host1 = "palatine-hill"; host2 = "jeeves";}
|
||||||
|
# and func (host: hostname: host + " is " + hostname + ", " )
|
||||||
|
# mapAttrsToString would return 'host1 is palatine-hill, host2 is jeeves, '
|
||||||
|
#
|
||||||
|
# args:
|
||||||
|
# func: an function to apply to attrSet to turn each entry into one string
|
||||||
|
# attrSet: an attribute set to reduce
|
||||||
|
#
|
||||||
|
# type:
|
||||||
|
# mapAttrsToString :: AttrSet -> (String -> Any -> String) -> String
|
||||||
|
mapAttrsToString =
|
||||||
|
func: attrSet: (lib.foldl' (cur: next: cur + next) "" (lib.mapAttrsToList func attrSet));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ let
|
|||||||
USE_AIKAR_FLAGS = "true";
|
USE_AIKAR_FLAGS = "true";
|
||||||
MEMORY = "8GB";
|
MEMORY = "8GB";
|
||||||
ALLOW_FLIGHT = "true";
|
ALLOW_FLIGHT = "true";
|
||||||
MAX_TICK_TIME = -1;
|
MAX_TICK_TIME = "-1";
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultOptions = [
|
defaultOptions = [
|
||||||
@ -32,7 +32,7 @@ let
|
|||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
virtualisation.oci-containers = {
|
virtualisation.oci-containers.containers = {
|
||||||
mc-router = {
|
mc-router = {
|
||||||
image = "itzg/mc-router:latest";
|
image = "itzg/mc-router:latest";
|
||||||
extraOptions = [
|
extraOptions = [
|
||||||
@ -40,9 +40,12 @@ in
|
|||||||
"--network=haproxy-net"
|
"--network=haproxy-net"
|
||||||
"--network=minecraft-net"
|
"--network=minecraft-net"
|
||||||
];
|
];
|
||||||
command =
|
cmd = [
|
||||||
|
(
|
||||||
"--mapping=mc.alicehuston.xyz=${defaultServer}:25565"
|
"--mapping=mc.alicehuston.xyz=${defaultServer}:25565"
|
||||||
+ (lib.mapAttrs (hostname: url: ",${url}=${hostname}:25565") servers);
|
+ (lib.rad-dev.mapAttrsToString (hostname: url: "," + url + "=" + hostname + ":25565") servers)
|
||||||
|
)
|
||||||
|
];
|
||||||
};
|
};
|
||||||
rlcraft = {
|
rlcraft = {
|
||||||
image = "itzg/minecraft-server:java8";
|
image = "itzg/minecraft-server:java8";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user