unityhub: 3.10.0 -> 3.11.0 (#376840)
[NixPkgs.git] / pkgs / by-name / sw / swiftshader / package.nix
blob6bae629c60301b8dd774745b262f77bf2bfecdc2
2   lib,
3   stdenv,
4   fetchgit,
5   python3,
6   cmake,
7   jq,
8 }:
10 stdenv.mkDerivation rec {
11   pname = "swiftshader";
12   version = "2023-09-11";
14   src = fetchgit {
15     url = "https://swiftshader.googlesource.com/SwiftShader";
16     rev = "4e40d502c440cc59b25fa3a5fee0eadbab7442aa";
17     hash = "sha256-YtbTaOkFhVMKdu3jiRHQsPmoEu3KDzIQXLZ5HFBSmWI=";
18     # Remove 1GB of test files to get under Hydra output limit
19     postFetch = ''
20       rm -r $out/third_party/llvm-project/llvm/test
21       rm -r $out/third_party/json/test
22       rm -r $out/third_party/cppdap/third_party/json/test
23       rm -r $out/third_party/llvm-project/clang/test
24     '';
25   };
27   nativeBuildInputs = [
28     cmake
29     python3
30     jq
31   ];
33   # Make sure we include the drivers and icd files in the output as the cmake
34   # generated install command only puts in the spirv-tools stuff.
35   installPhase = ''
36     runHook preInstall
38     #
39     # Vulkan driver
40     #
41     vk_so_path="$out/lib/libvk_swiftshader.so"
42     mkdir -p "$(dirname "$vk_so_path")"
43     mv Linux/libvk_swiftshader.so "$vk_so_path"
45     vk_icd_json="$out/share/vulkan/icd.d/vk_swiftshader_icd.json"
46     mkdir -p "$(dirname "$vk_icd_json")"
47     jq ".ICD.library_path = \"$vk_so_path\"" <Linux/vk_swiftshader_icd.json >"$vk_icd_json"
49     runHook postInstall
50   '';
52   meta = with lib; {
53     description = "A high-performance CPU-based implementation of the Vulkan 1.3 graphics API";
54     homepage = "https://opensource.google/projects/swiftshader";
55     license = licenses.asl20;
56     # Should be possible to support Darwin by changing the install phase with
57     # 's/Linux/Darwin/' and 's/so/dylib/' or something similar.
58     platforms = with platforms; linux;
59     maintainers = [ ];
60   };