From 7bde39a3a7a8999292d5c38a2a6ed516a7231797 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 10 Jul 2024 15:50:31 +0800 Subject: [PATCH] lib: initialize env-specific subset for wrapper-manager-fds --- lib/env-specific/wrapper-manager.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/env-specific/wrapper-manager.nix diff --git a/lib/env-specific/wrapper-manager.nix b/lib/env-specific/wrapper-manager.nix new file mode 100644 index 00000000..7b187ad4 --- /dev/null +++ b/lib/env-specific/wrapper-manager.nix @@ -0,0 +1,26 @@ +{ pkgs, lib, self }: + +{ + /* 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. + */ + wrapBlenderAddons = { blenderPackage, addons }: + let + blenderVersion = lib.versions.majorMinor blenderPackage.version; + in + pkgs.runCommand "blender-system-resources" + { + passAsFile = [ "paths" ]; + paths = addons ++ [ blenderPackage ]; + nativeBuildInputs = with pkgs; [ outils ]; + } '' + mkdir -p $out + for i in $(cat $pathsPath); do + resourcesPath="$i/share/blender" + if [ -d $i/share/blender/${blenderVersion} ]; then + resourcesPath="$i/share/blender/${blenderVersion}"; + fi + lndir -silent $resourcesPath $out + done + ''; +}