blender: allow functional declaration within withPackages

Based on #257780, separated since it introduces significant changes.

bpycv: update passthru.tests.render

blender-with-packages: deprecated
it is still backwards compatible, but no longer preferred.
This commit is contained in:
the-furry-hubofeverything 2023-10-29 20:39:27 -07:00
parent bbb3129584
commit fe4c776ae9
6 changed files with 23 additions and 25 deletions

View File

@ -337,6 +337,8 @@
- The `services.mtr-exporter.target` has been removed in favor of `services.mtr-exporter.jobs` which allows specifying multiple targets.
- `blender-with-packages` has been deprecated in favor of `blender.withPackages`, for example `blender.withPackages (ps: [ps.bpycv])`. It behaves similarly to `python3.withPackages`.
- Setting `nixpkgs.config` options while providing an external `pkgs` instance will now raise an error instead of silently ignoring the options. NixOS modules no longer set `nixpkgs.config` to accomodate this. This specifically affects `services.locate`, `services.xserver.displayManager.lightdm.greeters.tiny` and `programs.firefox` NixOS modules. No manual intervention should be required in most cases, however, configurations relying on those modules affecting packages outside the system environment should switch to explicit overlays.
- `service.borgmatic.settings.location` and `services.borgmatic.configurations.<name>.location` are deprecated, please move your options out of sections to the global scope.

View File

@ -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" { } ''

View File

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

View File

@ -2,7 +2,6 @@
, lib
, beautifulsoup4
, blender
, blender-with-packages
, boxx
, bpycv
, buildPythonPackage
@ -52,13 +51,8 @@ buildPythonPackage rec {
hash = "sha256-dGb6KvbXTGTu5f4AqhA+i4AwTqBoR5SdXk0vsMEcD3Q=";
rev = "6ce0e65c107d572011394da16ffdf851e988dbb4";
};
nativeBuildInputs = [
((blender-with-packages.override {inherit blender python3Packages;}) {
packages = [ bpycv ];
})
];
} ''
blender-wrapped -b -P ${./bpycv-test.py}
${blender.withPackages (ps: [ps.bpycv])}/bin/blender-wrapped -b -P ${./bpycv-test.py}
'';
};

View File

@ -92,6 +92,9 @@ mapAliases ({
bird2 = bird; # Added 2022-02-21
bitwig-studio1 = throw "bitwig-studio1 has been removed, you can upgrade to 'bitwig-studio'"; # Added 2023-01-03
bitwig-studio2 = throw "bitwig-studio2 has been removed, you can upgrade to 'bitwig-studio'"; # Added 2023-01-03
blender-with-packages = args:
lib.warn "blender-with-packages is deprecated in favor of blender.withPackages, e.g. `blender.withPackages(ps: [ ps.foobar ])`"
(blender.withPackages (_: args.packages)).overrideAttrs (lib.optionalAttrs (args ? name) { pname = "blender-" + args.name; }); # Added 2023-10-30
bluezFull = throw "'bluezFull' has been renamed to/replaced by 'bluez'"; # Converted to throw 2023-09-10
boost168 = throw "boost168 has been deprecated in favor of the latest version"; # Added 2023-06-08
boost169 = throw "boost169 has been deprecated in favor of the latest version"; # Added 2023-06-08

View File

@ -30674,8 +30674,6 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) Cocoa CoreGraphics ForceFeedback OpenAL OpenGL;
};
blender-with-packages = callPackage ../applications/misc/blender/wrapper.nix { };
blender-hip = blender.override { hipSupport = true; };
blflash = callPackage ../tools/misc/blflash { };