nixos/systemd-initrd: add systemd.*.services.path to initrd store

This commit is contained in:
Oskar Philipsson 2025-11-17 08:51:40 +01:00
commit 2e23af70a8

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