nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 85 lines 2.6 kB view raw
1{ buildBazelPackage 2, fetchFromGitHub 3, git 4, go 5, python3 6, lib, stdenv 7}: 8 9let 10 patches = [ 11 ./use-go-in-path.patch 12 ]; 13in 14buildBazelPackage rec { 15 pname = "bazel-watcher"; 16 version = "0.14.0"; 17 18 src = fetchFromGitHub { 19 owner = "bazelbuild"; 20 repo = "bazel-watcher"; 21 rev = "v${version}"; 22 sha256 = "0gigl1lg8sb4bj5crvj54329ws4yirldbncs15f96db6vhp0ig7r"; 23 }; 24 25 nativeBuildInputs = [ go git python3 ]; 26 removeRulesCC = false; 27 28 bazelTarget = "//ibazel"; 29 30 fetchAttrs = { 31 inherit patches; 32 33 preBuild = '' 34 patchShebangs . 35 ''; 36 37 preInstall = '' 38 # Remove the go_sdk (it's just a copy of the go derivation) and all 39 # references to it from the marker files. Bazel does not need to download 40 # this sdk because we have patched the WORKSPACE file to point to the one 41 # currently present in PATH. Without removing the go_sdk from the marker 42 # file, the hash of it will change anytime the Go derivation changes and 43 # that would lead to impurities in the marker files which would result in 44 # a different sha256 for the fetch phase. 45 rm -rf $bazelOut/external/{go_sdk,\@go_sdk.marker} 46 sed -e '/^FILE:@go_sdk.*/d' -i $bazelOut/external/\@*.marker 47 48 # Retains go build input markers 49 chmod -R 755 $bazelOut/external/{bazel_gazelle_go_repository_cache,@\bazel_gazelle_go_repository_cache.marker} 50 rm -rf $bazelOut/external/{bazel_gazelle_go_repository_cache,@\bazel_gazelle_go_repository_cache.marker} 51 52 # Remove the gazelle tools, they contain go binaries that are built 53 # non-deterministically. As long as the gazelle version matches the tools 54 # should be equivalent. 55 rm -rf $bazelOut/external/{bazel_gazelle_go_repository_tools,\@bazel_gazelle_go_repository_tools.marker} 56 sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker 57 ''; 58 59 sha256 = "1j175z3d4fbi4pl35py7yjq7ywrvwin6id131jv32hx0ck4g1m46"; 60 }; 61 62 buildAttrs = { 63 inherit patches; 64 65 preBuild = '' 66 patchShebangs . 67 68 substituteInPlace ibazel/BUILD --replace '{STABLE_GIT_VERSION}' ${version} 69 ''; 70 71 installPhase = '' 72 install -Dm755 bazel-bin/ibazel/*_pure_stripped/ibazel $out/bin/ibazel 73 ''; 74 }; 75 76 meta = with lib; { 77 homepage = "https://github.com/bazelbuild/bazel-watcher"; 78 description = "Tools for building Bazel targets when source files change"; 79 license = licenses.asl20; 80 maintainers = with maintainers; [ kalbasit ]; 81 platforms = platforms.all; 82 # broken on darwin, see https://github.com/NixOS/nixpkgs/issues/105573 83 broken = stdenv.isDarwin; 84 }; 85}