diff options
| author | Mel <einebeere@gmail.com> | 2024-12-08 17:51:38 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2024-12-08 17:51:38 +0100 |
| commit | 53208759dbfafc2909c93ccaace32b5b8951abad (patch) | |
| tree | 60f7a80babe56e9d545839b321456c372c4e003c /modules/foundation | |
| parent | 3ffb1a24cba360070727c250aa93eca343c7da62 (diff) | |
| download | network-53208759dbfafc2909c93ccaace32b5b8951abad.tar.zst network-53208759dbfafc2909c93ccaace32b5b8951abad.zip | |
Allow passing in single symmetrical port to foundation service module
Signed-off-by: Mel <einebeere@gmail.com>
Diffstat (limited to 'modules/foundation')
| -rw-r--r-- | modules/foundation/services.nix | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/foundation/services.nix b/modules/foundation/services.nix index ddc3263..5acb0c6 100644 --- a/modules/foundation/services.nix +++ b/modules/foundation/services.nix @@ -28,7 +28,7 @@ let ports = mkOption { type = with types; listOf ( - either (listOf ints.u16) str + oneOf [(listOf port) str port] ); default = [ ]; }; @@ -134,15 +134,17 @@ in virtualisation.oci-containers.containers = let mkOciPort = - portStrOrTuple: - if builtins.isList portStrOrTuple then + portSetting: + if builtins.isList portSetting then let - host = builtins.elemAt portStrOrTuple 0; - container = builtins.elemAt portStrOrTuple 1; + host = builtins.elemAt portSetting 0; + container = builtins.elemAt portSetting 1; in "127.0.0.1:${toString host}:${toString container}" + else if builtins.isInt portSetting then + "127.0.0.1:${toString portSetting}:${toString portSetting}" else - portStrOrTuple; + portSetting; mkOciVolume = volumeTuple: |
