~aasg/nixexprs

c57863c262a5d094c10678d703b409f3d8e2cf6f — Aluísio Augusto Silva Gonçalves 4 months ago 5550f58
aasg-brotlify: Decouple from installPhase

Move the hook to a custom phase to avoid requiring `installPhase`
to be run, as I suspect that websites don't get installed much.
1 files changed, 10 insertions(+), 3 deletions(-)

M pkgs/build-support/aasg-brotlify/setup-hook.sh
M pkgs/build-support/aasg-brotlify/setup-hook.sh => pkgs/build-support/aasg-brotlify/setup-hook.sh +10 -3
@@ 1,6 1,13 @@
postInstallHooks+=(aasg-brotlify)
# Setup hook to compress files in $out with Brotli while keeping the
# originals.
#
# To disable this setup hook, set `dontBrotlify`.

aasg-brotlify() {
	if [[ -n "${dontBrotlify:-}" ]]; then return; fi
aasgBrotlifyPhase() {
	echo "compressing files with Brotli"
	fd "" "$out" -t f -e html -e css -e js -e css.map -e js.map -X brotli --best
}

if [[ -z "${dontBrotlify:-}" ]]; then
	preDistPhases+=" aasgBrotlifyPhase"
fi