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.
This commit is contained in:
dramforever
2026-07-31 19:41:00 +08:00
parent 6271b08bd8
commit 4145ba7dfd

View File

@@ -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";
};
};
};