about summary refs log tree commit diff
path: root/pkgs/applications/misc/blender/wrapper.nix
blob: 8b5e8916a138844464643be1c19b8d59ba26d7ef (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
{ stdenv
, blender
, makeWrapper
, extraModules ? []
}:
stdenv.mkDerivation (finalAttrs: {
  pname = blender.pname + "-wrapped";
  src = blender;

  inherit (blender) version meta;

  nativeBuildInputs = [ blender.pythonPackages.wrapPython makeWrapper ];
  installPhase = ''
    mkdir $out/{share/applications,bin} -p
    sed 's/Exec=blender/Exec=${finalAttrs.finalPackage.pname}/g' $src/share/applications/blender.desktop > $out/share/applications/${finalAttrs.finalPackage.pname}.desktop
    cp -r $src/share/blender $out/share
    cp -r $src/share/doc $out/share
    cp -r $src/share/icons $out/share

    buildPythonPath "$pythonPath"

    makeWrapper ${blender}/bin/blender $out/bin/${finalAttrs.finalPackage.pname} \
      --prefix PATH : $program_PATH \
      --prefix PYTHONPATH : $program_PYTHONPATH
  '';

  pythonPath = extraModules;
})