summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-11-30 04:46:52 -0800
committerWilliam A. Kennington III <william@wkennington.com>2014-11-30 04:46:59 -0800
commit01332149d415ec33238dc9a2d321457ad231e270 (patch)
tree29d7c2510c679a46b7c88d3e8eb08ff797e0ca4a /nixos/modules
parent5b8fb2239c993301b4c6607fc45993bedc9d8858 (diff)
downloadnixlib-01332149d415ec33238dc9a2d321457ad231e270.tar
nixlib-01332149d415ec33238dc9a2d321457ad231e270.tar.gz
nixlib-01332149d415ec33238dc9a2d321457ad231e270.tar.bz2
nixlib-01332149d415ec33238dc9a2d321457ad231e270.tar.lz
nixlib-01332149d415ec33238dc9a2d321457ad231e270.tar.xz
nixlib-01332149d415ec33238dc9a2d321457ad231e270.tar.zst
nixlib-01332149d415ec33238dc9a2d321457ad231e270.zip
nixos/networkd: Fix dhcp being enabled when it should be disabled
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/tasks/network-interfaces-systemd.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix
index 997c18046737..ee3efbbc9ffd 100644
--- a/nixos/modules/tasks/network-interfaces-systemd.nix
+++ b/nixos/modules/tasks/network-interfaces-systemd.nix
@@ -18,7 +18,7 @@ let
       prefixLength = i.ipv6PrefixLength;
     };
 
-  dhcpStr = useDHCP: if useDHCP then "both" else "none";
+  dhcpStr = useDHCP: if useDHCP == true || useDHCP == null then "both" else "none";
 
   slaves =
     concatLists (map (bond: bond.interfaces) (attrValues cfg.bonds))
@@ -77,7 +77,7 @@ in
         networks."40-${i.name}" = mkMerge [ (genericNetwork mkDefault) {
           name = mkDefault i.name;
           DHCP = mkForce (dhcpStr
-            (if i.useDHCP != null then i.useDHCP else interfaceIps i == [ ]));
+            (if i.useDHCP != null then i.useDHCP else cfg.useDHCP && interfaceIps i == [ ]));
           address = flip map (interfaceIps i)
             (ip: "${ip.address}/${toString ip.prefixLength}");
         } ];