nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchFromGitHub, jdk8, ant, python3, watchman, bash, makeWrapper }:
2
3stdenv.mkDerivation rec {
4 pname = "buck";
5 version = "2022.05.05.01";
6
7 src = fetchFromGitHub {
8 owner = "facebook";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "15v4sk1l43pgd5jxr5lxnh0ks6vb3xk5253n66s7vvsnph48j14q";
12 };
13
14 patches = [ ./pex-mtime.patch ];
15
16 postPatch = ''
17 grep -l -r '/bin/bash' --null | xargs -0 sed -i -e "s!/bin/bash!${bash}/bin/bash!g"
18 '';
19
20 nativeBuildInputs = [ makeWrapper python3 jdk8 ant watchman ];
21
22 buildPhase = ''
23 # Set correct version, see https://github.com/facebook/buck/issues/2607
24 echo v${version} > .buckrelease
25
26 ant
27
28 PYTHONDONTWRITEBYTECODE=true ./bin/buck build -c buck.release_version=${version} buck
29 '';
30
31 installPhase = ''
32 install -D -m755 buck-out/gen/*/programs/buck.pex $out/bin/buck
33 wrapProgram $out/bin/buck \
34 --prefix PATH : "${lib.makeBinPath [ jdk8 watchman python3 ]}"
35 '';
36
37 meta = with lib; {
38 homepage = "https://buck.build/";
39 description = "A high-performance build tool";
40 maintainers = [ maintainers.jgertm maintainers.marsam ];
41 license = licenses.asl20;
42 platforms = platforms.all;
43 # https://github.com/facebook/buck/issues/2666
44 broken = stdenv.isDarwin && stdenv.isAarch64;
45 };
46}