summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2023-06-10 00:35:56 -0400
committerGitHub <noreply@github.com>2023-06-10 00:35:56 -0400
commit90d69b1634d6941300d790ec84d91a4dd40b3902 (patch)
tree4050d8548f610066791a38ae3ae930cca8dcc721 /nixos
parent65ad3488ad66f75684d2fd421c7accff9f945886 (diff)
parent5d6ea734a18203895360f6ea767ee47f7be22e00 (diff)
Merge pull request #236388 from ElvishJerricco/sd-s1-networkd-stop-on-switch-root
systemd stage 1 networking: Stop systemd-networkd on switch-root
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/networkd.nix14
-rw-r--r--nixos/tests/systemd-initrd-networkd.nix1
2 files changed, 14 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index 463e2b8d90b0..d88f88f9fdaf 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -3188,7 +3188,19 @@ let
systemd.contents."/etc/systemd/networkd.conf" = renderConfig cfg.config;
- systemd.services.systemd-networkd.wantedBy = [ "initrd.target" ];
+ systemd.services.systemd-networkd = {
+ wantedBy = [ "initrd.target" ];
+ # These before and conflicts lines can be removed when this PR makes it into a release:
+ # https://github.com/systemd/systemd/pull/27791
+ before = ["initrd-switch-root.target"];
+ conflicts = ["initrd-switch-root.target"];
+ };
+ systemd.sockets.systemd-networkd = {
+ wantedBy = [ "initrd.target" ];
+ before = ["initrd-switch-root.target"];
+ conflicts = ["initrd-switch-root.target"];
+ };
+
systemd.services.systemd-network-generator.wantedBy = [ "sysinit.target" ];
systemd.storePaths = [
diff --git a/nixos/tests/systemd-initrd-networkd.nix b/nixos/tests/systemd-initrd-networkd.nix
index 00ecbec5613c..8376276d8f63 100644
--- a/nixos/tests/systemd-initrd-networkd.nix
+++ b/nixos/tests/systemd-initrd-networkd.nix
@@ -12,6 +12,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
systemd.services.check-flush = {
requiredBy = ["multi-user.target"];
before = ["network-pre.target" "multi-user.target"];
+ wants = ["network-pre.target"];
unitConfig.DefaultDependencies = false;
serviceConfig.Type = "oneshot";
path = [ pkgs.iproute2 pkgs.iputils pkgs.gnugrep ];