nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 136 lines 3.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 6 cmake, 7 pkg-config, 8 ninja, 9 python3, 10 makeWrapper, 11 12 backward-cpp, 13 curl, 14 enet, 15 freetype, 16 glm, 17 gtest, 18 libbfd, 19 libdwarf, 20 libjpeg, 21 libuuid, 22 libuv, 23 libX11, 24 lua5_4, 25 lzfse, 26 opencl-headers, 27 SDL2, 28 SDL2_mixer, 29 wayland-protocols, 30 31 callPackage, 32 nixosTests, 33}: 34 35stdenv.mkDerivation (finalAttrs: { 36 pname = "vengi-tools"; 37 version = "0.0.38"; 38 39 src = fetchFromGitHub { 40 owner = "vengi-voxel"; 41 repo = "vengi"; 42 rev = "v${finalAttrs.version}"; 43 hash = "sha256-TTbwoZt5+tkxuoC05sbgrwIRmyWIR272D4TZWYXyPjA="; 44 }; 45 46 prePatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 47 # Disable code signing on macOS 48 substituteInPlace cmake/macros.cmake --replace-fail "codesign" "true" 49 substituteInPlace cmake/system/apple.cmake --replace-fail "if(APPLE)" "if(false)" 50 51 # calls otool -L on /usr/lib/libSystem.B.dylib and fails because it doesn't exist 52 substituteInPlace cmake/applebundle.cmake --replace-fail 'fixup_bundle("''${TARGET_BUNDLE_DIR}" "" "")' "" 53 ''; 54 55 nativeBuildInputs = [ 56 cmake 57 pkg-config 58 ninja 59 python3 60 makeWrapper 61 ]; 62 63 buildInputs = [ 64 libbfd 65 libdwarf 66 backward-cpp 67 curl 68 enet 69 freetype 70 glm 71 libjpeg 72 libuuid 73 libuv 74 lua5_4 75 lzfse 76 SDL2 77 libX11 78 SDL2_mixer 79 ] 80 ++ lib.optional stdenv.hostPlatform.isLinux wayland-protocols 81 ++ lib.optional (!stdenv.hostPlatform.isDarwin) opencl-headers; 82 83 # error: "The plain signature for target_link_libraries has already been used" 84 doCheck = false; 85 86 checkInputs = [ 87 gtest 88 ]; 89 90 postInstall = 91 if stdenv.hostPlatform.isDarwin then 92 '' 93 mkdir -p $out/Applications 94 mv $out/*.app $out/Applications/ 95 96 mkdir -p $out/bin 97 ln -s $out/Applications/vengi-voxconvert.app/Contents/MacOS/vengi-voxconvert $out/bin/vengi-voxconvert 98 '' 99 else 100 # Set the data directory for each executable. We cannot set it at build time 101 # with the PKGDATADIR cmake variable because each executable needs a specific 102 # one. 103 # This is not needed on darwin, since on that platform data files are saved 104 # in *.app/Contents/Resources/ too, and are picked up automatically. 105 '' 106 for prog in $out/bin/*; do 107 wrapProgram "$prog" \ 108 --set CORE_PATH $out/share/$(basename "$prog")/ 109 done 110 ''; 111 112 passthru.tests = { 113 voxconvert-roundtrip = callPackage ./test-voxconvert-roundtrip.nix { }; 114 voxconvert-all-formats = callPackage ./test-voxconvert-all-formats.nix { }; 115 run-voxedit = nixosTests.vengi-tools; 116 }; 117 118 meta = with lib; { 119 description = "Tools from the vengi voxel engine, including a thumbnailer, a converter, and the VoxEdit voxel editor"; 120 longDescription = '' 121 Tools from the vengi C++ voxel game engine. It includes a voxel editor 122 with character animation support and loading/saving into a lot of voxel 123 volume formats. There are other tools like e.g. a thumbnailer for your 124 filemanager and a command line tool to convert between several voxel 125 formats. 126 ''; 127 homepage = "https://vengi-voxel.github.io/vengi/"; 128 downloadPage = "https://github.com/vengi-voxel/vengi/releases"; 129 license = [ 130 licenses.mit 131 licenses.cc-by-sa-30 132 ]; 133 maintainers = with maintainers; [ fgaz ]; 134 platforms = platforms.all; 135 }; 136})