mirror of
https://github.com/kaesaecracker/nixos-configuration.git
synced 2025-01-18 18:40:14 +01:00
48 lines
1,001 B
Nix
48 lines
1,001 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; [
|
|
nvtop-amd
|
|
];
|
|
})
|
|
|
|
(lib.mkIf cfg.radeon {
|
|
boot.kernelModules = ["radeon"];
|
|
services.xserver.videoDrivers = ["radeon"];
|
|
environment.systemPackages = with pkgs; [
|
|
radeontop
|
|
];
|
|
})
|
|
];
|
|
}
|