diff --git a/pkgs/applications/finance/irpf/default.nix b/pkgs/applications/finance/irpf/default.nix index 9bf9c1f2d0cc..4b358c62a13e 100644 --- a/pkgs/applications/finance/irpf/default.nix +++ b/pkgs/applications/finance/irpf/default.nix @@ -7,6 +7,7 @@ , makeWrapper , unzip , xdg-utils +, writeScript }: stdenvNoCC.mkDerivation rec { @@ -22,6 +23,16 @@ stdenvNoCC.mkDerivation rec { hash = "sha256-7Eh5XhZKs2DAQC33ICUG+mgjEU7H3jdYZSeiHNJ6I6Q="; }; + passthru.updateScript = writeScript "update-irpf" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl pup common-updater-scripts + + set -eu -o pipefail + #parses the html with the install links for the containers that contain the instalation files of type 'file archive, gets the version number of each version, and sorts to get the latest one on the website + version="$(curl -s https://www.gov.br/receitafederal/pt-br/centrais-de-conteudo/download/pgd/dirpf | pup '.rfb_container .rfb_ositem:parent-of(.fa-file-archive) attr{href}' | grep -oP "IRPF\K(\d+)-[\d.]+\d" | sort -r | head -1)" + update-source-version irpf "$version" + ''; + nativeBuildInputs = [ unzip makeWrapper copyDesktopItems ]; desktopItems = [