nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 142 lines 3.9 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 buildDotnetModule, 6 dotnetCorePackages, 7 xz, 8 pcre, 9 autoPatchelfHook, 10 bintools, 11 fixDarwinDylibNames, 12 darwin, 13 fontconfig, 14 libgdiplus, 15 libXrandr, 16 glib, 17 writeShellScriptBin, 18 blender, 19 openssl, 20 libkrb5, 21 icu, 22}: 23let 24 25 # blendfarm (client) will run from the current workdir. 26 # It needs to create files there, so it cannot be in the nix store. 27 # We also need to create some files there so it can work with its 28 # server part. 29 USERHOMEDIR = "~/.local/share/blendfarm"; 30 blendfarm-nix = writeShellScriptBin "blendfarm-nix" '' 31 if [[ -z $BLENDFARM_HOME && ! -d ${USERHOMEDIR} ]]; then 32 echo "Creating home for blendfarm at ${USERHOMEDIR}" 33 echo "You can change that by setting BLENDFARM_HOME to another directory" 34 fi 35 if [[ -z $BLENDFARM_HOME ]]; then 36 BLENDFARM_HOME=${USERHOMEDIR} 37 fi 38 mkdir -p $BLENDFARM_HOME/BlenderData/nix-blender-linux64 > /dev/null 2>&1 39 ln -s ${lib.getExe blender} $BLENDFARM_HOME/BlenderData/nix-blender-linux64/blender > /dev/null 2>&1 40 echo "nix-blender" > $BLENDFARM_HOME/VersionCustom 41 cd $BLENDFARM_HOME 42 exec -a "$0" @out@/bin/LogicReinc.BlendFarm "$@" 43 ''; 44in 45 46buildDotnetModule rec { 47 pname = "blendfarm"; 48 version = "1.1.6"; 49 50 src = fetchFromGitHub { 51 owner = "LogicReinc"; 52 repo = "LogicReinc.BlendFarm"; 53 rev = "v${version}"; 54 hash = "sha256-2w2tdl5n0IFTuthY97NYMeyRe2r72jaKFfoNSjWQMM4="; 55 }; 56 57 patches = [ 58 # https://github.com/LogicReinc/LogicReinc.BlendFarm/pull/121 59 ./fix-nixos-crashing-on-runtime.patch 60 # https://github.com/LogicReinc/LogicReinc.BlendFarm/pull/122 61 ./rename-evee-to-eevee_next.patch 62 # Fixes the error with net8 update: 63 # "The referenced project is a non self-contained executable. 64 # A non self-contained executable cannot be referenced by a self-contained executable" 65 ./fix-references.patch 66 # Update project files to net8 67 ./net8.patch 68 ]; 69 70 nativeBuildInputs = 71 [ ] 72 ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ] 73 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 74 bintools 75 fixDarwinDylibNames 76 darwin.autoSignDarwinBinariesHook 77 ]; 78 79 buildInputs = [ 80 (lib.getLib stdenv.cc.cc) 81 fontconfig 82 openssl 83 libkrb5 84 icu 85 ]; 86 87 runtimeDeps = [ 88 xz 89 pcre 90 libgdiplus 91 glib 92 libXrandr 93 ] 94 ++ lib.optionals stdenv.hostPlatform.isLinux [ blender ]; 95 96 # there is no "*.so.3" or "*.so.5" in nixpkgs. So ignore the warning 97 # and add it later 98 autoPatchelfIgnoreMissingDeps = [ 99 "libpcre.so.3" 100 "liblzma.so.5" 101 ]; 102 103 dotnet-sdk = dotnetCorePackages.sdk_8_0; 104 dotnet-runtime = dotnetCorePackages.runtime_8_0; 105 106 projectFile = [ 107 "LogicReinc.BlendFarm.Client/LogicReinc.BlendFarm.Client.csproj" 108 "LogicReinc.BlendFarm.Server/LogicReinc.BlendFarm.Server.csproj" 109 "LogicReinc.BlendFarm/LogicReinc.BlendFarm.csproj" 110 ]; 111 nugetDeps = ./deps.json; 112 executables = [ 113 "LogicReinc.BlendFarm" 114 "LogicReinc.BlendFarm.Server" 115 ]; 116 117 # add libraries not found by autopatchelf 118 libPath = lib.makeLibraryPath [ 119 pcre 120 xz 121 ]; 122 makeWrapperArgs = [ "--prefix LD_LIBRARY_PATH : ${libPath}" ]; 123 124 postInstall = 125 lib.optionalString stdenv.hostPlatform.isLinux '' 126 mkdir -p $out/bin 127 cp -v ${blendfarm-nix}/bin/blendfarm-nix $out/bin 128 substituteInPlace $out/bin/blendfarm-nix --subst-var out 129 '' 130 + lib.optionalString stdenv.hostPlatform.isDarwin '' 131 ln -s ${libgdiplus}/lib/libgdiplus.dylib $out/lib/blendfarm/ 132 ''; 133 134 meta = with lib; { 135 description = "Open-source, cross-platform, stand-alone, Network Renderer for Blender"; 136 homepage = "https://github.com/LogicReinc/LogicReinc.BlendFarm"; 137 license = with licenses; [ gpl3Plus ]; 138 maintainers = with maintainers; [ gador ]; 139 mainProgram = "blendfarm-nix"; 140 platforms = platforms.unix; 141 }; 142}