diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2022-04-30 00:26:46 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2022-04-30 00:30:47 +0200 |
commit | 8e42949a2421485c34fa56cff3e768af1c91459e (patch) | |
tree | f0ce18e2ede60e0cbebb787607040516a23d2858 /nixos | |
parent | cff16bc62507bc0dfbaa1582ad0931be4da006ad (diff) | |
download | nixlib-8e42949a2421485c34fa56cff3e768af1c91459e.tar nixlib-8e42949a2421485c34fa56cff3e768af1c91459e.tar.gz nixlib-8e42949a2421485c34fa56cff3e768af1c91459e.tar.bz2 nixlib-8e42949a2421485c34fa56cff3e768af1c91459e.tar.lz nixlib-8e42949a2421485c34fa56cff3e768af1c91459e.tar.xz nixlib-8e42949a2421485c34fa56cff3e768af1c91459e.tar.zst nixlib-8e42949a2421485c34fa56cff3e768af1c91459e.zip |
nixos/nixos-generate-config: use networking.useDHCP by default
Currently we're still using scripted networking by default. A problem with scripted networking is that having `useDHCP` on potentially non-existing interfaces (e.g. an ethernet interface for USB tethering) can cause the boot to hang. Closes #107908
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/installer/tools/nixos-generate-config.pl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index fb5d3ba47325..6d32d727501e 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -581,17 +581,19 @@ ${\join "", (map { " $_\n" } (uniq @attrs))}} EOF sub generateNetworkingDhcpConfig { + # FIXME disable networking.useDHCP by default when switching to networkd. my $config = <<EOF; - # The global useDHCP flag is deprecated, therefore explicitly set to false here. - # Per-interface useDHCP will be mandatory in the future, so this generated config - # replicates the default behaviour. - networking.useDHCP = lib.mkDefault false; + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to explicitly set it + # per-interface using `networking.interfaces.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; EOF foreach my $path (glob "/sys/class/net/*") { my $dev = basename($path); if ($dev ne "lo") { - $config .= " networking.interfaces.$dev.useDHCP = lib.mkDefault true;\n"; + $config .= " # networking.interfaces.$dev.useDHCP = lib.mkDefault true;\n"; } } |