lib/env-specific/wrapper-manager: add plumbing for wrapping Blender

This commit is contained in:
Gabriel Arazas 2024-07-27 20:22:22 +08:00
parent 53cd1864df
commit b03032daff
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360

View File

@ -1,6 +1,6 @@
{ pkgs, lib, self }: { pkgs, lib, self }:
{ rec {
/* Given a Blender package and its addons to be wrapped, create a derivation /* Given a Blender package and its addons to be wrapped, create a derivation
containing all of the addons properly placed as a system resource folder. containing all of the addons properly placed as a system resource folder.
*/ */
@ -23,4 +23,21 @@
lndir -silent $resourcesPath $out lndir -silent $resourcesPath $out
done done
''; '';
makeBlenderWrapper = module@{ blenderPackage, blenderArgs ? [ ] , addons ? [ ], ... }:
let
blenderAddons = wrapBlenderAddons { inherit blenderPackage addons; };
in
lib.mkMerge [
{
arg0 = lib.getExe' blenderPackage "blender";
prependArgs = lib.mkBefore blenderArgs;
}
(lib.mkIf (builtins.length addons > 0) {
env.BLENDER_SYSTEM_RESOURCES = blenderAddons;
})
(lib.removeAttrs module [ "blenderPackage" "blenderArgs" "addons" ])
];
} }