lib: initialize env-specific subset for wrapper-manager-fds

This commit is contained in:
Gabriel Arazas 2024-07-10 15:50:31 +08:00
parent 6c2974e2c8
commit 7bde39a3a7
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360

View File

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