at master 1.5 kB view raw
1{ 2 stdenv, 3 fetchFromGitHub, 4 lib, 5 subproject ? "library", # one of "library", "reader" or "writer" 6 zlib, 7 libpng, 8 libtiff, 9 jabcode, 10}: 11let 12 subdir = lib.getAttr subproject { 13 "library" = "jabcode"; 14 "reader" = "jabcodeReader"; 15 "writer" = "jabcodeWriter"; 16 }; 17in 18stdenv.mkDerivation { 19 pname = "jabcode-${subproject}"; 20 version = "unstable-2022-06-17"; 21 src = fetchFromGitHub { 22 repo = "jabcode"; 23 owner = "jabcode"; 24 rev = "ee0e4c88b9f3c1da46d6f679ee8b69c547907c20"; 25 hash = "sha256-GjRkDWefQFdT4i9hRcQhYsY4beMUIXxy38I5lsQytyA="; 26 }; 27 28 nativeBuildInputs = [ 29 zlib 30 libpng 31 libtiff 32 ] 33 ++ lib.optionals (subproject != "library") [ jabcode ]; 34 35 preConfigure = "cd src/${subdir}"; 36 37 installPhase = 38 if subproject == "library" then 39 '' 40 mkdir -p $out/lib 41 cp build/* $out/lib 42 '' 43 else 44 '' 45 mkdir -p $out/bin 46 cp -RT bin $out/bin 47 ''; 48 49 meta = with lib; { 50 description = "High-capacity 2D color bar code (${subproject})"; 51 longDescription = "JAB Code (Just Another Bar Code) is a high-capacity 2D color bar code, which can encode more data than traditional black/white (QR) codes. This is the ${subproject} part."; 52 homepage = "https://jabcode.org/"; 53 license = licenses.lgpl21; 54 maintainers = [ maintainers.xaverdh ]; 55 platforms = platforms.unix; 56 broken = stdenv.hostPlatform.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/jabcode.x86_64-darwin 57 }; 58}