From 934ab7978b824e1cd7a9e8d8284e9fc2cd325eb1 Mon Sep 17 00:00:00 2001 From: Mel Date: Sat, 7 Dec 2024 18:59:51 +0100 Subject: Allow global and tailnet ports in foundation Signed-off-by: Mel --- modules/foundation/services.nix | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'modules/foundation') diff --git a/modules/foundation/services.nix b/modules/foundation/services.nix index d4edcb3..ddc3263 100644 --- a/modules/foundation/services.nix +++ b/modules/foundation/services.nix @@ -27,7 +27,9 @@ let }; ports = mkOption { - type = with types; listOf (listOf ints.u16); + type = with types; listOf ( + either (listOf ints.u16) str + ); default = [ ]; }; @@ -132,12 +134,15 @@ in virtualisation.oci-containers.containers = let mkOciPort = - portTuple: - let - host = builtins.elemAt portTuple 0; - container = builtins.elemAt portTuple 1; - in - "127.0.0.1:${toString host}:${toString container}"; + portStrOrTuple: + if builtins.isList portStrOrTuple then + let + host = builtins.elemAt portStrOrTuple 0; + container = builtins.elemAt portStrOrTuple 1; + in + "127.0.0.1:${toString host}:${toString container}" + else + portStrOrTuple; mkOciVolume = volumeTuple: -- cgit 1.4.1