diff options
Diffstat (limited to 'pkgs/applications')
-rw-r--r-- | pkgs/applications/misc/blender/default.nix | 9 | ||||
-rw-r--r-- | pkgs/applications/misc/blender/wrapper.nix | 24 |
2 files changed, 17 insertions, 16 deletions
diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index 8e7fde6d9c299..7a6db59bf66dc 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -18,10 +18,13 @@ , openpgl , mesa , runCommand +, callPackage }: let - python = python310Packages.python; + pythonPackages = python310Packages; + inherit (pythonPackages) python; + buildEnv = callPackage ./wrapper.nix {}; optix = fetchzip { # url taken from the archlinux blender PKGBUILD url = "https://developer.download.nvidia.com/redist/optix/v7.3/OptiX-7.3.0-Include.zip"; @@ -189,7 +192,9 @@ stdenv.mkDerivation (finalAttrs: rec { ''; passthru = { - inherit python; + inherit python pythonPackages; + + withPackages = f: let packages = f pythonPackages; in buildEnv.override { blender = finalAttrs.finalPackage; extraModules = packages; }; tests = { render = runCommand "${pname}-test" { } '' diff --git a/pkgs/applications/misc/blender/wrapper.nix b/pkgs/applications/misc/blender/wrapper.nix index 3828d61a8645c..7450827a8fa92 100644 --- a/pkgs/applications/misc/blender/wrapper.nix +++ b/pkgs/applications/misc/blender/wrapper.nix @@ -2,32 +2,28 @@ , lib , blender , makeWrapper -, python3Packages +, extraModules ? [] }: -{ name ? "wrapped" -, packages ? [] -}: -stdenv.mkDerivation { - pname = "blender-${name}"; - inherit (blender) version; +stdenv.mkDerivation (finalAttrs: { + pname = blender.pname + "-wrapped"; src = blender; - nativeBuildInputs = [ python3Packages.wrapPython makeWrapper ]; + inherit (blender) version meta; + + nativeBuildInputs = [ blender.pythonPackages.wrapPython makeWrapper ]; installPhase = '' mkdir $out/{share/applications,bin} -p - sed 's/Exec=blender/Exec=blender-${name}/g' $src/share/applications/blender.desktop > $out/share/applications/blender-${name}.desktop + 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/blender-${name} \ + makeWrapper ${blender}/bin/blender $out/bin/${finalAttrs.finalPackage.pname} \ --prefix PATH : $program_PATH \ --prefix PYTHONPATH : $program_PYTHONPATH ''; - pythonPath = packages; - - meta = blender.meta; -} + pythonPath = extraModules; +}) |