From dcd11dec495b144df86019df66316b64fbb64504 Mon Sep 17 00:00:00 2001 From: NullBite Date: Mon, 1 Apr 2024 15:15:13 -0400 Subject: [PATCH] Fix prismlauncher rebuilding on every update Retreiving the hook from nixpkgs-unstable causes the derivation to change since the store path of nixpkgs-unstable changes --- overlays/backports.nix | 2 +- overlays/strip-java-archives.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 overlays/strip-java-archives.sh diff --git a/overlays/backports.nix b/overlays/backports.nix index 036f4fd..0175948 100644 --- a/overlays/backports.nix +++ b/overlays/backports.nix @@ -25,7 +25,7 @@ let stripJavaArchivesHook = final.makeSetupHook { name = "strip-java-archives-hook"; propagatedBuildInputs = [ final.strip-nondeterminism ]; - } "${nixfiles.inputs.nixpkgs-unstable}/pkgs/build-support/setup-hooks/strip-java-archives.sh"; + } ./strip-java-archives.sh; in { vesktop = backport' "vesktop"; diff --git a/overlays/strip-java-archives.sh b/overlays/strip-java-archives.sh new file mode 100644 index 0000000..2232246 --- /dev/null +++ b/overlays/strip-java-archives.sh @@ -0,0 +1,16 @@ +# This setup hook makes the fixup phase to repack all java archives in a +# deterministic fashion. The most important change being done is the resetting +# of the modification times of the archive entries + +fixupOutputHooks+=('stripJavaArchivesIn $prefix') + +stripJavaArchivesIn() { + local dir="$1" + echo "stripping java archives in $dir" + find $dir -type f -regextype posix-egrep -regex ".*\.(jar|war|hpi|apk)$" -print0 | + while IFS= read -rd '' f; do + echo "stripping java archive $f" + strip-nondeterminism --type jar "$f" + done +} +