diff options
Diffstat (limited to 'nixpkgs/pkgs/development/tools/build-managers/buck')
-rw-r--r-- | nixpkgs/pkgs/development/tools/build-managers/buck/default.nix | 44 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/tools/build-managers/buck/pex-mtime.patch | 13 |
2 files changed, 57 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/build-managers/buck/default.nix b/nixpkgs/pkgs/development/tools/build-managers/buck/default.nix new file mode 100644 index 000000000000..1602b8083414 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/buck/default.nix @@ -0,0 +1,44 @@ +{ lib, stdenv, fetchFromGitHub, jdk8, ant, python3, watchman, bash, makeWrapper }: + +stdenv.mkDerivation rec { + pname = "buck"; + version = "2021.05.05.01"; + + src = fetchFromGitHub { + owner = "facebook"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-mASJCLxW7320MXYUUWYfaxs9AbSdltxlae8OQsPUZJc="; + }; + + patches = [ ./pex-mtime.patch ]; + + postPatch = '' + grep -l -r '/bin/bash' --null | xargs -0 sed -i -e "s!/bin/bash!${bash}/bin/bash!g" + ''; + + nativeBuildInputs = [ makeWrapper python3 jdk8 ant watchman ]; + + buildPhase = '' + # Set correct version, see https://github.com/facebook/buck/issues/2607 + echo v${version} > .buckrelease + + ant + + PYTHONDONTWRITEBYTECODE=true ./bin/buck build -c buck.release_version=${version} buck + ''; + + installPhase = '' + install -D -m755 buck-out/gen/*/programs/buck.pex $out/bin/buck + wrapProgram $out/bin/buck \ + --prefix PATH : "${lib.makeBinPath [ jdk8 watchman python3 ]}" + ''; + + meta = with lib; { + homepage = "https://buck.build/"; + description = "A high-performance build tool"; + maintainers = [ maintainers.jgertm maintainers.marsam ]; + license = licenses.asl20; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/tools/build-managers/buck/pex-mtime.patch b/nixpkgs/pkgs/development/tools/build-managers/buck/pex-mtime.patch new file mode 100644 index 000000000000..b8726e64a604 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/buck/pex-mtime.patch @@ -0,0 +1,13 @@ +diff --git a/third-party/py/pex/pex/common.py b/third-party/py/pex/pex/common.py +index 76459ce23..eff411b20 100644 +--- a/third-party/py/pex/pex/common.py ++++ b/third-party/py/pex/pex/common.py +@@ -328,4 +328,7 @@ class Chroot(object): + def zip(self, filename, mode='wb'): + with contextlib.closing(zipfile.ZipFile(filename, mode)) as zf: + for f in sorted(self.files()): +- zf.write(os.path.join(self.chroot, f), arcname=f, compress_type=zipfile.ZIP_DEFLATED) ++ path = os.path.join(self.chroot, f) ++ instant = 615532801 ++ os.utime(path, (instant, instant)) ++ zf.write(path, arcname=f, compress_type=zipfile.ZIP_DEFLATED) |