From 26f1fa436a662baa59a4717138dbfb14c5d48911 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Mon, 9 Mar 2026 15:42:13 -0600 Subject: [PATCH] trivionomicon: athena-bccr: run update-gaudi during build if gaudiHash is given --- pkgs/athena-bccr/unwrapped.nix | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/pkgs/athena-bccr/unwrapped.nix b/pkgs/athena-bccr/unwrapped.nix index a2b7722..848ea3e 100644 --- a/pkgs/athena-bccr/unwrapped.nix +++ b/pkgs/athena-bccr/unwrapped.nix @@ -26,13 +26,15 @@ inherit (release) hash; }; - gaudiUpdateSrc = {update-gaudi}: - requireFile { - url = "${update-gaudi}"; - name = "gaudi-update-${release.name}.zip"; - - hash = gaudiHash; - }; + gaudiUpdateSrc = { + update-gaudi, + runCommand, + }: + runCommand "gaudi-update-${release.name}.zip" { + outputHash = gaudiHash; + } '' + ${update-gaudi} $out + ''; moduleFromDeb = name: args @ { stdenv, @@ -188,6 +190,7 @@ in pkgs, stdenv, unzip, + runCommand, writeShellScriptBin, update-gaudi, ... @@ -198,7 +201,7 @@ in }; fakeSudo = writeShellScriptBin "sudo" ""; - gaudiUpdate = gaudiUpdateSrc {inherit update-gaudi;}; + gaudiUpdate = gaudiUpdateSrc {inherit runCommand update-gaudi;}; in moduleFromDeb "gaudi" { inherit dpkg stdenv unzip; @@ -300,17 +303,20 @@ in wget --ca-certificate="$ca_cert" "$base_url/bccr-firma-fva-clienteMultiplataforma.jar" wget --ca-certificate="$ca_cert" "$base_url/ServicioActualizadorClienteBCCR.jar" + if [ -n "$1" ]; then + zip_path="$1" + else + zip_path="$PWD/gaudi-update-${release.name}.zip" + fi + # https://gist.github.com/stokito/c588b8d6a6a0aee211393d68eea678f2 TZ=UTC find . -exec touch --no-dereference -a -m -t 198002010000.00 {} + - zip_path="$PWD/gaudi-update-${release.name}.zip" TZ=UTC zip -q --move --recurse-paths --symlinks -X "$zip_path" . TZ=UTC touch -a -m -t 198002010000.00 "$zip_path" - set -x - nix-store --add-fixed sha256 "$zip_path" - set +x - - echo -e "\ngaudiHash: $(nix-hash --to-sri --type sha256 $(sha256sum "$zip_path" | cut -d' ' -f1))" + if [ -z "$1" ]; then + echo -e "\ngaudiHash: $(nix-hash --to-sri --type sha256 $(sha256sum "$zip_path" | cut -d' ' -f1))" + fi ''; } // lib.optionalAttrs (vendor == "athena") {