depot/nix/pkgs/copybara.nix

41 lines
1.1 KiB
Nix
Raw Normal View History

# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
2020-05-16 15:37:45 +00:00
{ pkgs, ... }:
2021-04-18 13:54:14 +00:00
let
jdk = pkgs.openjdk11_headless;
in
2020-05-16 15:37:45 +00:00
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;
2020-05-16 15:37:45 +00:00
bazelFlags = [
"--javabase=@local_jdk//:jdk"
"--host_javabase=@local_jdk//:jdk"
];
fetchAttrs = {
2021-02-07 22:51:09 +00:00
sha256 = "sha256:195av0bvgqgs7wwzx14yrrww582ijadvjdx82hx4911lp4jlbg8d";
2020-05-16 15:37:45 +00:00
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
2021-04-18 13:54:14 +00:00
makeWrapper ${pkgs.jdk}/bin/java $out/bin/copybara \
2020-05-16 15:37:45 +00:00
--add-flags "-cp $out/share/java/copybara.jar com.google.copybara.Main"
'';
};
}