From b03032daff5208e522128d4a8643cd18fb5ebf4e Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sat, 27 Jul 2024 20:22:22 +0800 Subject: [PATCH] lib/env-specific/wrapper-manager: add plumbing for wrapping Blender --- lib/env-specific/wrapper-manager.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/env-specific/wrapper-manager.nix b/lib/env-specific/wrapper-manager.nix index 7b187ad4..4075077e 100644 --- a/lib/env-specific/wrapper-manager.nix +++ b/lib/env-specific/wrapper-manager.nix @@ -1,6 +1,6 @@ { pkgs, lib, self }: -{ +rec { /* 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. */ @@ -23,4 +23,21 @@ lndir -silent $resourcesPath $out 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" ]) + ]; }