about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/houdini/default.nix
blob: 5c28cd2443e40255ce63cbbbb2df24e2438f1e23 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{ lib, stdenv, writeScript, callPackage, buildFHSEnv, unwrapped ? callPackage ./runtime.nix {} }:

buildFHSEnv rec {
  name = "houdini-${unwrapped.version}";

  # houdini spawns hserver (and other license tools) that is supposed to live beyond the lifespan of houdini process
  dieWithParent = false;

  # houdini needs to communicate with hserver process that it seem to be checking to be present in running processes
  unsharePid = false;

  targetPkgs = pkgs: with pkgs; [
    libGLU
    libGL
    alsa-lib
    fontconfig
    zlib
    libpng
    dbus
    nss
    nspr
    expat
    pciutils
    libxkbcommon
    libudev0-shim
    tbb
    xwayland
    qt5.qtwayland
    nettools  # needed by licensing tools
    bintools  # needed for ld and other tools, so ctypes can find/load sos from python
    ocl-icd  # needed for opencl
    numactl  # needed by hfs ocl backend
    ncurses5  # needed by hfs ocl backend
  ] ++ (with xorg; [
    libICE
    libSM
    libXmu
    libXi
    libXt
    libXext
    libX11
    libXrender
    libXcursor
    libXfixes
    libXrender
    libXcomposite
    libXdamage
    libXtst
    libxcb
    libXScrnSaver
    libXrandr
    libxcb
    xcbutil
    xcbutilimage
    xcbutilrenderutil
    xcbutilcursor
    xcbutilkeysyms
    xcbutilwm
  ]);

  passthru = {
    inherit unwrapped;
  };

  extraInstallCommands = let
    executables = [
      "bin/houdini"  # houdini flavours
      "bin/houdinicore"
      "bin/houdinifx"
      "bin/hgpuinfo"  # houdini ocl config tool
      "bin/hotl"  # hda/otl manipulation tool
      "bin/hython"  # hython
      "bin/hkey"  # license administration
      "bin/husk"  # hydra rendereing tool
      "bin/mantra"  # mantra renderer
      "houdini/sbin/sesinetd"
    ];
  in ''
    WRAPPER=$out/bin/${name}
    EXECUTABLES="${lib.concatStringsSep " " executables}"
    for executable in $EXECUTABLES; do
      mkdir -p $out/$(dirname $executable)

      echo "#!${stdenv.shell}" >> $out/$executable
      echo "$WRAPPER ${unwrapped}/$executable \"\$@\"" >> $out/$executable
    done

    cd $out
    chmod +x $EXECUTABLES
  '';

  extraBwrapArgs = [
    "--ro-bind-try /run/opengl-driver/etc/OpenCL/vendors /etc/OpenCL/vendors"  # this is the case of NixOS
    "--ro-bind-try /etc/OpenCL/vendors /etc/OpenCL/vendors"  # this is the case of not NixOS
  ];

  runScript = writeScript "${name}-wrapper" ''
    exec "$@"
  '';
}