irpf: 2025-1.7 -> 2026-1.0 (#501723)

This commit is contained in:
Thiago Kenji Okada
2026-03-20 20:42:38 +00:00
committed by GitHub
+22 -15
View File
@@ -3,7 +3,7 @@
stdenvNoCC,
fetchzip,
copyDesktopItems,
jdk11,
jdk17,
makeDesktopItem,
makeWrapper,
unzip,
@@ -11,10 +11,16 @@
imagemagick,
writeScript,
}:
let
# The officially recommended version is Java 17
java = jdk17;
# It's not clear yet if this version follows the app version, further updates will probably solve this question
pgd-updater-version = "1.0.0";
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "irpf";
version = "2025-1.7";
version = "2026-1.0";
# https://www.gov.br/receitafederal/pt-br/centrais-de-conteudo/download/pgd/dirpf
# Para outros sistemas operacionais -> Multi
@@ -24,19 +30,9 @@ stdenvNoCC.mkDerivation (finalAttrs: {
in
fetchzip {
url = "https://downloadirpf.receita.fazenda.gov.br/irpf/${year}/irpf/arquivos/IRPF${finalAttrs.version}.zip";
hash = "sha256-VLB/Ni+sZ0Xugh3v7vb4rqTlAZz3eHU33lbljCX3Yic=";
hash = "sha256-hePdoDbFPOMjdSzsJqZWyFhHX138bMuocwCNpdOEkKA=";
};
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
@@ -63,10 +59,10 @@ stdenvNoCC.mkDerivation (finalAttrs: {
cp --no-preserve=mode -r help lib lib-modulos "$BASEDIR"
install -Dm644 irpf.jar Leia-me.htm offline.png online.png pgd-updater.jar "$BASEDIR"
install -Dm644 irpf.jar Leia-me.htm offline.png online.png pgd-updater-${pgd-updater-version}.jar "$BASEDIR"
# make xdg-open overrideable at runtime
makeWrapper ${jdk11}/bin/java $out/bin/irpf \
makeWrapper ${lib.getExe java} $out/bin/irpf \
--add-flags "-Dawt.useSystemAAFontSettings=gasp" \
--add-flags "-Dswing.aatext=true" \
--add-flags "-jar $BASEDIR/irpf.jar" \
@@ -78,9 +74,20 @@ stdenvNoCC.mkDerivation (finalAttrs: {
unzip -jp lib/ppgd-icones-4.0.jar icones/rfb64.png | magick - -background none -gravity center -extent 96x96 $out/share/icons/hicolor/96x96/apps/rfb.png
unzip -jp lib/ppgd-icones-4.0.jar icones/rfb48.png | magick - -background none -gravity center -extent 72x72 $out/share/icons/hicolor/72x72/apps/rfb.png
unzip -j lib/ppgd-icones-4.0.jar icones/rfb.png -d $out/share/icons/hicolor/32x32/apps
runHook postInstall
'';
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"
'';
meta = {
description = "Brazillian government application for reporting income tax";
longDescription = ''