File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,10 +57,22 @@ pkgs.stdenvNoCC.mkDerivation rec {
5757 # Maven needs to download necessary dependencies which is impure because it
5858 # requires network access. Hence, we download all dependencies as a
5959 # fixed-output derivation. This also serves as a nice cache.
60+ #
61+ # We use the hash of the input files to invalidate the maven cache whenever
62+ # the input files change. This is purely for easing maintenance. In case a
63+ # maintainer forgets (or simply doesn't know) to change the output hash to
64+ # force a rebuild (and obtain the new, correct hash) this usually (without
65+ # this naming hack) result in use of a stall cash, essentially behaving like
66+ # an unreproducable derivation where a second build results in a different
67+ # output. By changing the name of the fixed output derivation whenever
68+ # `mavenRepoSrc` changes, we prevent this stall cache as the resulting store
69+ # path will never exist (except when the cache is valid).
70+ mavenRepoSrc = pkgs . lib . sourceByRegex ./. [ "^pom.xml$" "^local-maven-repo(/.*)?$" ] ;
71+ mavenRepoSrcName = with pkgs . lib ; last ( splitString "/" mavenRepoSrc . outPath ) ;
6072 mavenRepo = pkgs . stdenv . mkDerivation {
61- pname = "${ pname } -mavenRepo" ;
73+ pname = "${ pname } -mavenRepo- ${ mavenRepoSrcName } " ;
6274 inherit version ;
63- src = pkgs . lib . sourceByRegex ./. [ "^pom.xml$" "^local-maven-repo(/.*)?$" ] ;
75+ src = mavenRepoSrc ;
6476
6577 nativeBuildInputs = [ pkgs . maven ] ;
6678
You can’t perform that action at this time.
0 commit comments