summary refs log tree commit diff
path: root/modules/foundation/services.nix
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-12-07 18:59:51 +0100
committerMel <einebeere@gmail.com>2024-12-07 18:59:51 +0100
commit934ab7978b824e1cd7a9e8d8284e9fc2cd325eb1 (patch)
tree0b05c7d7f4dc4e992d9d08460c33801fdc374e15 /modules/foundation/services.nix
parentd1a88ffa2c8cf5d6dd690f9059c0da059e01b716 (diff)
downloadnetwork-934ab7978b824e1cd7a9e8d8284e9fc2cd325eb1.tar.zst
network-934ab7978b824e1cd7a9e8d8284e9fc2cd325eb1.zip
Allow global and tailnet ports in foundation
Signed-off-by: Mel <einebeere@gmail.com>
Diffstat (limited to 'modules/foundation/services.nix')
-rw-r--r--modules/foundation/services.nix19
1 files changed, 12 insertions, 7 deletions
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: