Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09 58 lines 2.0 kB view raw
1{ stdenv, fetchFromGitHub, cmake, python3 }: 2# Like many google projects, shaderc doesn't gracefully support separately compiled dependencies, so we can't easily use 3# the versions of glslang and spirv-tools used by vulkan-loader. Exact revisions are taken from 4# https://github.com/google/shaderc/blob/known-good/known_good.json 5 6# Future work: extract and fetch all revisions automatically based on a revision of shaderc's known-good branch. 7let 8 glslang = fetchFromGitHub { 9 owner = "KhronosGroup"; 10 repo = "glslang"; 11 rev = "3ed344dd784ecbbc5855e613786f3a1238823e56"; 12 sha256 = "00s2arfvw78d9k9fmangqlkvkmkpqzrin3g91vfab4wr8srb09dx"; 13 }; 14 spirv-tools = fetchFromGitHub { 15 owner = "KhronosGroup"; 16 repo = "SPIRV-Tools"; 17 rev = "323a81fc5e30e43a04e5e22af4cba98ca2a161e6"; 18 sha256 = "1kwyh95l02w3v1ra55c836wayzw8d0m14ab7wf0ynhhyp3k2p9hv"; 19 }; 20 spirv-headers = fetchFromGitHub { 21 owner = "KhronosGroup"; 22 repo = "SPIRV-Headers"; 23 rev = "204cd131c42b90d129073719f2766293ce35c081"; 24 sha256 = "1gp0mlbfccqnalaix97jxsa5i337xyzyr55wgssapy56p0q04wv2"; 25 }; 26in stdenv.mkDerivation rec { 27 pname = "shaderc"; 28 version = "2019.1"; 29 30 outputs = [ "out" "lib" "bin" "dev" "static" ]; 31 32 src = fetchFromGitHub { 33 owner = "google"; 34 repo = "shaderc"; 35 rev = "v${version}"; 36 sha256 = "0x514rpignnb4vvl7wmijfakqc59986knjw3dh1zx0ah42xa7x37"; 37 }; 38 39 patchPhase = '' 40 cp -r --no-preserve=mode ${glslang} third_party/glslang 41 cp -r --no-preserve=mode ${spirv-tools} third_party/spirv-tools 42 ln -s ${spirv-headers} third_party/spirv-tools/external/spirv-headers 43 ''; 44 45 nativeBuildInputs = [ cmake python3 ]; 46 47 postInstall = '' 48 moveToOutput "lib/*.a" $static 49 ''; 50 51 cmakeFlags = [ "-DSHADERC_SKIP_TESTS=ON" ]; 52 53 meta = with stdenv.lib; { 54 inherit (src.meta) homepage; 55 description = "A collection of tools, libraries and tests for shader compilation."; 56 license = [ licenses.asl20 ]; 57 }; 58}