diff options
Diffstat (limited to 'modules/nixos/features/nvk/default.nix')
| -rw-r--r-- | modules/nixos/features/nvk/default.nix | 68 |
1 files changed, 15 insertions, 53 deletions
diff --git a/modules/nixos/features/nvk/default.nix b/modules/nixos/features/nvk/default.nix index 68c92ff..1b9e730 100644 --- a/modules/nixos/features/nvk/default.nix +++ b/modules/nixos/features/nvk/default.nix @@ -5,64 +5,26 @@ ... }: let cfg = config.features.nvk; - - mkMesa = pkgs: - (pkgs.mesa.override { - vulkanDrivers = - if pkgs.stdenv.isLinux - then - [ - "amd" # AMD (aka RADV) - "microsoft-experimental" # WSL virtualized GPU (aka DZN/Dozen) - "swrast" # software renderer (aka Lavapipe) - "nouveau-experimental" # nvk - ] - ++ lib.optionals (pkgs.stdenv.hostPlatform.isAarch -> lib.versionAtLeast pkgs.stdenv.hostPlatform.parsed.cpu.version "6") [ - # QEMU virtualized GPU (aka VirGL) - # Requires ATOMIC_INT_LOCK_FREE == 2. - "virtio" - ] - ++ lib.optionals pkgs.stdenv.isAarch64 [ - "broadcom" # Broadcom VC5 (Raspberry Pi 4, aka V3D) - "freedreno" # Qualcomm Adreno (all Qualcomm SoCs) - "imagination-experimental" # PowerVR Rogue (currently N/A) - "panfrost" # ARM Mali Midgard and up (T/G series) - ] - ++ lib.optionals pkgs.stdenv.hostPlatform.isx86 [ - "intel" # Intel (aka ANV), could work on non-x86 with PCIe cards, but doesn't build - "intel_hasvk" # Intel Haswell/Broadwell, "legacy" Vulkan driver (https://www.phoronix.com/news/Intel-HasVK-Drop-Dead-Code) - ] - else ["auto"]; - }) - .overrideAttrs (new: old: let - replacePatches = patch: - { - "opencl.patch" = ./opencl.patch; - "disk_cache-include-dri-driver-path-in-cache-key.patch" = ./disk_cache-include-dri-driver-path-in-cache-key.patch; - } - .${baseNameOf patch} - or patch; - in { - version = "23.3.1"; - - src = pkgs.fetchurl { - urls = [ - "https://archive.mesa3d.org/mesa-${new.version}.tar.xz" - "https://mesa.freedesktop.org/archive/mesa-${new.version}.tar.xz" - ]; - - hash = "sha256-bkgSbXD9s/IP/rJGygwuQf/cg18GY6A9RSa4v120HeY="; - }; - - patches = map replacePatches old.patches; - }); + mesa = import ./mesa.nix pkgs; + mesa32 = import ./mesa.nix pkgs.pkgsi686Linux; in { options.features.nvk.enable = lib.mkEnableOption "nvk"; config = lib.mkIf cfg.enable { hardware.opengl = { - package = (mkMesa pkgs).drivers; - package32 = (mkMesa pkgs.pkgsi686Linux).drivers; + package = mesa.drivers; + package32 = mesa32.drivers; }; + + system.replaceRuntimeDependencies = [ + { + original = pkgs.mesa.out; + replacement = mesa.out; + } + { + original = pkgs.pkgsi686Linux.mesa.out; + replacement = mesa32.out; + } + ]; }; } |
