1 { lib, 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
6 # Future work: extract and fetch all revisions automatically based on a revision of shaderc's known-good branch.
8 glslang = fetchFromGitHub {
9 owner = "KhronosGroup";
11 rev = "3ee5f2f1d3316e228916788b300d786bb574d337";
12 sha256 = "1l5h9d92mzd35pgs0wibqfg7vbl771lwnvdlcsyhf6999khn5dzv";
14 spirv-tools = fetchFromGitHub {
15 owner = "KhronosGroup";
17 rev = "b63f0e5ed3e818870968ebf6af73317127fd07b0";
18 sha256 = "1chv30azfp76nha428ivg4ixrij6d8pxj5kn3jam87gmkmgc9zhm";
20 spirv-headers = fetchFromGitHub {
21 owner = "KhronosGroup";
22 repo = "SPIRV-Headers";
23 rev = "979924c8bc839e4cb1b69d03d48398551f369ce7";
24 sha256 = "07vyjlblpm4zhfds612h86lnz0qvrj5qqw5z2zzfa3m9fax7cm85";
26 in stdenv.mkDerivation rec {
30 outputs = [ "out" "lib" "bin" "dev" "static" ];
32 src = fetchFromGitHub {
36 sha256 = "1sxz8872x3rdlrhmbn83r1vniq4j51jnk0ka3447fq68il4myf1w";
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
45 nativeBuildInputs = [ cmake python3 ];
48 moveToOutput "lib/*.a" $static
51 cmakeFlags = [ "-DSHADERC_SKIP_TESTS=ON" ];
54 inherit (src.meta) homepage;
55 description = "A collection of tools, libraries and tests for shader compilation";
56 license = [ licenses.asl20 ];