1 { lib, makeImpureTest, coreutils, amdvlk, vulkan-tools }:
4 testedPackage = "amdvlk";
6 sandboxPaths = [ "/sys" "/dev/dri" ];
8 nativeBuildInputs = [ vulkan-tools ];
10 VK_ICD_FILENAMES = "${amdvlk}/share/vulkan/icd.d/amd_icd64.json";
11 XDG_RUNTIME_DIR = "/tmp";
13 # AMDVLK needs access to /dev/dri/card0 (or another card), but normally it is rw-rw----
14 # Change the permissions to be rw for everyone
15 prepareRunCommands = ''
16 function reset_perms()
18 # Reset permissions to previous state
19 for card in /dev/dri/card*; do
20 sudo ${coreutils}/bin/chmod "0''${cardPerms[$card]}" $card
24 # Save permissions on /dev/dri/card*
26 for card in /dev/dri/card*; do
27 cardPerms[$card]=$(stat -c "%a" $card)
30 sudo ${coreutils}/bin/chmod o+rw /dev/dri/card*
35 # Check that there is at least one card with write-access
36 if ! ls -l /dev/dri/card* | cut -b8-9 | grep -q rw; then
37 echo 'AMDVLK needs rw access to /dev/dri/card0 or a fitting card, please run `sudo chmod o+rw /dev/dri/card*`'
42 echo "Checking version"
43 vulkaninfo --summary | grep '= ${amdvlk.version}'
46 meta = with lib.maintainers; {
47 maintainers = [ Flakebi ];