summary refs log tree commit diff
path: root/pkgs/development/tools/glslviewer/default.nix
blob: b9e46ca41e1764f5e14bbf9136512f566b033930 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ stdenv, fetchFromGitHub, glfw, pkgconfig, libXrandr, libXdamage
, libXext, libXrender, libXinerama, libXcursor, libXxf86vm, libXi
, libX11, libGLU, python2Packages, ensureNewerSourcesForZipFilesHook
, Cocoa
}:

stdenv.mkDerivation {
  pname = "glslviewer";
  version = "2019-04-22";

  src = fetchFromGitHub {
    owner = "patriciogonzalezvivo";
    repo = "glslViewer";
    rev = "fa3e2ed4810927d189e480b704366cca22f281f3";
    sha256 = "1888jxi84f2nnc0kpzqrn2cada1z4zqyq8ss4ppb5y3wy7d87qjn";
  };

  nativeBuildInputs = [ pkgconfig ensureNewerSourcesForZipFilesHook ];
  buildInputs = [
    glfw libGLU glfw libXrandr libXdamage
    libXext libXrender libXinerama libXcursor libXxf86vm
    libXi libX11
  ] ++ (with python2Packages; [ python setuptools wrapPython ])
    ++ stdenv.lib.optional stdenv.isDarwin Cocoa;
  pythonPath = with python2Packages; [ requests ];

  # Makefile has /usr/local/bin hard-coded for 'make install'
  preConfigure = ''
    substituteInPlace Makefile \
        --replace '/usr/local' "$out" \
        --replace '/usr/bin/clang++' 'clang++'
    substituteInPlace Makefile \
        --replace 'python setup.py install' "python setup.py install --prefix=$out"
  '';

  preInstall = ''
    mkdir -p $out/bin $(toPythonPath "$out")
    export PYTHONPATH=$PYTHONPATH:$(toPythonPath "$out")
  '';

  postInstall = ''
    wrapPythonPrograms
  '';

  meta = with stdenv.lib; {
    description = "Live GLSL coding renderer";
    homepage = "http://patriciogonzalezvivo.com/2015/glslViewer/";
    license = licenses.bsd3;
    platforms = platforms.linux ++ platforms.darwin;
    maintainers = [ maintainers.hodapp ];
  };
}