depot/nix/pkgs/copybara.nix

37 lines
1 KiB
Nix

# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ pkgs, ... }:
pkgs.buildBazelPackage rec {
name = "copybara";
version = "master";
src = ../../third_party/copybara;
nativeBuildInputs = with pkgs; [ git mercurial jdk makeWrapper ];
bazelTarget = "//java/com/google/copybara:copybara_deploy.jar";
removeRulesCC = false;
fetchConfigured = true;
bazelFlags = [
"--javabase=@local_jdk//:jdk"
"--host_javabase=@local_jdk//:jdk"
];
fetchAttrs = {
sha256 = "0id7y01fqc6br28ccayx2z3nz75kf5gvgzh0k8701vp4g6dgd5ym";
preHook = ''
export COURSIER_CACHE="$(echo ''${NIX_BUILD_TOP}/tmp/coursier | sed -e 's,//,/,g')"
'';
};
buildAttrs = {
installPhase = ''
mkdir -p $out/bin $out/share/java
install -Dm755 bazel-bin/java/com/google/copybara/copybara_deploy.jar $out/share/java/copybara.jar
makeWrapper ${pkgs.jdk14_headless}/bin/java $out/bin/copybara \
--add-flags "-cp $out/share/java/copybara.jar com.google.copybara.Main"
'';
};
}