mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
Merge master into staging-next
This commit is contained in:
commit
fa99b3742a
44 changed files with 516 additions and 126 deletions
|
@ -2471,6 +2471,21 @@
|
|||
hosts.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The option
|
||||
<link xlink:href="options.html#opt-networking.useDHCP">networking.useDHCP</link>
|
||||
isn’t deprecated anymore. When using
|
||||
<link xlink:href="options.html#opt-networking.useNetworkd"><literal>systemd-networkd</literal></link>,
|
||||
a generic <literal>.network</literal>-unit is added which
|
||||
enables DHCP for each interface matching
|
||||
<literal>en*</literal>, <literal>eth*</literal> or
|
||||
<literal>wl*</literal> with priority 99 (which means that it
|
||||
doesn’t have any effect if such an interface is matched by a
|
||||
<literal>.network-</literal>unit with a lower priority). In
|
||||
case of scripted networking, no behavior was changed.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
@ -877,4 +877,11 @@ In addition to numerous new and upgraded packages, this release has the followin
|
|||
`true` starting with NixOS 22.11. Enable it explicitly if you need to control
|
||||
Snapserver remotely or connect streamig clients from other hosts.
|
||||
|
||||
- The option [networking.useDHCP](options.html#opt-networking.useDHCP) isn't deprecated anymore.
|
||||
When using [`systemd-networkd`](options.html#opt-networking.useNetworkd), a generic
|
||||
`.network`-unit is added which enables DHCP for each interface matching `en*`, `eth*`
|
||||
or `wl*` with priority 99 (which means that it doesn't have any effect if such an interface is matched
|
||||
by a `.network-`unit with a lower priority). In case of scripted networking, no behavior
|
||||
was changed.
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
|
|
@ -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 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";
|
||||
$config .= " # networking.interfaces.$dev.useDHCP = lib.mkDefault true;\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,18 @@ in
|
|||
a new map with default settings will be generated before starting the service.
|
||||
'';
|
||||
};
|
||||
loadLatestSave = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Load the latest savegame on startup. This overrides saveName, in that the latest
|
||||
save will always be used even if a saved game of the given name exists. It still
|
||||
controls the 'canonical' name of the savegame.
|
||||
|
||||
Set this to true to have the server automatically reload a recent autosave after
|
||||
a crash or desync.
|
||||
'';
|
||||
};
|
||||
# TODO Add more individual settings as nixos-options?
|
||||
# TODO XXX The server tries to copy a newly created config file over the old one
|
||||
# on shutdown, but fails, because it's in the nix store. When is this needed?
|
||||
|
@ -250,8 +262,9 @@ in
|
|||
"--config=${cfg.configFile}"
|
||||
"--port=${toString cfg.port}"
|
||||
"--bind=${cfg.bind}"
|
||||
"--start-server=${mkSavePath cfg.saveName}"
|
||||
(optionalString (!cfg.loadLatestSave) "--start-server=${mkSavePath cfg.saveName}")
|
||||
"--server-settings=${serverSettingsFile}"
|
||||
(optionalString cfg.loadLatestSave "--start-server-load-latest")
|
||||
(optionalString (cfg.mods != []) "--mod-directory=${modDir}")
|
||||
(optionalString (cfg.admins != []) "--server-adminlist=${serverAdminsFile}")
|
||||
];
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
with lib;
|
||||
|
||||
let cfg = config.services.tailscale;
|
||||
let
|
||||
cfg = config.services.tailscale;
|
||||
firewallOn = config.networking.firewall.enable;
|
||||
rpfMode = config.networking.firewall.checkReversePath;
|
||||
rpfIsStrict = rpfMode == true || rpfMode == "strict";
|
||||
in {
|
||||
meta.maintainers = with maintainers; [ danderson mbaillie twitchyliquid64 ];
|
||||
|
||||
|
@ -36,6 +40,7 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
warnings = optional (firewallOn && rpfIsStrict) "Strict reverse path filtering breaks Tailscale exit node use and some subnet routing setups. Consider setting `networking.firewall.checkReversePath` = 'loose'";
|
||||
environment.systemPackages = [ cfg.package ]; # for the CLI
|
||||
systemd.packages = [ cfg.package ];
|
||||
systemd.services.tailscaled = {
|
||||
|
|
|
@ -779,6 +779,7 @@ let
|
|||
"RouteDenyList"
|
||||
"RouteAllowList"
|
||||
"DHCPv6Client"
|
||||
"RouteMetric"
|
||||
])
|
||||
(assertValueOneOf "UseDNS" boolValues)
|
||||
(assertValueOneOf "UseDomains" (boolValues ++ ["route"]))
|
||||
|
|
|
@ -43,12 +43,6 @@ in
|
|||
} {
|
||||
assertion = cfg.defaultGateway6 == null || cfg.defaultGateway6.interface == null;
|
||||
message = "networking.defaultGateway6.interface is not supported by networkd.";
|
||||
} {
|
||||
assertion = cfg.useDHCP == false;
|
||||
message = ''
|
||||
networking.useDHCP is not supported by networkd.
|
||||
Please use per interface configuration and set the global option to false.
|
||||
'';
|
||||
} ] ++ flip mapAttrsToList cfg.bridges (n: { rstp, ... }: {
|
||||
assertion = !rstp;
|
||||
message = "networking.bridges.${n}.rstp is not supported by networkd.";
|
||||
|
@ -80,6 +74,42 @@ in
|
|||
in mkMerge [ {
|
||||
enable = true;
|
||||
}
|
||||
(mkIf cfg.useDHCP {
|
||||
networks."99-ethernet-default-dhcp" = lib.mkIf cfg.useDHCP {
|
||||
# We want to match physical ethernet interfaces as commonly
|
||||
# found on laptops, desktops and servers, to provide an
|
||||
# "out-of-the-box" setup that works for common cases. This
|
||||
# heuristic isn't perfect (it could match interfaces with
|
||||
# custom names that _happen_ to start with en or eth), but
|
||||
# should be good enough to make the common case easy and can
|
||||
# be overridden on a case-by-case basis using
|
||||
# higher-priority networks or by disabling useDHCP.
|
||||
|
||||
# Type=ether matches veth interfaces as well, and this is
|
||||
# more likely to result in interfaces being configured to
|
||||
# use DHCP when they shouldn't.
|
||||
|
||||
# We set RequiredForOnline to false, because it's fairly
|
||||
# common for such devices to have multiple interfaces and
|
||||
# only one of them to be connected (e.g. a laptop with
|
||||
# ethernet and WiFi interfaces). Maybe one day networkd will
|
||||
# support "any"-style RequiredForOnline...
|
||||
matchConfig.Name = ["en*" "eth*"];
|
||||
DHCP = "yes";
|
||||
linkConfig.RequiredForOnline = lib.mkDefault false;
|
||||
};
|
||||
networks."99-wireless-client-dhcp" = lib.mkIf cfg.useDHCP {
|
||||
# Like above, but this is much more likely to be correct.
|
||||
matchConfig.WLANInterfaceType = "station";
|
||||
DHCP = "yes";
|
||||
linkConfig.RequiredForOnline = lib.mkDefault false;
|
||||
# We also set the route metric to one more than the default
|
||||
# of 1024, so that Ethernet is preferred if both are
|
||||
# available.
|
||||
dhcpV4Config.RouteMetric = 1025;
|
||||
ipv6AcceptRAConfig.RouteMetric = 1025;
|
||||
};
|
||||
})
|
||||
(mkMerge (forEach interfaces (i: {
|
||||
netdevs = mkIf i.virtual ({
|
||||
"40-${i.name}" = {
|
||||
|
|
|
@ -1254,11 +1254,6 @@ in
|
|||
Whether to use DHCP to obtain an IP address and other
|
||||
configuration for all network interfaces that are not manually
|
||||
configured.
|
||||
|
||||
Using this option is highly discouraged and also incompatible with
|
||||
<option>networking.useNetworkd</option>. Please use
|
||||
<option>networking.interfaces.<name>.useDHCP</option> instead
|
||||
and set this to false.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -20,6 +20,15 @@ with lib;
|
|||
configuration from proxmox.
|
||||
'';
|
||||
};
|
||||
manageHostName = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to manage hostname through nix options
|
||||
When false, the hostname is picked up from /etc/hostname
|
||||
populated by proxmox.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
|
@ -50,6 +59,8 @@ with lib;
|
|||
useDHCP = false;
|
||||
useHostResolvConf = false;
|
||||
useNetworkd = true;
|
||||
# pick up hostname from /etc/hostname generated by proxmox
|
||||
hostName = mkIf (!cfg.manageHostName) (mkForce "");
|
||||
};
|
||||
|
||||
services.openssh = {
|
||||
|
|
|
@ -139,6 +139,26 @@ let
|
|||
client.wait_until_succeeds("ping -c 1 192.168.3.1")
|
||||
'';
|
||||
};
|
||||
dhcpDefault = {
|
||||
name = "useDHCP-by-default";
|
||||
nodes.router = router;
|
||||
nodes.client = { lib, ... }: {
|
||||
# Disable test driver default config
|
||||
networking.interfaces = lib.mkForce {};
|
||||
networking.useNetworkd = networkd;
|
||||
virtualisation.vlans = [ 1 ];
|
||||
};
|
||||
testScript = ''
|
||||
start_all()
|
||||
client.wait_for_unit("multi-user.target")
|
||||
client.wait_until_succeeds("ip addr show dev eth1 | grep '192.168.1'")
|
||||
client.shell_interact()
|
||||
client.succeed("ping -c 1 192.168.1.1")
|
||||
router.succeed("ping -c 1 192.168.1.1")
|
||||
router.succeed("ping -c 1 192.168.1.2")
|
||||
client.succeed("ping -c 1 192.168.1.2")
|
||||
'';
|
||||
};
|
||||
dhcpSimple = {
|
||||
name = "SimpleDHCP";
|
||||
nodes.router = router;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue