depot/third_party/nixpkgs/nixos/modules/services/hardware/amdvlk.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

59 lines
1.7 KiB
Nix

{ 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.graphics = {
enable = true;
extraPackages = [ cfg.package ];
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 ];
};
}