blob: e76e6dce9eaf1cfa9e9f44e2c6db6687d0c1c0c0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
{ lib, makeImpureTest, coreutils, amdvlk, vulkan-tools }:
makeImpureTest {
name = "amdvlk";
testedPackage = "amdvlk";
sandboxPaths = [ "/sys" "/dev/dri" ];
nativeBuildInputs = [ vulkan-tools ];
VK_ICD_FILENAMES = "${amdvlk}/share/vulkan/icd.d/amd_icd64.json";
XDG_RUNTIME_DIR = "/tmp";
# AMDVLK needs access to /dev/dri/card0 (or another card), but normally it is rw-rw----
# Change the permissions to be rw for everyone
prepareRunCommands = ''
function reset_perms()
{
# Reset permissions to previous state
for card in /dev/dri/card*; do
sudo ${coreutils}/bin/chmod "0''${cardPerms[$card]}" $card
done
}
# Save permissions on /dev/dri/card*
declare -A cardPerms
for card in /dev/dri/card*; do
cardPerms[$card]=$(stat -c "%a" $card)
done
sudo ${coreutils}/bin/chmod o+rw /dev/dri/card*
trap reset_perms EXIT
'';
testScript = ''
# Check that there is at least one card with write-access
if ! ls -l /dev/dri/card* | cut -b8-9 | grep -q rw; then
echo 'AMDVLK needs rw access to /dev/dri/card0 or a fitting card, please run `sudo chmod o+rw /dev/dri/card*`'
exit 1
fi
vulkaninfo --summary
echo "Checking version"
vulkaninfo --summary | grep '= ${amdvlk.version}'
'';
meta = with lib.maintainers; {
maintainers = [ Flakebi ];
};
}
|