[Backport staging-nixos-26.05] nixos/systemd-initrd: add systemd.*.services.path to initrd store (#533498)

This commit is contained in:
Will Fancher 2026-06-20 04:20:48 +00:00 committed by GitHub
commit 128930c926
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -124,6 +124,16 @@ let
jobScripts = concatLists (
mapAttrsToList (_: unit: unit.jobScripts or [ ]) (filterAttrs (_: v: v.enable) cfg.services)
);
unitEnv = pkgs.buildEnv {
name = "initrd-unit-env";
paths = concatLists (
mapAttrsToList (_: unit: unit.path or [ ]) (filterAttrs (_: v: v.enable) cfg.services)
);
pathsToLink = [
"/bin"
"/sbin"
];
};
stage1Units = generateUnits {
type = "initrd";
@ -636,6 +646,7 @@ in
"${pkgs.bashNonInteractive}/bin"
]
++ jobScripts
++ [ unitEnv ]
++ map (c: removeAttrs c [ "text" ]) (builtins.attrValues cfg.contents)
++ lib.optional (pkgs.stdenv.hostPlatform.libc == "glibc") "${pkgs.glibc}/lib/libnss_files.so.2";