Skip to content

Commit c6994b3

Browse files
committed
chore: Test 'bazel vendor' Nix outputHash stability (re. #1875)
1 parent 34106f0 commit c6994b3

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

flake.nix

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,45 @@
8787
# $ nix build .#enola
8888
# $ result/bin/enola --help
8989
default = enola;
90+
# Testing https://github.com/enola-dev/enola/issues/1875 ...
91+
bazel-vendor-dir = pkgs.stdenv.mkDerivation {
92+
pname = "bazel-vendor-dir";
93+
version = gitRev;
94+
95+
nativeBuildInputs = [
96+
pkgs.bazel_8
97+
pkgs.protobuf
98+
pkgs.protoc-gen-grpc-java
99+
pkgs.which
100+
jdk'
101+
];
102+
src = ./.;
103+
buildPhase = ''
104+
runHook preBuild
105+
106+
bash tools/protoc/protoc.bash
107+
mkdir VENDOR
108+
#export HOME=/build/home
109+
#mkdir -p $HOME
110+
bazel vendor --vendor_dir=VENDOR //...
111+
112+
runHook postBuild
113+
'';
114+
installPhase = ''
115+
runHook preInstall
116+
117+
tar czvf $out \
118+
--sort=name \
119+
--mtime='UTC 2080-02-01' \
120+
--owner=0 \
121+
--group=0 \
122+
--numeric-owner VENDOR
123+
124+
runHook postInstall
125+
'';
126+
# outputHash = pkgs.lib.fakeHash;
127+
outputHash = "sha256-kkEI1w0CNPYhzx516DAkiu1+enRSYkDA/xe0Mn33zMA=";
128+
};
90129
enola = pkgs.stdenv.mkDerivation {
91130
pname = "enola";
92131
version = gitRev;
@@ -100,6 +139,9 @@
100139
src = ./.;
101140

102141
buildPhase = ''
142+
# This currently only serves to force a dependency to above
143+
ls -al ${bazel-vendor-dir}
144+
103145
# class dev.enola.common.Version reads VERSION
104146
echo -n "${gitRev}" >tools/version/VERSION
105147

0 commit comments

Comments
 (0)