nixos/installer: enable networkmanager by default (#420923)

This commit is contained in:
Martin Weinelt 2025-07-04 22:21:11 +02:00 committed by GitHub
commit f633ed9278
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 28 deletions

View File

@ -613,8 +613,6 @@ if (!$noFilesystems) {
$fsAndSwap .= "swapDevices =" . multiLineList(" ", @swapDevices) . ";\n"; $fsAndSwap .= "swapDevices =" . multiLineList(" ", @swapDevices) . ";\n";
} }
my $networkingDhcpConfig = generateNetworkingDhcpConfig();
my $hwConfig = <<EOF; my $hwConfig = <<EOF;
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
@ -629,30 +627,9 @@ my $hwConfig = <<EOF;
boot.kernelModules = [$kernelModules ]; boot.kernelModules = [$kernelModules ];
boot.extraModulePackages = [$modulePackages ]; boot.extraModulePackages = [$modulePackages ];
$fsAndSwap $fsAndSwap
$networkingDhcpConfig
${\join "", (map { " $_\n" } (uniq @attrs))}} ${\join "", (map { " $_\n" } (uniq @attrs))}}
EOF EOF
sub generateNetworkingDhcpConfig {
# FIXME disable networking.useDHCP by default when switching to networkd.
my $config = <<EOF;
# 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 use it in conjunction
# with explicit per-interface declarations with `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";
}
}
return $config;
}
sub generateXserverConfig { sub generateXserverConfig {
my $xserverEnabled = "@xserverEnabled@"; my $xserverEnabled = "@xserverEnabled@";
@ -737,8 +714,6 @@ EOF
EOF EOF
} }
my $networkingDhcpConfig = generateNetworkingDhcpConfig();
my $xserverConfig = generateXserverConfig(); my $xserverConfig = generateXserverConfig();
(my $desktopConfiguration = <<EOF)=~s/^/ /gm; (my $desktopConfiguration = <<EOF)=~s/^/ /gm;

View File

@ -108,9 +108,9 @@ let
$bootLoaderConfig $bootLoaderConfig
# networking.hostName = "nixos"; # Define your hostname. # networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Configure network connections interactively with nmcli or nmtui.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. networking.networkmanager.enable = true;
# Set your time zone. # Set your time zone.
# time.timeZone = "Europe/Amsterdam"; # time.timeZone = "Europe/Amsterdam";