2024-12-31 17:52:10 +01:00

60 lines
1.2 KiB
Nix

{ config
, lib
, pkgs
, ...
}:
let
inherit (lib) mkEnableOption mkIf;
inherit (lib.my-namespace) disabled enabled;
cfg = config.my-namespace.hardware.graphics-amd-igpu-only;
in
{
options.my-namespace.hardware.graphics-amd-igpu-only = {
enable = mkEnableOption "Enable nvidia";
};
config = mkIf cfg.enable {
# Enable NVIDIA driver for X11 and Wayland
# without modesetting, x server will be run by nvidia
services.xserver.videoDrivers = [
"amdgpu"
];
# Enable OpenGL
hardware.graphics = {
enable = true;
# extraPackages = with pkgs; [ nvidia-vaapi-driver ];
};
hardware.graphics.enable32Bit = true; # For 32 bit applications
boot.loader.systemd-boot.consoleMode = "max";
# Enable required Kernel Modules
boot.initrd.kernelModules = [
"amdgpu"
];
boot.kernelParams = [
"amdgpu.modeset=1"
"amd_iommu=on"
];
# Blacklist intel and nouveau
boot.blacklistedKernelModules = [
"nouveau"
];
hardware.nvidia = {
# Modesetting is required.
# Add user to extra groups
users.users.andreas = {
extraGroups = [ "video" "render" ];
};
};
}