Skip to content

Commit

Permalink
vkdevicechooser: init at 1.1
Browse files Browse the repository at this point in the history
Inspired by the Arch package[1], it uses a fork of vkdevicechooser that
uses the latest version of the Vulkan libraries and doesn't require the
generated headers from vulkan-validation-layers[2].

Related discussion:
https://discourse.nixos.org/t/building-vkdevicechooser-missing-vk-layer-dispatch-table-h/45196

[1] https://aur.archlinux.org/packages/vkdevicechooser
[2] jiriks74/vkdevicechooser@2eecb26
  • Loading branch information
Michael Witrant committed Jan 5, 2025
1 parent 30f9e4b commit 94a5556
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions pkgs/by-name/vk/vkdevicechooser/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
lib,
stdenv,
fetchFromGitHub,
writeText,
meson,
vulkan-headers,
vulkan-utility-libraries,
ninja,
jq,
}:

stdenv.mkDerivation rec {
pname = "vkdevicechooser";
version = "1.1";

src = fetchFromGitHub {
owner = "jiriks74";
repo = "vkdevicechooser";
rev = version;
hash = "sha256-j4hefarOQ3q0sKkB2g/dO2/4bSYzt4oxmCna0nMAjFk=";
};

nativeBuildInputs = [
meson
ninja
jq
];

buildInputs = [
vulkan-headers
vulkan-utility-libraries
];

# Help vulkan-loader find the layer
setupHook = writeText "setup-hook" ''
addToSearchPath XDG_DATA_DIRS @out@/share
'';

# Include absolute paths to layer libraries in their associated
# layer definition json files.
preFixup = ''
for f in "$out"/share/vulkan/explicit_layer.d/*.json "$out"/share/vulkan/implicit_layer.d/*.json; do
jq <"$f" >tmp.json ".layer.library_path = \"$out/lib/\" + .layer.library_path"
mv tmp.json "$f"
done
'';

meta = {
description = "Vulkan layer to force a specific device to be used";
homepage = "https://github.com/aejsmith/vkdevicechooser";
platforms = lib.platforms.unix;
license = lib.licenses.mit;
maintainers = [ lib.maintainers.sigmike ];
};
}

0 comments on commit 94a5556

Please sign in to comment.