mirror of
https://github.com/kaesaecracker/nixos-configuration.git
synced 2025-01-19 02:50:12 +01:00
48 lines
1,010 B
Nix
48 lines
1,010 B
Nix
|
{
|
||
|
lib,
|
||
|
config,
|
||
|
pkgs,
|
||
|
...
|
||
|
}: let
|
||
|
cfg = config.my.hardware.amd;
|
||
|
in {
|
||
|
options.my.hardware.amd = {
|
||
|
cpu = lib.mkEnableOption "amd cpu";
|
||
|
gpu = lib.mkEnableOption "amd gpu";
|
||
|
radeon = lib.mkEnableOption "amd legacy gpu"; # old hardware, dont judge
|
||
|
};
|
||
|
|
||
|
config = lib.mkMerge [
|
||
|
(lib.mkIf cfg.cpu {
|
||
|
boot.kernelModules = ["kvm-amd"];
|
||
|
hardware.cpu.amd.updateMicrocode = true;
|
||
|
})
|
||
|
|
||
|
(lib.mkIf cfg.gpu {
|
||
|
boot.kernelModules = ["amdgpu"];
|
||
|
services.xserver.videoDrivers = ["amdgpu"];
|
||
|
|
||
|
hardware.opengl = {
|
||
|
extraPackages = with pkgs; [
|
||
|
amdvlk
|
||
|
];
|
||
|
extraPackages32 = with pkgs; [
|
||
|
driversi686Linux.amdvlk
|
||
|
];
|
||
|
};
|
||
|
|
||
|
environment.systemPackages = with pkgs; [
|
||
|
unstable.nvtop-amd
|
||
|
];
|
||
|
})
|
||
|
|
||
|
(lib.mkIf cfg.radeon {
|
||
|
boot.kernelModules = ["radeon"];
|
||
|
services.xserver.videoDrivers = ["radeon"];
|
||
|
environment.systemPackages = with pkgs; [
|
||
|
radeontop
|
||
|
];
|
||
|
})
|
||
|
];
|
||
|
}
|