patos/modules/config/minimal-modules.nix

20 lines
601 B
Nix
Raw Normal View History

2024-11-11 23:02:38 +01:00
{ config, lib, ... }: {
options.boot.kernel.minimalModules = lib.mkEnableOption "minimal kernel modules";
config = lib.mkIf config.boot.kernel.minimalModules {
# Don't include kernel or its modules in rootfs
boot.kernel.enable = false;
boot.modprobeConfig.enable = false;
boot.bootspec.enable = false;
system.build = { inherit (config.boot.kernelPackages) kernel; };
system.modulesTree = [ config.boot.kernelPackages.kernel ] ++ config.boot.extraModulePackages;
# Modules must be loaded by initrd
boot.initrd.kernelModules = config.boot.kernelModules;
};
}