nixos-dotfiles/modules/hardware/nvidia.nix

43 lines
1.4 KiB
Nix
Raw Normal View History

{ pkgs, config, ... }:
{
nixpkgs.config.allowUnfree = true;
services.xserver.videoDrivers = [ "nvidia" ];
2023-02-01 03:19:31 +00:00
2023-02-18 21:11:34 +00:00
hardware.opengl.enable = true;
hardware.opengl.driSupport32Bit = true;
2023-02-01 03:19:31 +00:00
# This enables vulkan layers
# hardware = {
# opengl =
# let
# fn = oa: {
# nativeBuildInputs = oa.nativeBuildInputs ++ [ pkgs.glslang ];
# mesonFlags = oa.mesonFlags ++ [ "-Dvulkan-layers=device-select,overlay" ];
# patches = oa.patches ++ [ ./mesa-vulkan-layer-nvidia.patch ];
# postInstall = oa.postInstall + ''
# mv $out/lib/libVkLayer* $drivers/lib
#Device Select layer
2023-02-01 03:19:31 +00:00
# layer=VkLayer_MESA_device_select
# substituteInPlace $drivers/share/vulkan/implicit_layer.d/''${layer}.json \
# --replace "lib''${layer}" "$drivers/lib/lib''${layer}"
#Overlay layer
2023-02-01 03:19:31 +00:00
# layer=VkLayer_MESA_overlay
# substituteInPlace $drivers/share/vulkan/explicit_layer.d/''${layer}.json \
# --replace "lib''${layer}" "$drivers/lib/lib''${layer}"
# '';
# };
# in
# with pkgs; {
# enable = true;
# driSupport32Bit = true;
# package = (mesa.overrideAttrs fn).drivers;
# package32 = (pkgsi686Linux.mesa.overrideAttrs fn).drivers;
# };
# };
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
}