nixos/systemd-initrd: honor the enable option in contents

The enable attribute of `boot.initrd.systemd.contents.<name>` was
ignored for building initrd storePaths. This resulted in building
derivations for the initrd even if it was disabled.

Found while testing a to build a nixos system with a kernel without
lodable modules[0]

[0]: https://github.com/NixOS/nixpkgs/pull/411792

(cherry picked from commit 99da5ec2bc)
This commit is contained in:
Fiona Behrens 2025-05-28 16:53:29 +00:00 committed by github-actions[bot]
parent 4ccbc9ba34
commit c312e3cc8b

View file

@ -133,7 +133,9 @@ let
name = "initrd-${kernel-name}";
inherit (config.boot.initrd) compressor compressorArgs prepend;
contents = lib.filter ({ source, ... }: !lib.elem source cfg.suppressedStorePaths) cfg.storePaths;
contents = lib.filter (
{ source, enable, ... }: (!lib.elem source cfg.suppressedStorePaths) && enable
) cfg.storePaths;
};
in