Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

59 lines
1.4 KiB
Nix

{
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 ];
};
}