Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, glfw, pkg-config, libXrandr, libXdamage
2, libXext, libXrender, libXinerama, libXcursor, libXxf86vm, libXi
3, libX11, libGLU, python3Packages, ensureNewerSourcesForZipFilesHook
4, Cocoa
5}:
6
7stdenv.mkDerivation rec {
8 pname = "glslviewer";
9 version = "1.6.8";
10
11 src = fetchFromGitHub {
12 owner = "patriciogonzalezvivo";
13 repo = "glslViewer";
14 rev = version;
15 sha256 = "0v7x93b61ama0gmzlx1zc56jgi7bvzsfvbkfl82xzwf2h5g1zni7";
16 };
17
18 postPatch = ''
19 sed '1i#include <cstring>' -i src/tools/text.cpp # gcc12
20 '';
21
22 nativeBuildInputs = [ pkg-config ensureNewerSourcesForZipFilesHook python3Packages.six ];
23 buildInputs = [
24 glfw libGLU glfw libXrandr libXdamage
25 libXext libXrender libXinerama libXcursor libXxf86vm
26 libXi libX11
27 ] ++ (with python3Packages; [ python setuptools wrapPython ])
28 ++ lib.optional stdenv.isDarwin Cocoa;
29 pythonPath = with python3Packages; [ pyyaml requests ];
30
31 # Makefile has /usr/local/bin hard-coded for 'make install'
32 preConfigure = ''
33 substituteInPlace Makefile \
34 --replace '/usr/local' "$out" \
35 --replace '/usr/bin/clang++' 'clang++'
36 substituteInPlace Makefile \
37 --replace 'python setup.py install' "python setup.py install --prefix=$out"
38 2to3 -w bin/*
39 '';
40
41 preInstall = ''
42 mkdir -p $out/bin $(toPythonPath "$out")
43 export PYTHONPATH=$PYTHONPATH:$(toPythonPath "$out")
44 '';
45
46 postInstall = ''
47 wrapPythonPrograms
48 '';
49
50 meta = with lib; {
51 description = "Live GLSL coding renderer";
52 homepage = "https://patriciogonzalezvivo.com/2015/glslViewer/";
53 license = licenses.bsd3;
54 platforms = platforms.linux ++ platforms.darwin;
55 maintainers = [ maintainers.hodapp ];
56 # never built on aarch64-darwin since first introduction in nixpkgs
57 broken = stdenv.isDarwin && stdenv.isAarch64;
58 };
59}