support hardware.graphics

This commit is contained in:
Peder Bergebakken Sundt 2024-12-24 00:37:33 +01:00
parent 071c95f049
commit c9a89035b5
4 changed files with 51 additions and 39 deletions

View File

@ -1,4 +1,20 @@
{ config, pkgs, lib, ... }:
let
extraPackages = with pkgs; [
mesa.drivers
intel-media-driver
# not added due to collision
# https://github.com/NixOS/nixos-hardware/issues/1170
#(if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11")
# then vaapiIntel
# else intel-vaapi-driver)
vaapiVdpau
libvdpau-va-gl
intel-ocl
intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
(pkgs.nvtopPackages.intel or pkgs.nvtop-intel)
];
in
lib.mkMerge [
{
@ -19,25 +35,15 @@ lib.mkMerge [
intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; };
};
hardware.opengl.enable = true;
}
(lib.optionalAttrs (lib.versionOlder (lib.versions.majorMinor lib.version) "24.11") {
hardware.opengl.driSupport = true;
hardware.opengl.enable = true;
hardware.opengl.extraPackages = extraPackages;
})
{
hardware.opengl.extraPackages = with pkgs; [
mesa.drivers
intel-media-driver
# not added due to collision
# https://github.com/NixOS/nixos-hardware/issues/1170
#(if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11")
# then vaapiIntel
# else intel-vaapi-driver)
vaapiVdpau
libvdpau-va-gl
intel-ocl
intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
(pkgs.nvtopPackages.intel or pkgs.nvtop-intel)
];
}
(lib.optionalAttrs (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.11") {
hardware.graphics.enable = true;
hardware.graphics.extraPackages = extraPackages;
})
]

View File

@ -1,12 +1,18 @@
{ pkgs, lib, options, ... }: lib.mkMerge [
{
# assumes common-gpu-amd from nixos-hardware is also added
# TODO: should we move it from flake.nix to here?
# https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/amd/default.nix
# assumes common-gpu-amd from nixos-hardware is also added
# TODO: should we move it from flake.nix to here?
# https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/amd/default.nix
(lib.mkIf (lib.versionOlder (lib.versions.majorMinor lib.version) "24.11") {
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
})
(lib.mkIf (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.11") {
hardware.graphics.enable = true;
hardware.graphics.enable32Bit = true;
})
{
nixpkgs.config.openglSupport = true; # why is this not set by hardware.opengl.enable ?
nixpkgs.config.rocmSupport = true;
@ -14,19 +20,11 @@
nixpkgs.config.vaapiSupport = true;
services.ollama.acceleration = lib.mkDefault "rocm";
}
(lib.mkIf (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05") {
hardware.amdgpu.opencl.enable = lib.mkDefault true;
#hardware.amdgpu.amdvlk.enable = lib.mkDefault true;
#hardware.amdgpu.amdvlk.support32Bit.enable = lib.mkDefault true;
})
#(lib.mkIf (lib.versionOlder (lib.versions.majorMinor lib.version) "24.05") {
# # nixos-hardware common-amd options
# # https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/amd/default.nix
# hardware.amdgpu.opencl = lib.mkDefault true;
# #hardware.amdgpu.amdvlk = lib.mkDefault true;
#})
{
# https://libreddit.noximilien.pbsds.net/r/archlinux/comments/nih9c9/amdgpu_vs_modesetting_in_current_510_kernels_xorg/
services.xserver.videoDrivers = [ "amdgpu" ]; # use gpu, adaptive sync and and hardware page flipping
#services.xserver.videoDrivers = [ "modesetting" ]; # integrated (non-accelerated) framebuffer, KMS (default in nixos-hardware)

View File

@ -29,14 +29,17 @@ lib.mkMerge [
];
hardware.opengl.enable = true;
}
(lib.optionalAttrs (lib.versionOlder (lib.versions.majorMinor lib.version) "24.11") {
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
})
(lib.optionalAttrs (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.11") {
hardware.graphics.enable = true;
hardware.graphics.enable32Bit = true;
hardware.graphics.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
})
{
hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
}
]

View File

@ -66,14 +66,19 @@ lib.mkMerge [
#services.joycond.enable = true;
hardware.opengl.enable = true;
}
(lib.optionalAttrs (lib.versionOlder (lib.versions.majorMinor lib.version) "24.11") {
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
})
(lib.optionalAttrs (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.11") {
hardware.graphics.enable = true;
hardware.graphics.enable32Bit = true;
hardware.graphics.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
})
{
hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
environment.systemPackages = with pkgs; [
steam-tui