Skip to content
/ bits Public

Commit a51692d

Browse files
committed
Fix deps hash determinism by deleting Maven timestamp files
Maven writes ephemeral files (*.lastUpdated, resolver-status.properties, _remote.repositories) that contain timestamps, causing hash instability between builds. Delete these files to make the fixed-output derivation deterministic, matching the approach used by nixpkgs buildMavenPackage. Linux hashes set to lib.fakeHash - CI will report correct values.
1 parent af4b2a1 commit a51692d

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

.forgejo/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ concurrency:
1010
group: ${{ github.workflow }}-${{ github.ref }}
1111
cancel-in-progress: true
1212

13+
env:
14+
CI: true
15+
1316
jobs:
1417
lint:
1518
name: Lint
@@ -58,7 +61,7 @@ jobs:
5861
- name: Run tests
5962
env:
6063
DATABASE_URL: postgres://bits:please@127.0.0.1:5432/bits_test
61-
run: devenv test --quiet
64+
run: devenv test
6265

6366
build:
6467
name: Build ${{ matrix.arch }}
@@ -86,7 +89,7 @@ jobs:
8689
id: build
8790
run: |
8891
echo "Building ${{ matrix.output }}..."
89-
image_path=$(devenv build --quiet outputs.${{ matrix.output }})
92+
image_path=$(devenv build outputs.${{ matrix.output }})
9093
echo "image_path=$image_path" >> "$GITHUB_OUTPUT"
9194
echo "Built: $image_path"
9295

pkgs/bits-uberjar/default.nix

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828

2929
# Fixed-output derivation hash for deps, per platform.
3030
# To update: set your platform's hash to lib.fakeHash, build, copy from error.
31-
# Darwin hash is updated locally; Linux hashes from CI output.
31+
# Darwin hash updated locally; Linux hashes from CI output.
3232
depsHash =
3333
{
34-
"aarch64-darwin" = "sha256-eA8CEscn7qsgAtSwJ4ba5SfCN+yDnE+uFo+ucp7oZbo=";
35-
"aarch64-linux" = "sha256-XstFJyp7SZe+t4ctVAXI2VssF0O7LjPp6PPzW2gE1n8=";
36-
"x86_64-linux" = "sha256-azy37je1iTqryhhe/kluPpltVADTtF+BOFBNmEi73u4=";
34+
"aarch64-darwin" = "sha256-egkUQylaFsOWb1LO8FH143/1P6htR6Qvy/Xj4csO/cg=";
35+
"aarch64-linux" = lib.fakeHash;
36+
"x86_64-linux" = lib.fakeHash;
3737
}.${
3838
stdenv.hostPlatform.system
3939
};
@@ -105,6 +105,13 @@
105105
106106
if [ -d "$HOME/.m2/repository" ]; then
107107
cp -r $HOME/.m2/repository $out/m2
108+
109+
# Delete ephemeral Maven files with timestamps (makes hash deterministic)
110+
find $out/m2 -type f \( \
111+
-name \*.lastUpdated \
112+
-o -name resolver-status.properties \
113+
-o -name _remote.repositories \) \
114+
-delete
108115
fi
109116
110117
if [ -d "$HOME/.gitlibs" ]; then

0 commit comments

Comments
 (0)