depot/third_party/nixpkgs/pkgs/applications/misc/blender/wrapper.nix
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

28 lines
848 B
Nix

{ 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;
})