nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 142 lines 3.2 kB view raw
1{ 2 clangStdenv, 3 rustPlatform, 4 lib, 5 linkFarm, 6 fetchgit, 7 fetchFromGitHub, 8 runCommand, 9 alsa-lib, 10 brotli, 11 cmake, 12 expat, 13 fontconfig, 14 freetype, 15 gn, 16 harfbuzz, 17 icu, 18 libglvnd, 19 libjpeg, 20 libxkbcommon, 21 libX11, 22 libXcursor, 23 libXext, 24 libXi, 25 libXrandr, 26 makeWrapper, 27 ninja, 28 pkg-config, 29 python3, 30 removeReferencesTo, 31 wayland, 32 zlib, 33}: 34 35rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } rec { 36 pname = "chiptrack"; 37 version = "0.5"; 38 39 src = fetchFromGitHub { 40 owner = "jturcotte"; 41 repo = "chiptrack"; 42 tag = "v${version}"; 43 hash = "sha256-yQP5hFM5qBWdaF192PBvM4il6qpmlgUCeuwDCiw/LaQ="; 44 }; 45 46 strictDeps = true; 47 48 nativeBuildInputs = [ 49 rustPlatform.bindgenHook 50 cmake 51 makeWrapper 52 pkg-config 53 python3 54 removeReferencesTo 55 ]; 56 57 buildInputs = [ 58 expat 59 fontconfig 60 freetype 61 harfbuzz 62 icu 63 libjpeg 64 ] 65 ++ lib.optionals clangStdenv.hostPlatform.isLinux [ alsa-lib ]; 66 67 # Has git dependencies 68 69 cargoHash = "sha256-3LRyAY5NmXiJRrN+jwaUX65ArBCl8BiFoaWU2fVRMA8="; 70 71 env = { 72 SKIA_SOURCE_DIR = 73 let 74 repo = fetchFromGitHub { 75 owner = "rust-skia"; 76 repo = "skia"; 77 # see rust-skia:skia-bindings/Cargo.toml#package.metadata skia 78 tag = "m129-0.77.1"; 79 hash = "sha256-WRVuQpfRnYrE7KGFRFx66fXtMFmtJbC3xUcRPK1JoOM="; 80 }; 81 # The externals for skia are taken from skia/DEPS 82 # Reduced to only what's necessary 83 externals = linkFarm "skia-externals" ( 84 lib.mapAttrsToList (name: value: { 85 inherit name; 86 path = fetchgit value; 87 }) (lib.importJSON ./skia-externals.json) 88 ); 89 in 90 runCommand "source" { } '' 91 cp -R ${repo} $out 92 chmod -R +w $out 93 ln -s ${externals} $out/third_party/externals 94 ''; 95 SKIA_GN_COMMAND = lib.getExe gn; 96 SKIA_NINJA_COMMAND = lib.getExe ninja; 97 SKIA_USE_SYSTEM_LIBRARIES = "1"; 98 99 NIX_CFLAGS_COMPILE = "-I${lib.getDev harfbuzz}/include/harfbuzz"; 100 }; 101 102 # library skia embeds the path to its sources 103 postFixup = '' 104 remove-references-to -t "$SKIA_SOURCE_DIR" \ 105 $out/bin/chiptrack 106 107 wrapProgram $out/bin/chiptrack \ 108 --prefix LD_LIBRARY_PATH : ${ 109 lib.makeLibraryPath ( 110 [ 111 brotli 112 zlib 113 ] 114 ++ lib.optionals clangStdenv.hostPlatform.isLinux [ 115 libglvnd 116 libxkbcommon 117 libX11 118 libXcursor 119 libXext 120 libXrandr 121 libXi 122 wayland 123 ] 124 ) 125 } 126 ''; 127 128 disallowedReferences = [ env.SKIA_SOURCE_DIR ]; 129 130 meta = { 131 description = "Programmable cross-platform sequencer for the Game Boy Advance sound chip"; 132 homepage = "https://github.com/jturcotte/chiptrack"; 133 license = with lib.licenses; [ 134 mit # main 135 gpl3Only # GPL dependencies 136 ]; 137 mainProgram = "chiptrack"; 138 maintainers = with lib.maintainers; [ OPNA2608 ]; 139 # Various issues with wrong max macOS version & misparsed target conditional checks, can't figure out the magic combination for this 140 broken = clangStdenv.hostPlatform.isDarwin; 141 }; 142}