nixos-conf/modules/hardware/nvidia.nix

38 lines
844 B
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.custom.nvidia;
in
{
options.custom.nvidia.enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
config = lib.mkIf cfg.enable {
hardware = {
nvidia = {
open = true; # Set to false to use the proprietary kernel module
forceFullCompositionPipeline = true;
};
graphics = {
enable = true;
extraPackages = with pkgs; [ nvidia-vaapi-driver ];
};
};
services.xserver.videoDrivers = [ "nvidia" ];
boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
nixpkgs.config.cudaSupport = true;
nix.settings = {
substituters = [ "https://nix-community.cachix.org" ];
trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
};
};
}