summary refs log tree commit diff
path: root/nixos/modules/system/boot/initrd-network.nix
diff options
context:
space:
mode:
authorDino Dai Zovi <dino@capsule8.com>2018-03-05 10:53:59 -0500
committerFranz Pletz <fpletz@fnordicwalking.de>2018-03-05 15:53:59 +0000
commitddf13e6646d7c9af1e9c86d42563756944c32b85 (patch)
tree3b08cf2dc1b9ce78ae20d6b50953cfb62b2ce770 /nixos/modules/system/boot/initrd-network.nix
parent18055971cb8684281069cb476b24db0e3bda36a1 (diff)
downloadnixpkgs-ddf13e6646d7c9af1e9c86d42563756944c32b85.tar
nixpkgs-ddf13e6646d7c9af1e9c86d42563756944c32b85.tar.gz
nixpkgs-ddf13e6646d7c9af1e9c86d42563756944c32b85.tar.bz2
nixpkgs-ddf13e6646d7c9af1e9c86d42563756944c32b85.tar.lz
nixpkgs-ddf13e6646d7c9af1e9c86d42563756944c32b85.tar.xz
nixpkgs-ddf13e6646d7c9af1e9c86d42563756944c32b85.tar.zst
nixpkgs-ddf13e6646d7c9af1e9c86d42563756944c32b85.zip
nixos/initrd-network: add udhcpc.extraArgs option (#36305)
This can be used to fix issues where udhcpc times out before
acquiring a lease. For example of these issues, see:

https://bugs.alpinelinux.org/issues/3105#note-8

Signed-off-by: Dino A. Dai Zovi <ddz@theta44.org>
Diffstat (limited to 'nixos/modules/system/boot/initrd-network.nix')
-rw-r--r--nixos/modules/system/boot/initrd-network.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/initrd-network.nix b/nixos/modules/system/boot/initrd-network.nix
index 4a6e1c7e56e..33862b0965c 100644
--- a/nixos/modules/system/boot/initrd-network.nix
+++ b/nixos/modules/system/boot/initrd-network.nix
@@ -23,6 +23,8 @@ let
       fi
     '';
 
+  udhcpcArgs = toString cfg.udhcpc.extraArgs;
+
 in
 
 {
@@ -47,6 +49,16 @@ in
       '';
     };
 
+    boot.initrd.network.udhcpc.extraArgs = mkOption {
+      default = [];
+      type = types.listOf types.str;
+      description = ''
+        Additional command-line arguments passed verbatim to udhcpc if
+        <option>boot.initrd.network.enable</option> and <option>networking.useDHCP</option>
+        are enabled.
+      '';
+    };
+
     boot.initrd.network.postCommands = mkOption {
       default = "";
       type = types.lines;
@@ -91,7 +103,7 @@ in
 
           # Acquire a DHCP lease.
           echo "acquiring IP address via DHCP..."
-          udhcpc --quit --now --script ${udhcpcScript} && hasNetwork=1
+          udhcpc --quit --now --script ${udhcpcScript} ${udhcpcArgs} && hasNetwork=1
         fi
       ''