about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/graphics')
-rw-r--r--nixpkgs/pkgs/tools/graphics/agi/default.nix8
-rw-r--r--nixpkgs/pkgs/tools/graphics/blockhash/default.nix4
-rw-r--r--nixpkgs/pkgs/tools/graphics/fgallery/default.nix9
-rw-r--r--nixpkgs/pkgs/tools/graphics/maim/default.nix1
-rw-r--r--nixpkgs/pkgs/tools/graphics/stegsolve/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/graphics/structure-synth/default.nix46
-rw-r--r--nixpkgs/pkgs/tools/graphics/structure-synth/gcc47.patch50
-rw-r--r--nixpkgs/pkgs/tools/graphics/vulkan-cts/default.nix71
-rw-r--r--nixpkgs/pkgs/tools/graphics/vulkan-cts/sources.nix73
-rwxr-xr-xnixpkgs/pkgs/tools/graphics/vulkan-cts/update.sh21
-rwxr-xr-xnixpkgs/pkgs/tools/graphics/vulkan-cts/vk-cts-sources.py93
11 files changed, 231 insertions, 175 deletions
diff --git a/nixpkgs/pkgs/tools/graphics/agi/default.nix b/nixpkgs/pkgs/tools/graphics/agi/default.nix
index 64e4a49445af..501522b27ea3 100644
--- a/nixpkgs/pkgs/tools/graphics/agi/default.nix
+++ b/nixpkgs/pkgs/tools/graphics/agi/default.nix
@@ -14,11 +14,11 @@
 
 stdenvNoCC.mkDerivation rec {
   pname = "agi";
-  version = "3.3.0";
+  version = "3.3.1";
 
   src = fetchzip {
-    url = "https://github.com/google/agi/releases/download/v${version}/agi-${version}-linux.zip";
-    sha256 = "sha256-vKq1pe4Z0blSvNgez+/MP2rA0+QfCyr3RsCGX4GMR08=";
+    url = "https://github.com/google/agi/releases/download/${version}/agi-${version}-linux.zip";
+    sha256 = "sha256-Yawl6InBYSWNw3clHyGAeC2PVfXEzWmbd6vcYrqAPO0=";
   };
 
   nativeBuildInputs = [
@@ -68,7 +68,7 @@ stdenvNoCC.mkDerivation rec {
     changelog = "https://github.com/google/agi/releases/tag/v${version}";
     platforms = [ "x86_64-linux" ];
     license = licenses.asl20;
-    maintainers = [ maintainers.ivar ];
+    maintainers = with maintainers; [ ivar kashw2 ];
     sourceProvenance = with sourceTypes; [
       binaryBytecode
       binaryNativeCode
diff --git a/nixpkgs/pkgs/tools/graphics/blockhash/default.nix b/nixpkgs/pkgs/tools/graphics/blockhash/default.nix
index 4f63cf90a3ae..9d7b613bbe0b 100644
--- a/nixpkgs/pkgs/tools/graphics/blockhash/default.nix
+++ b/nixpkgs/pkgs/tools/graphics/blockhash/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub, python3, pkg-config, imagemagick, wafHook }:
+{ lib, stdenv, fetchFromGitHub, python3, pkg-config, imagemagick, waf }:
 
 stdenv.mkDerivation rec {
   pname = "blockhash";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0x3lvhnkb4c3pyq6p81qnnqimz35wpippiac506dgjx3b1848v35";
   };
 
-  nativeBuildInputs = [ python3 pkg-config wafHook ];
+  nativeBuildInputs = [ python3 pkg-config waf.hook ];
   buildInputs = [ imagemagick ];
 
   strictDeps = true;
diff --git a/nixpkgs/pkgs/tools/graphics/fgallery/default.nix b/nixpkgs/pkgs/tools/graphics/fgallery/default.nix
index 66f8d8d84100..7af5c6129f25 100644
--- a/nixpkgs/pkgs/tools/graphics/fgallery/default.nix
+++ b/nixpkgs/pkgs/tools/graphics/fgallery/default.nix
@@ -10,16 +10,21 @@
 
 stdenv.mkDerivation rec {
   pname = "fgallery";
-  version = "1.8.2";
+  version = "1.9.1";
 
   src = fetchurl {
     url = "https://www.thregr.org/~wavexx/software/fgallery/releases/fgallery-${version}.zip";
-    sha256 = "18wlvqbxcng8pawimbc8f2422s8fnk840hfr6946lzsxr0ijakvf";
+    hash = "sha256-FvF0wkRe3wTPUG9/GEBxkaxvZ1B4wEd9kI9rURHKxn0=";
   };
 
   nativeBuildInputs = [ makeWrapper unzip ];
   buildInputs = (with perlPackages; [ perl ImageExifTool CpanelJSONXS ]);
 
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace "/usr" $out
+  '';
+
   installPhase = ''
     mkdir -p "$out/bin"
     mkdir -p "$out/share/fgallery"
diff --git a/nixpkgs/pkgs/tools/graphics/maim/default.nix b/nixpkgs/pkgs/tools/graphics/maim/default.nix
index f4851c6bcabf..ce91e361a6eb 100644
--- a/nixpkgs/pkgs/tools/graphics/maim/default.nix
+++ b/nixpkgs/pkgs/tools/graphics/maim/default.nix
@@ -21,6 +21,7 @@ stdenv.mkDerivation rec {
   doCheck = false;
 
   meta = with lib; {
+    mainProgram = "maim";
     inherit (src.meta) homepage;
     description = "A command-line screenshot utility";
     longDescription = ''
diff --git a/nixpkgs/pkgs/tools/graphics/stegsolve/default.nix b/nixpkgs/pkgs/tools/graphics/stegsolve/default.nix
index 56ad908d41a2..3f147ab0deca 100644
--- a/nixpkgs/pkgs/tools/graphics/stegsolve/default.nix
+++ b/nixpkgs/pkgs/tools/graphics/stegsolve/default.nix
@@ -1,12 +1,19 @@
-{ lib, stdenv, fetchurl, jre, makeWrapper, copyDesktopItems, makeDesktopItem }:
-
-stdenv.mkDerivation rec {
+{ lib
+, stdenvNoCC
+, fetchurl
+, jre
+, makeWrapper
+, copyDesktopItems
+, makeDesktopItem
+}:
+
+stdenvNoCC.mkDerivation (finalAttrs: {
   pname = "stegsolve";
   version = "1.3";
 
   src = fetchurl {
     # No versioned binary is published :(
-    url = "http://www.caesum.com/handbook/Stegsolve.jar";
+    url = "https://web.archive.org/web/20230319054116if_/http://www.caesum.com/handbook/Stegsolve.jar";
     sha256 = "0np5zb28sg6yzkp1vic80pm8iiaamvjpbf5dxmi9kwvqcrh4jyq0";
   };
 
@@ -15,10 +22,10 @@ stdenv.mkDerivation rec {
   desktopItems = [
     (makeDesktopItem {
       type = "Application";
-      name = pname;
+      name = finalAttrs.pname;
       desktopName = "Stegsolve";
       comment = "A steganographic image analyzer, solver and data extractor for challanges";
-      exec = pname;
+      exec = finalAttrs.pname;
       categories = [ "Graphics" ];
     })
   ];
@@ -38,10 +45,15 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     description = "A steganographic image analyzer, solver and data extractor for challanges";
-    homepage = "http://www.caesum.com/handbook/stego.htm";
+    homepage = "https://www.wechall.net/forum/show/thread/527/Stegsolve_1.3/";
     sourceProvenance = with sourceTypes; [ binaryBytecode ];
-    license = licenses.unfree;
+    license = {
+      fullName = "Cronos License";
+      url = "http://www.caesum.com/legal.php";
+      free = false;
+      redistributable = true;
+    };
     maintainers = with maintainers; [ emilytrau ];
     platforms = platforms.all;
   };
-}
+})
diff --git a/nixpkgs/pkgs/tools/graphics/structure-synth/default.nix b/nixpkgs/pkgs/tools/graphics/structure-synth/default.nix
deleted file mode 100644
index e61489fadf00..000000000000
--- a/nixpkgs/pkgs/tools/graphics/structure-synth/default.nix
+++ /dev/null
@@ -1,46 +0,0 @@
-{ lib, stdenv, fetchurl, qt4, qmake4Hook, unzip, libGLU, makeWrapper }:
-
-stdenv.mkDerivation rec {
-  pname = "structure-synth";
-  version = "1.5.0";
-
-  src = fetchurl {
-    url = "mirror://sourceforge/structuresynth/StructureSynth-Source-v${version}.zip";
-    sha256 = "1kiammx46719az6jzrav8yrwz82nk4m72ybj0kpbnvp9wfl3swbb";
-  };
-
-  buildInputs = [ qt4 libGLU ];
-  nativeBuildInputs = [ qmake4Hook makeWrapper unzip ];
-
-  # Thanks to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672000#15:
-  patches = [ ./gcc47.patch ];
-
-  enableParallelBuilding = true;
-
-  preConfigure = ''
-    ${qt4}/bin/qmake -project -after "CONFIG+=opengl" -after "QT+=xml opengl script" -after "unix:LIBS+=-lGLU"
-  '';
-
-  installPhase = ''
-    mkdir -p $out/bin;
-    mkdir -p $out/share/Examples $out/share/Misc;
-    cp "Structure Synth Source Code" $out/bin/structure-synth;
-    cp -r Examples/* $out/share/Examples;
-    cp -r Misc/* $out/share/Misc;
-  '';
-
-  # Structure Synth expects to see 'Examples' and 'Misc' directory in
-  # either $HOME or $PWD - so help it along by moving $PWD to 'share',
-  # where we just copied those two directories:
-  preFixup = ''
-    wrapProgram "$out/bin/structure-synth" --chdir "$out/share"
-  '';
-
-  meta = with lib; {
-    description = "Application for generating 3D structures by specifying a design grammar";
-    homepage = "https://structuresynth.sourceforge.net";
-    maintainers = with maintainers; [ hodapp ];
-    license = licenses.gpl3;
-    platforms = platforms.linux;
-  };
-}
diff --git a/nixpkgs/pkgs/tools/graphics/structure-synth/gcc47.patch b/nixpkgs/pkgs/tools/graphics/structure-synth/gcc47.patch
deleted file mode 100644
index 8726e89c8308..000000000000
--- a/nixpkgs/pkgs/tools/graphics/structure-synth/gcc47.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-diff -rc "Structure Synth Source Code/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp" "Structure Synth Source Code2/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp"
-*** "Structure Synth Source Code/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp"	2010-11-13 22:32:44.000000000 -0500
---- "Structure Synth Source Code2/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp"	2018-06-24 14:23:30.794296776 -0400
-***************
-*** 1,5 ****
-  #include <QThread>

-! 

-  

-  #include "RayTracer.h"

-  

---- 1,5 ----
-  #include <QThread>

-! #include <GL/glu.h>

-  

-  #include "RayTracer.h"

-  

-diff -rc "Structure Synth Source Code/SyntopiaCore/GLEngine/Raytracer/VoxelStepper.cpp" "Structure Synth Source Code2/SyntopiaCore/GLEngine/Raytracer/VoxelStepper.cpp"
-*** "Structure Synth Source Code/SyntopiaCore/GLEngine/Raytracer/VoxelStepper.cpp"	2010-09-08 21:25:30.000000000 -0400
---- "Structure Synth Source Code2/SyntopiaCore/GLEngine/Raytracer/VoxelStepper.cpp"	2018-06-24 14:23:12.542868194 -0400
-***************
-*** 122,128 ****
-  						currentT = p;

-  

-  						// We do not intersect grid.

-! 						if (!found) return false;

-  				}

-  

-  				stepX = (dir.x() > 0) ? 1 : -1;

---- 122,128 ----
-  						currentT = p;

-  

-  						// We do not intersect grid.

-! 						if (!found) return NULL;

-  				}

-  

-  				stepX = (dir.x() > 0) ? 1 : -1;

-Only in Structure Synth Source Code2/SyntopiaCore/GLEngine/Raytracer: VoxelStepper.cpp.orig
-diff -rc "Structure Synth Source Code/SyntopiaCore/GLEngine/Sphere.h" "Structure Synth Source Code2/SyntopiaCore/GLEngine/Sphere.h"
-*** "Structure Synth Source Code/SyntopiaCore/GLEngine/Sphere.h"	2010-08-11 15:12:22.000000000 -0400
---- "Structure Synth Source Code2/SyntopiaCore/GLEngine/Sphere.h"	2018-06-24 14:23:30.793296807 -0400
-***************
-*** 2,7 ****
---- 2,8 ----
-  

-  #include "SyntopiaCore/Math/Vector3.h"

-  #include "Object3D.h"

-+ #include <GL/glu.h>

-  

-  namespace SyntopiaCore {

-  	namespace GLEngine {	

diff --git a/nixpkgs/pkgs/tools/graphics/vulkan-cts/default.nix b/nixpkgs/pkgs/tools/graphics/vulkan-cts/default.nix
index bdbf573a016c..e448160f2a88 100644
--- a/nixpkgs/pkgs/tools/graphics/vulkan-cts/default.nix
+++ b/nixpkgs/pkgs/tools/graphics/vulkan-cts/default.nix
@@ -32,81 +32,29 @@ let
   # It also expects the version specified in the repository, which can be incompatible
   # with the version in nixpkgs (e.g. for SPIRV-Headers), so we don't want to patch in our packages.
   # The revisions are extracted from https://github.com/KhronosGroup/VK-GL-CTS/blob/main/external/fetch_sources.py#L290
-  amber = fetchFromGitHub {
-    owner = "google";
-    repo = "amber";
-    rev = "933ecb4d6288675a92eb1650e0f52b1d7afe8273";
-    hash = "sha256-v9z4gv/mTjaCkByZn6uDpMteQuIf0FzZXeKyoXfFjXo=";
-  };
-  esextractor = fetchFromGitHub {
-    owner = "Igalia";
-    repo = "ESExtractor";
-    rev = "v0.2.5";
-    hash = "sha256-A3lyTTarR1ZJrXcrLDR5D7H1kBwJNyrPPjEklRM9YBY=";
-  };
-  jsoncpp = fetchFromGitHub {
-    owner = "open-source-parsers";
-    repo = "jsoncpp";
-    rev = "9059f5cad030ba11d37818847443a53918c327b1";
-    hash = "sha256-m0tz8w8HbtDitx3Qkn3Rxj/XhASiJVkThdeBxIwv3WI=";
-  };
-  glslang = fetchFromGitHub {
-    owner = "KhronosGroup";
-    repo = "glslang";
-    rev = "cd2082e0584d4e39d11e3f401184e0d558ab304f";
-    hash = "sha256-j7O0j4E8lQ9tqAiuhnD/t6VL45OUvntsoKlhiuCXet4=";
-  };
-  spirv-tools = fetchFromGitHub {
-    owner = "KhronosGroup";
-    repo = "SPIRV-Tools";
-    rev = "01828dac778d08f4ebafd2e06bd419f6c84e5984";
-    hash = "sha256-i1rDMVpUiNdacDe20DsN67/rzK5V434EzfSv97y+xGU=";
-  };
-  spirv-headers = fetchFromGitHub {
-    owner = "KhronosGroup";
-    repo = "SPIRV-Headers";
-    rev = "1feaf4414eb2b353764d01d88f8aa4bcc67b60db";
-    hash = "sha256-VOq3r6ZcbDGGxjqC4IoPMGC5n1APUPUAs9xcRzxdyfk=";
-  };
-  video-parser = fetchFromGitHub {
-    owner = "nvpro-samples";
-    repo = "vk_video_samples";
-    rev = "7d68747d3524842afaf050c5e00a10f5b8c07904";
-    hash = "sha256-L5IYDm0bLq+NlNrzozu0VQx8zL1na6AhrkjZKxOWSnU=";
-  };
-  vulkan-docs = fetchFromGitHub {
-    owner = "KhronosGroup";
-    repo = "Vulkan-Docs";
-    rev = "9fff8b252a3688c0231fa78709084bbe677d3bf7";
-    hash = "sha256-KpKsKTY5xCSZ5Y92roa0fq/iqc1hVJNS7l87RFcxyRQ=";
-  };
+  # with the vk-cts-sources.py script.
+  sources = import ./sources.nix { inherit fetchurl fetchFromGitHub; };
 in
 stdenv.mkDerivation (finalAttrs: {
   pname = "vulkan-cts";
-  version = "1.3.6.0";
+  version = "1.3.6.3";
 
   src = fetchFromGitHub {
     owner = "KhronosGroup";
     repo = "VK-GL-CTS";
     rev = "${finalAttrs.pname}-${finalAttrs.version}";
-    hash = "sha256-PWkY5PFoxKosteRgbo6aRqGFHBkoEPFcg6NN8EquD8U=";
+    hash = "sha256-jpKPmUduH3IuUYzBAZJFl/w1FqjGC8sXSTnet8YEZ0I=";
   };
 
   outputs = [ "out" "lib" ];
 
   prePatch = ''
-    mkdir -p external/ESExtractor external/renderdoc/src external/spirv-headers external/video-parser external/vulkan-docs
+    mkdir -p external/renderdoc/src
 
     cp -r ${renderdoc} external/renderdoc/src/renderdoc_app.h
 
-    cp -r ${amber} external/amber/src
-    cp -r ${esextractor} external/ESExtractor/src
-    cp -r ${jsoncpp} external/jsoncpp/src
-    cp -r ${glslang} external/glslang/src
-    cp -r ${spirv-tools} external/spirv-tools/src
-    cp -r ${spirv-headers} external/spirv-headers/src
-    cp -r ${video-parser} external/video-parser/src
-    cp -r ${vulkan-docs} external/vulkan-docs/src
+    ${sources.prePatch}
+
     chmod u+w -R external
   '';
 
@@ -120,8 +68,6 @@ stdenv.mkDerivation (finalAttrs: {
     libXau
     libXdmcp
     libxcb
-    spirv-headers
-    spirv-tools
     wayland
     wayland-protocols
     zlib
@@ -129,7 +75,6 @@ stdenv.mkDerivation (finalAttrs: {
 
   nativeBuildInputs = [
     cmake
-    glslang
     makeWrapper
     ninja
     pkg-config
@@ -159,6 +104,8 @@ stdenv.mkDerivation (finalAttrs: {
       --add-flags "--deqp-archive-dir=$out/archive-dir"
   '';
 
+  passthru.updateScript = ./update.sh;
+
   meta = with lib; {
     description = "Khronos Vulkan Conformance Tests";
     homepage = "https://github.com/KhronosGroup/VK-GL-CTS/blob/main/external/vulkancts/README.md";
diff --git a/nixpkgs/pkgs/tools/graphics/vulkan-cts/sources.nix b/nixpkgs/pkgs/tools/graphics/vulkan-cts/sources.nix
new file mode 100644
index 000000000000..24d2c9de387f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/graphics/vulkan-cts/sources.nix
@@ -0,0 +1,73 @@
+# Autogenerated from vk-cts-sources.py
+{ fetchurl, fetchFromGitHub }:
+rec {
+  ESExtractor = fetchFromGitHub {
+    owner = "Igalia";
+    repo = "ESExtractor";
+    rev = "v0.2.5";
+    hash = "sha256-A3lyTTarR1ZJrXcrLDR5D7H1kBwJNyrPPjEklRM9YBY=";
+  };
+
+  amber = fetchFromGitHub {
+    owner = "google";
+    repo = "amber";
+    rev = "933ecb4d6288675a92eb1650e0f52b1d7afe8273";
+    hash = "sha256-v9z4gv/mTjaCkByZn6uDpMteQuIf0FzZXeKyoXfFjXo=";
+  };
+
+  glslang = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "glslang";
+    rev = "77417d5c9e0a5d4c79ddd0285d530b45f7259f0d";
+    hash = "sha256-BNgnhTl7/+nC5D7Jl7QME5+qIbm+I0Wh/tf9F4WhW3U=";
+  };
+
+  jsoncpp = fetchFromGitHub {
+    owner = "open-source-parsers";
+    repo = "jsoncpp";
+    rev = "9059f5cad030ba11d37818847443a53918c327b1";
+    hash = "sha256-m0tz8w8HbtDitx3Qkn3Rxj/XhASiJVkThdeBxIwv3WI=";
+  };
+
+  spirv-headers = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "SPIRV-Headers";
+    rev = "1feaf4414eb2b353764d01d88f8aa4bcc67b60db";
+    hash = "sha256-VOq3r6ZcbDGGxjqC4IoPMGC5n1APUPUAs9xcRzxdyfk=";
+  };
+
+  spirv-tools = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "SPIRV-Tools";
+    rev = "01828dac778d08f4ebafd2e06bd419f6c84e5984";
+    hash = "sha256-i1rDMVpUiNdacDe20DsN67/rzK5V434EzfSv97y+xGU=";
+  };
+
+  video-parser = fetchFromGitHub {
+    owner = "nvpro-samples";
+    repo = "vk_video_samples";
+    rev = "7d68747d3524842afaf050c5e00a10f5b8c07904";
+    hash = "sha256-L5IYDm0bLq+NlNrzozu0VQx8zL1na6AhrkjZKxOWSnU=";
+  };
+
+  vulkan-docs = fetchFromGitHub {
+    owner = "KhronosGroup";
+    repo = "Vulkan-Docs";
+    rev = "9fff8b252a3688c0231fa78709084bbe677d3bf7";
+    hash = "sha256-KpKsKTY5xCSZ5Y92roa0fq/iqc1hVJNS7l87RFcxyRQ=";
+  };
+
+
+  prePatch = ''
+    mkdir -p external/ESExtractor external/amber external/glslang external/jsoncpp external/spirv-headers external/spirv-tools external/video-parser external/vulkan-docs
+
+    cp -r ${ESExtractor} external/ESExtractor/src
+    cp -r ${amber} external/amber/src
+    cp -r ${glslang} external/glslang/src
+    cp -r ${jsoncpp} external/jsoncpp/src
+    cp -r ${spirv-headers} external/spirv-headers/src
+    cp -r ${spirv-tools} external/spirv-tools/src
+    cp -r ${video-parser} external/video-parser/src
+    cp -r ${vulkan-docs} external/vulkan-docs/src
+  '';
+}
diff --git a/nixpkgs/pkgs/tools/graphics/vulkan-cts/update.sh b/nixpkgs/pkgs/tools/graphics/vulkan-cts/update.sh
new file mode 100755
index 000000000000..300fe230264e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/graphics/vulkan-cts/update.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p common-updater-scripts curl jq
+
+set -euo pipefail
+
+rawVersion="$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/KhronosGroup/VK-GL-CTS/releases" | jq -r  'map(select(.tag_name | startswith("vulkan-cts-"))) | .[0].tag_name')"
+basedir="$(git rev-parse --show-toplevel)"
+
+cd "$basedir"
+# Strip prefix
+version="$(echo "$rawVersion" | sed 's/vulkan-cts-//')"
+update-source-version vulkan-cts "$version"
+
+# Update imported sources
+tmpDir="$(mktemp -d)"
+trap "rm -rf $tmpDir" EXIT
+
+curl -s "https://raw.githubusercontent.com/KhronosGroup/VK-GL-CTS/$rawVersion/external/fetch_sources.py" -o "$tmpDir/fetch_sources.py"
+sed -i '/from ctsbuild.common import/d' "$tmpDir/fetch_sources.py"
+cd "$(dirname "$0")"
+PYTHONPATH="$tmpDir/" ./vk-cts-sources.py
diff --git a/nixpkgs/pkgs/tools/graphics/vulkan-cts/vk-cts-sources.py b/nixpkgs/pkgs/tools/graphics/vulkan-cts/vk-cts-sources.py
new file mode 100755
index 000000000000..f3e42bd82e7a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/graphics/vulkan-cts/vk-cts-sources.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i python3 -p nix-prefetch-github -p git
+#nix-shell -I nixpkgs=../../../../ -i python3 -p "python3.withPackages (ps: with ps; [ nix-prefetch-github ])" -p "git"
+
+import json
+import re
+import subprocess
+import sys
+
+import fetch_sources
+
+def get_github_hash(owner, repo, revision):
+    result = subprocess.run(
+        ["nix-prefetch-github", owner, repo, "--json", "--rev", revision],
+        check=True,
+        capture_output=True,
+        text=True,
+    )
+    j = json.loads(result.stdout)
+    # Remove False values
+    return {k: v for k, v in j.items() if v}
+
+def main():
+    pkgs = fetch_sources.PACKAGES
+    pkgs.sort(key = lambda pkg: pkg.baseDir)
+    existing_sources = {}
+
+    # Fetch hashes from existing sources file
+    with open("sources.nix") as f:
+        existing_file = f.read()
+
+    source_re = re.compile("(?P<name>[^ ]+) = fetchFromGitHub[^\n]*\n"
+        "[^\n]+\n" # owner
+        "[^\n]+\n" # repo
+        " *rev = \"(?P<rev>[^\"]+)\";\n"
+        " *hash = \"(?P<hash>[^\"]+)\";\n"
+    )
+
+    for m in source_re.finditer(existing_file):
+        if m.group("hash").startswith("sha"):
+            print(f"Found {m.group('name')}: {m.group('rev')} -> {m.group('hash')}")
+            existing_sources[m.group("name")] = (m.group("rev"), m.group("hash"))
+    print()
+
+
+    # Write new sources file
+    with open("sources.nix", "w") as f:
+        f.write("# Autogenerated from vk-cts-sources.py\n")
+        f.write("{ fetchurl, fetchFromGitHub }:\n")
+        f.write("rec {");
+
+        github_re = re.compile("https://github.com/(?P<owner>[^/]+)/(?P<repo>[^/]+).git")
+
+        for pkg in pkgs:
+            if isinstance(pkg, fetch_sources.GitRepo):
+                ms = github_re.match(pkg.httpsUrl)
+
+                # Check for known hash
+                hash = None
+                if pkg.baseDir in existing_sources:
+                    existing_src = existing_sources[pkg.baseDir]
+                    if existing_src[0] == pkg.revision:
+                        hash = existing_src[1]
+
+                if hash is None:
+                    print(f"Fetching {pkg.baseDir}: {pkg.revision}")
+                    hash = get_github_hash(ms.group("owner"), ms.group("repo"), pkg.revision)["hash"]
+                    print(f"Got {pkg.baseDir}: {pkg.revision} -> {hash}")
+
+                f.write(f"\n  {pkg.baseDir} = fetchFromGitHub {{\n");
+                f.write(f"    owner = \"{ms.group('owner')}\";\n");
+                f.write(f"    repo = \"{ms.group('repo')}\";\n");
+                f.write(f"    rev = \"{pkg.revision}\";\n");
+                f.write(f"    hash = \"{hash}\";\n");
+                f.write(f"  }};\n");
+
+        f.write("\n\n  prePatch = ''\n");
+        f.write("    mkdir -p");
+        for pkg in pkgs:
+            if isinstance(pkg, fetch_sources.GitRepo):
+                f.write(f" external/{pkg.baseDir}")
+        f.write("\n\n");
+
+        for pkg in pkgs:
+            if isinstance(pkg, fetch_sources.GitRepo):
+                f.write(f"    cp -r ${{{pkg.baseDir}}} external/{pkg.baseDir}/{pkg.extractDir}\n");
+
+        f.write("  '';\n");
+
+        f.write("}\n");
+
+if __name__ == "__main__":
+    main()