nixos/amdvlk: init module (#318175)

This commit is contained in:
Masum Reza 2024-06-13 02:15:01 +05:30 committed by GitHub
parent c870e19d09
commit 7082d01967
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 64 additions and 1 deletions

View File

@ -4,7 +4,8 @@
## Highlights {#sec-release-24.11-highlights}
- Create the first release note entry in this section!
- [AMDVLK](https://github.com/GPUOpen-Drivers/AMDVLK), AMD's open source Vulkan driver, is now available to be configured as `hardware.amdgpu.amdvlk` option.
This also allows configuring runtime settings of AMDVLK and enabling experimental features.
## New Services {#sec-release-24.11-new-services}

View File

@ -549,6 +549,7 @@
./services/games/xonotic.nix
./services/hardware/acpid.nix
./services/hardware/actkbd.nix
./services/hardware/amdvlk.nix
./services/hardware/argonone.nix
./services/hardware/asusd.nix
./services/hardware/auto-cpufreq.nix

View File

@ -0,0 +1,61 @@
{ config, lib, pkgs, ... }:
let
cfg = config.hardware.amdgpu.amdvlk;
in {
options.hardware.amdgpu.amdvlk = {
enable = lib.mkEnableOption "AMDVLK Vulkan driver";
package = lib.mkPackageOption pkgs "amdvlk" { };
supportExperimental.enable = lib.mkEnableOption "Experimental features support";
support32Bit.enable = lib.mkEnableOption "32-bit driver support";
support32Bit.package = lib.mkPackageOption pkgs [ "driversi686Linux" "amdvlk" ] { };
settings = lib.mkOption {
type = with lib.types; attrsOf (either str int);
default = { };
example = {
AllowVkPipelineCachingToDisk = 1;
ShaderCacheMode = 1;
IFH = 0;
EnableVmAlwaysValid = 1;
IdleAfterSubmitGpuMask = 1;
};
description = ''
Runtime settings for AMDVLK to be configured {file}`/etc/amd/amdVulkanSettings.cfg`.
See [AMDVLK GitHub page](https://github.com/GPUOpen-Drivers/AMDVLK?tab=readme-ov-file#runtime-settings).
'';
};
};
config = lib.mkIf cfg.enable {
hardware.opengl = {
enable = true;
driSupport = true;
extraPackages = [ cfg.package ];
driSupport32Bit = cfg.support32Bit.enable;
extraPackages32 = [ cfg.support32Bit.package ];
};
services.xserver.videoDrivers = [ "amdgpu" ];
environment.sessionVariables = lib.mkIf cfg.supportExperimental.enable {
AMDVLK_ENABLE_DEVELOPING_EXT = "all";
};
environment.etc = lib.mkIf (cfg.settings != { }) {
"amd/amdVulkanSettings.cfg".text = lib.concatStrings
(lib.mapAttrsToList
(n: v: ''
${n},${builtins.toString v}
'')
cfg.settings);
};
};
meta = {
maintainers = with lib.maintainers; [ johnrtitor ];
};
}