mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
hardware/firmware: init from legacy
This commit is contained in:
parent
e7d71ba6d0
commit
91282ce2d0
4 changed files with 43 additions and 5 deletions
|
@ -1,5 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
hardware.cpu.intel.updateMicrocode = true;
|
|
||||||
}
|
|
|
@ -11,5 +11,9 @@
|
||||||
nitrokey.enable = true;
|
nitrokey.enable = true;
|
||||||
sound.enable = true;
|
sound.enable = true;
|
||||||
thunderbolt.enable = true;
|
thunderbolt.enable = true;
|
||||||
|
firmware = {
|
||||||
|
enable = true;
|
||||||
|
cpuFlavor = "intel";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./firmware
|
||||||
./keychron
|
./keychron
|
||||||
./nitrokey
|
./nitrokey
|
||||||
./sound
|
./sound
|
||||||
|
|
38
modules/hardware/firmware/default.nix
Normal file
38
modules/hardware/firmware/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.my.hardware.firmware;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.my.hardware.firmware = with lib; {
|
||||||
|
enable = mkEnableOption "firmware configuration";
|
||||||
|
|
||||||
|
cpuFlavor = mkOption {
|
||||||
|
type = with types; nullOr (enum [ "intel" "amd" ]);
|
||||||
|
default = null;
|
||||||
|
example = "intel";
|
||||||
|
description = "Which kind of CPU to activate micro-code updates";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||||
|
{
|
||||||
|
hardware = {
|
||||||
|
enableRedistributableFirmware = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
# Intel CPU
|
||||||
|
(lib.mkIf (cfg.cpuFlavor == "intel") {
|
||||||
|
hardware = {
|
||||||
|
cpu.intel.updateMicrocode = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
# AMD CPU
|
||||||
|
(lib.mkIf (cfg.cpuFlavor == "amd") {
|
||||||
|
hardware = {
|
||||||
|
cpu.amd.updateMicrocode = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue