refactor(treewide)
This commit is contained in:
parent
25d48ac2ac
commit
c4fc882042
99 changed files with 634 additions and 477 deletions
40
nixos/modules/host/hardware/cpu/amd.nix
Normal file
40
nixos/modules/host/hardware/cpu/amd.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkMerge mkIf versionAtLeast versionOlder;
|
||||
inherit (builtins) elem;
|
||||
cpu = config.ooknet.host.hardware.cpu;
|
||||
cfg = cpu.amd;
|
||||
kernelVersion = config.boot.kernelPackages.kernel.version;
|
||||
kernelVersionAtLeast = versionAtLeast kernelVersion;
|
||||
kernelVersionOlder= versionOlder kernelVersion;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (elem cpu.type ["amd"]) {
|
||||
environment.systemPackages = [pkgs.amdctl];
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
boot = mkMerge [
|
||||
{
|
||||
kernelModules = [
|
||||
"amd-pstate"
|
||||
"amd-kvm" # virtulization
|
||||
"msr" # required for amdctl
|
||||
];
|
||||
}
|
||||
|
||||
(mkIf (cfg.pstate.enable && (kernelVersionAtLeast "5.27") && (kernelVersionOlder "6.1")) {
|
||||
kernelParams = ["initcall_blacklist-acpi_cpufreq_init"];
|
||||
kernelModules = ["amd-pstate"];
|
||||
})
|
||||
|
||||
(mkIf (cfg.pstate.enable && (kernelVersionAtLeast "6.1") && (kernelVersionOlder "6.3")) {
|
||||
kernelParams = ["amd_pstate=passive"];
|
||||
})
|
||||
|
||||
(mkIf (cfg.pstate.enable && (kernelVersionAtLeast "6.3")) {
|
||||
kernelParams = ["amd_pstate=active"];
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
6
nixos/modules/host/hardware/cpu/default.nix
Normal file
6
nixos/modules/host/hardware/cpu/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./amd.nix
|
||||
./intel.nix
|
||||
];
|
||||
}
|
||||
20
nixos/modules/host/hardware/cpu/intel.nix
Normal file
20
nixos/modules/host/hardware/cpu/intel.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
cpu = config.ooknet.host.hardware.cpu;
|
||||
in
|
||||
|
||||
{
|
||||
# TODO: put kvm/gvt behind virtualization module flag
|
||||
|
||||
config = mkIf (elem cpu.type ["intel"]) {
|
||||
boot = {
|
||||
kernelModules = ["kvm-intel"];
|
||||
kernelParams = ["i915.fastboot=1" "enable_gvt=1"];
|
||||
};
|
||||
hardware.cpu.intel.updateMicrocode = true;
|
||||
environment.systemPackages = [pkgs.intel-gpu-tools];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue