···
"wireguard" = [ "wireguard" ];
"xfrm" = [ "xfrm_interface" ];
69
+
# https://github.com/systemd/systemd/blob/main/units/systemd-networkd.service.in
70
+
commonServiceConfig = {
72
+
"systemd-udevd.service"
73
+
"network-pre.target"
74
+
"systemd-sysusers.service"
75
+
"systemd-sysctl.service"
81
+
"initrd-switch-root.target"
85
+
"initrd-switch-root.target"
92
+
# Avoid default dependencies like "basic.target", which prevents ifstate from starting before luks is unlocked.
93
+
DefaultDependencies = "no";
meta.maintainers = with lib.maintainers; [ marcel ];
···
etc."ifstate/ifstate.yaml".source = settingsFormat.generate "ifstate.yaml" cfg.settings cfg.package;
153
-
systemd.services.ifstate = {
180
+
systemd.services.ifstate = commonServiceConfig // {
160
-
"systemd-udevd.service"
161
-
"network-pre.target"
162
-
"systemd-sysusers.service"
163
-
"systemd-sysctl.service"
167
-
"multi-user.target"
169
-
"initrd-switch-root.target"
173
-
"initrd-switch-root.target"
# mount is always available on nixos, avoid adding additional store paths to the closure
path = [ "/run/wrappers" ];
···
257
-
services.ifstate-initrd = {
265
+
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/networkd.nix#L3444
266
+
additionalUpstreamUnits = [
267
+
"network-online.target"
268
+
"network-pre.target"
270
+
"nss-lookup.target"
271
+
"nss-user-lookup.target"
272
+
"remote-fs-pre.target"
276
+
services.ifstate-initrd = commonServiceConfig // {
description = "IfState initrd";
264
-
"systemd-udevd.service"
265
-
"network-pre.target"
266
-
"systemd-sysusers.service"
267
-
"systemd-sysctl.service"
271
-
"multi-user.target"
273
-
"initrd-switch-root.target"
277
-
"initrd-switch-root.target"
# mount is always available on nixos, avoid adding additional store paths to the closure
# https://github.com/NixOS/nixpkgs/blob/2b8e2457ebe576ebf41ddfa8452b5b07a8d493ad/nixos/modules/system/boot/systemd/initrd.nix#L550-L551
···
# Otherwise systemd starts ifstate again, after the encryption password was entered by the user
# and we are able to implement the cleanup using ExecStop rather than a separate unit.
294
-
# When using network namespaces pyroute2 expects this directory to exists.
295
-
# @liske is currently investigating whether this should be considered a bug in pyroute2.
296
-
ExecStartPre = "${lib.getExe' pkgs.coreutils "mkdir"} /var/run";
ExecStart = "${lib.getExe initrdCfg.package} --config ${
config.environment.etc."ifstate/ifstate.initrd.yaml".source