From 4145ba7dfde33bb693b7aee7e819e27517a235fa Mon Sep 17 00:00:00 2001 From: dramforever Date: Fri, 31 Jul 2026 19:41:00 +0800 Subject: [PATCH] nixos/ifstate: Fix systemd package references pkgs.systemd does not respect config.systemd.package and config.boot.initrd.systemd.package overrides. Fix references to the systemd package to ensure that the udevadm used is copied into the initrd. While we're at it, fix the non-initrd reference to systemd as well. --- nixos/modules/services/networking/ifstate.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/networking/ifstate.nix b/nixos/modules/services/networking/ifstate.nix index ef44463ba9cf..a1aeeda26b8c 100644 --- a/nixos/modules/services/networking/ifstate.nix +++ b/nixos/modules/services/networking/ifstate.nix @@ -87,12 +87,6 @@ let "network.target" ]; - # We wait for the udev events queue to empty in the *hope* that the - # devices needed here become available. This is terribly broken and - # essentially no better than a random sleep(). - # FIXME: use .device units dependecies instead. - serviceConfig.ExecStartPre = "-${lib.getExe' pkgs.systemd "udevadm"} settle --timeout=180"; - unitConfig = { # Avoid default dependencies like "basic.target", which prevents ifstate from starting before luks is unlocked. DefaultDependencies = "no"; @@ -193,6 +187,13 @@ in ExecStart = "${lib.getExe cfg.package} --config ${ config.environment.etc."ifstate/ifstate.yaml".source } apply"; + + # We wait for the udev events queue to empty in the *hope* that the + # devices needed here become available. This is terribly broken and + # essentially no better than a random sleep(). Same below for initrd. + # FIXME: use .device units dependecies instead. + ExecStartPre = "-${lib.getExe' config.systemd.package "udevadm"} settle --timeout=180"; + # because oneshot services do not have a timeout by default TimeoutStartSec = "2min"; }; @@ -294,6 +295,8 @@ in } apply"; # because oneshot services do not have a timeout by default TimeoutStartSec = "2min"; + # See comment on non-initrd service above + ExecStartPre = "-${lib.getExe' config.boot.initrd.systemd.package "udevadm"} settle --timeout=180"; }; }; };