summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2023-09-30 01:16:21 +0200
committerGitHub <noreply@github.com>2023-09-30 01:16:21 +0200
commit3c3ef90189884d83d4002460735da62395635518 (patch)
tree889f3ca5df01a84a2f7633f544649206b8ca6eba /nixos/modules/system
parent7eddaf49b817eefaf95c55fcc2b2b49e2fdd4758 (diff)
parentbc644aee70ff319d98ee1a75c8faf4767d6cdca6 (diff)
downloadnixpkgs-3c3ef90189884d83d4002460735da62395635518.tar
nixpkgs-3c3ef90189884d83d4002460735da62395635518.tar.gz
nixpkgs-3c3ef90189884d83d4002460735da62395635518.tar.bz2
nixpkgs-3c3ef90189884d83d4002460735da62395635518.tar.lz
nixpkgs-3c3ef90189884d83d4002460735da62395635518.tar.xz
nixpkgs-3c3ef90189884d83d4002460735da62395635518.tar.zst
nixpkgs-3c3ef90189884d83d4002460735da62395635518.zip
Merge pull request #242191 from tie/systemd-required-for-online-range
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/networkd.nix29
1 files changed, 18 insertions, 11 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index 24bd011fd8b..ef8204e2cf5 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -517,17 +517,24 @@ let
         (assertValueOneOf "Unmanaged" boolValues)
         (assertInt "Group")
         (assertRange "Group" 0 2147483647)
-        (assertValueOneOf "RequiredForOnline" (boolValues ++ [
-          "missing"
-          "off"
-          "no-carrier"
-          "dormant"
-          "degraded-carrier"
-          "carrier"
-          "degraded"
-          "enslaved"
-          "routable"
-        ]))
+        (assertValueOneOf "RequiredForOnline" (boolValues ++ (
+          let
+            # https://freedesktop.org/software/systemd/man/networkctl.html#missing
+            operationalStates = [
+              "missing"
+              "off"
+              "no-carrier"
+              "dormant"
+              "degraded-carrier"
+              "carrier"
+              "degraded"
+              "enslaved"
+              "routable"
+            ];
+            operationalStateRanges = concatLists (imap0 (i: min: map (max: "${min}:${max}") (drop i operationalStates)) operationalStates);
+          in
+          operationalStates ++ operationalStateRanges
+        )))
         (assertValueOneOf "RequiredFamilyForOnline" [
           "ipv4"
           "ipv6"