From c312e3cc8ba0f6083af0fe71999696ec7d1c7273 Mon Sep 17 00:00:00 2001 From: Fiona Behrens Date: Wed, 28 May 2025 16:53:29 +0000 Subject: [PATCH] nixos/systemd-initrd: honor the enable option in contents The enable attribute of `boot.initrd.systemd.contents.` 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 99da5ec2bc2b370f06f9c911af209ad2c5e4661b) --- nixos/modules/system/boot/systemd/initrd.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix index 65caee745124..8057ecba1241 100644 --- a/nixos/modules/system/boot/systemd/initrd.nix +++ b/nixos/modules/system/boot/systemd/initrd.nix @@ -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