mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:19:22 +08:00
整理内核模块
This commit is contained in:
@@ -179,6 +179,7 @@
|
||||
hardware =
|
||||
{
|
||||
cpu = [ "intel" ];
|
||||
gpu = [ "intel" "nvidia" ];
|
||||
bluetooth.enable = true;
|
||||
joystick.enable = true;
|
||||
printer.enable = true;
|
||||
|
||||
@@ -8,14 +8,10 @@ inputs:
|
||||
# boot.extraModulePackages = [ yourmodulename ];
|
||||
boot.extraModprobeConfig = "options kvm_intel nested=1";
|
||||
# initrd, luks
|
||||
boot.initrd =
|
||||
boot.initrd.systemd.services."systemd-cryptsetup@swap" =
|
||||
{
|
||||
availableKernelModules =
|
||||
[ "i915" "intel_cstate" "nvidia" "nvidia_drm" "nvidia_modeset" "nvidia_uvm" "aesni_intel" ];
|
||||
systemd.services."systemd-cryptsetup@swap" =
|
||||
{
|
||||
before = [ "systemd-cryptsetup@root.service" ];
|
||||
overrideStrategy = "asDropin";
|
||||
before = [ "systemd-cryptsetup@root.service" ];
|
||||
overrideStrategy = "asDropin";
|
||||
};
|
||||
|
||||
# impermanence
|
||||
|
||||
@@ -7,6 +7,7 @@ inputs:
|
||||
printer.enable = mkOption { type = types.bool; default = false; };
|
||||
sound.enable = mkOption { type = types.bool; default = false; };
|
||||
cpu = mkOption { type = types.listOf (types.enum [ "intel" "amd" ]); default = []; };
|
||||
gpu = mkOption { type = types.listOf (types.enum [ "intel" "nvidia" ]); default = []; };
|
||||
};
|
||||
config = let inherit (inputs.lib) mkMerge mkIf; in mkMerge
|
||||
[
|
||||
@@ -51,6 +52,27 @@ inputs:
|
||||
hardware.cpu = builtins.listToAttrs (builtins.map
|
||||
(name: { inherit name; value = { updateMicrocode = true; }; })
|
||||
inputs.config.nixos.hardware.cpu);
|
||||
boot.initrd.availableKernelModules =
|
||||
let
|
||||
modules =
|
||||
{
|
||||
intel = [ "intel_cstate" "aesni_intel" ];
|
||||
amd = [];
|
||||
};
|
||||
in
|
||||
builtins.concatLists (builtins.map (cpu: modules.${cpu}) inputs.config.nixos.hardware.cpu);
|
||||
}
|
||||
# gpu
|
||||
{
|
||||
boot.initrd.availableKernelModules =
|
||||
let
|
||||
modules =
|
||||
{
|
||||
intel = [ "i915" ];
|
||||
nvidia = [ "nvidia" "nvidia_drm" "nvidia_modeset" "nvidia_uvm" ];
|
||||
};
|
||||
in
|
||||
builtins.concatLists (builtins.map (cpu: modules.${cpu}) inputs.config.nixos.hardware.cpu);
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user