From f8125da68d3dec043198acf156cc8ffe901b4194 Mon Sep 17 00:00:00 2001 From: Benjamin Moosherr Date: Tue, 3 Jun 2025 16:49:05 +0200 Subject: [PATCH 1/3] feat(nix): Invalidate the maven cache when pom.xml changes Credits for this approach go to Peter Kolloch. See his blog entry about this idea: https://blog.eigenvalue.net/nix-rerunning-fixed-output-derivations/ --- default.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 182886b9c..f1430815d 100644 --- a/default.nix +++ b/default.nix @@ -57,10 +57,22 @@ pkgs.stdenvNoCC.mkDerivation rec { # Maven needs to download necessary dependencies which is impure because it # requires network access. Hence, we download all dependencies as a # fixed-output derivation. This also serves as a nice cache. + # + # We use the hash of the input files to invalidate the maven cache whenever + # the input files change. This is purely for easing maintenance. In case a + # maintainer forgets (or simply doesn't know) to change the output hash to + # force a rebuild (and obtain the new, correct hash) this usually (without + # this naming hack) result in use of a stall cash, essentially behaving like + # an unreproducable derivation where a second build results in a different + # output. By changing the name of the fixed output derivation whenever + # `mavenRepoSrc` changes, we prevent this stall cache as the resulting store + # path will never exist (except when the cache is valid). + mavenRepoSrc = pkgs.lib.sourceByRegex ./. ["^pom.xml$" "^local-maven-repo(/.*)?$"]; + mavenRepoSrcName = with pkgs.lib; last (splitString "/" mavenRepoSrc.outPath); mavenRepo = pkgs.stdenv.mkDerivation { - pname = "${pname}-mavenRepo"; + pname = "${pname}-mavenRepo-${mavenRepoSrcName}"; inherit version; - src = pkgs.lib.sourceByRegex ./. ["^pom.xml$" "^local-maven-repo(/.*)?$"]; + src = mavenRepoSrc; nativeBuildInputs = [pkgs.maven]; From a2ccec29649f21c4296799de3ad73101c782e294 Mon Sep 17 00:00:00 2001 From: Benjamin Moosherr Date: Wed, 4 Jun 2025 14:45:15 +0200 Subject: [PATCH 2/3] chore(deps): Enforce Maven version 3.6.3 or later During the update of dependencies, Maven advised to do this. Version 3.6.3 of Maven is technically already "end of life" but, "currently, plugins provide Maven API compatibility down to 3.6.3" (https://maven.apache.org/docs/history.html 205-06-04) so we do this too. Note that we do not currently have any requirement to use any later version so this is totally fine. --- pom.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pom.xml b/pom.xml index 6c623cad4..869e024c9 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,27 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-maven + + enforce + + + + + 3.6.3 + + + + + + + org.apache.maven.plugins maven-javadoc-plugin From afd65e1d9079b9d1ea698c9ffb9e3322914e10c5 Mon Sep 17 00:00:00 2001 From: Benjamin Moosherr Date: Wed, 4 Jun 2025 15:24:57 +0200 Subject: [PATCH 3/3] chore(deps): Update nixpkgs and all Maven dependencies --- default.nix | 2 +- nix/sources.json | 8 ++++---- pom.xml | 38 +++++++++++++++++++------------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/default.nix b/default.nix index f1430815d..b1988548e 100644 --- a/default.nix +++ b/default.nix @@ -26,7 +26,7 @@ }, doCheck ? true, buildGitHubPages ? true, - dependenciesHash ? "sha256-LJQfV426han/+H9ejUla7JvN1LS/c9l3e7hODs4Z7Kg=", + dependenciesHash ? "sha256-OdagSk6jYCkkw/kPoOJlma9yEK7hMBcNkuxE6qt0ra8=", }: pkgs.stdenvNoCC.mkDerivation rec { pname = "DiffDetective"; diff --git a/nix/sources.json b/nix/sources.json index 94a365575..d65a61165 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,14 +1,14 @@ { "nixpkgs": { - "branch": "nixos-23.11", + "branch": "nixos-25.05", "description": "Nix Packages collection", "homepage": null, "owner": "NixOS", "repo": "nixpkgs", - "rev": "6832d0d99649db3d65a0e15fa51471537b2c56a6", - "sha256": "1ww2vrgn8xrznssbd05hdlr3d4br6wbjlqprys1al8ahxkyl5syi", + "rev": "10d7f8d34e5eb9c0f9a0485186c1ca691d2c5922", + "sha256": "16ag6ac2szq60bm17cdj5ybg46gkvffkmq6a34wpx38v28r25ghx", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/6832d0d99649db3d65a0e15fa51471537b2c56a6.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/10d7f8d34e5eb9c0f9a0485186c1ca691d2c5922.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/pom.xml b/pom.xml index 869e024c9..7a03c05fd 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.1 + 3.11.2 docs javadoc @@ -55,13 +55,13 @@ org.apache.maven.plugins maven-compiler-plugin - 3.10.1 + 3.14.0 org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M8 + 3.5.3 **/*.java @@ -73,7 +73,7 @@ org.apache.maven.plugins maven-assembly-plugin - 3.4.2 + 3.7.1 package @@ -92,7 +92,7 @@ org.antlr antlr4-maven-plugin - 4.13.1 + 4.13.2 @@ -146,7 +146,7 @@ org.atteo.classindex classindex - 3.11 + 3.13 test @@ -159,60 +159,60 @@ org.eclipse.jgit org.eclipse.jgit - 6.7.0.202309050840-r + 7.2.1.202505142326-r org.apache.commons commons-lang3 - 3.12.0 + 3.17.0 commons-io commons-io - 2.14.0 + 2.19.0 org.tinylog tinylog-api - 2.6.1 + 2.7.0 org.tinylog tinylog-impl - 2.6.1 + 2.7.0 org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.14.0 org.junit.jupiter junit-jupiter-engine - 5.9.2 + 5.13.0 test org.junit.jupiter junit-jupiter - 5.9.2 + 5.13.0 test org.junit.platform junit-platform-launcher - 1.9.2 + 1.13.0 test org.apache.maven.surefire surefire-junit-platform - 3.0.0-M8 + 3.5.3 test @@ -220,20 +220,20 @@ org.slf4j slf4j-api - 2.0.5 + 2.0.17 org.slf4j slf4j-simple - 2.0.5 + 2.0.17 org.antlr antlr4 - 4.13.1 + 4.13.2