Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 98 lines 3.0 kB view raw
1{ 2 lib, 3 stdenvNoCC, 4 fetchzip, 5 copyDesktopItems, 6 jdk11, 7 makeDesktopItem, 8 makeWrapper, 9 unzip, 10 xdg-utils, 11 writeScript, 12}: 13 14stdenvNoCC.mkDerivation (finalAttrs: { 15 pname = "irpf"; 16 version = "2025-1.6"; 17 18 # https://www.gov.br/receitafederal/pt-br/centrais-de-conteudo/download/pgd/dirpf 19 # Para outros sistemas operacionais -> Multi 20 src = 21 let 22 year = lib.head (lib.splitVersion finalAttrs.version); 23 in 24 fetchzip { 25 url = "https://downloadirpf.receita.fazenda.gov.br/irpf/${year}/irpf/arquivos/IRPF${finalAttrs.version}.zip"; 26 hash = "sha256-U2HweRi6acrmMT+9B1263mhGIn/84Z6JeqKP6XvTeXE="; 27 }; 28 29 passthru.updateScript = writeScript "update-irpf" '' 30 #!/usr/bin/env nix-shell 31 #!nix-shell -i bash -p curl pup common-updater-scripts 32 33 set -eu -o pipefail 34 #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 35 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)" 36 update-source-version irpf "$version" 37 ''; 38 39 nativeBuildInputs = [ 40 unzip 41 makeWrapper 42 copyDesktopItems 43 ]; 44 45 desktopItems = [ 46 (makeDesktopItem { 47 name = "irpf"; 48 exec = "irpf"; 49 icon = "rfb64"; 50 desktopName = "Imposto de Renda Pessoa Física"; 51 comment = "Programa Oficial da Receita para elaboração do IRPF"; 52 categories = [ "Office" ]; 53 }) 54 ]; 55 56 installPhase = '' 57 runHook preInstall 58 59 BASEDIR="$out/share/irpf" 60 mkdir -p "$BASEDIR" 61 62 cp --no-preserve=mode -r help lib lib-modulos "$BASEDIR" 63 64 install -Dm644 irpf.jar Leia-me.htm offline.png online.png pgd-updater.jar "$BASEDIR" 65 66 # make xdg-open overrideable at runtime 67 makeWrapper ${jdk11}/bin/java $out/bin/irpf \ 68 --add-flags "-Dawt.useSystemAAFontSettings=gasp" \ 69 --add-flags "-Dswing.aatext=true" \ 70 --add-flags "-jar $BASEDIR/irpf.jar" \ 71 --suffix PATH : ${lib.makeBinPath [ xdg-utils ]} \ 72 --set _JAVA_AWT_WM_NONREPARENTING 1 \ 73 --set AWT_TOOLKIT MToolkit 74 75 mkdir -p $out/share/pixmaps 76 unzip -j lib/ppgd-icones-4.0.jar icones/rfb64.png -d $out/share/pixmaps 77 78 runHook postInstall 79 ''; 80 81 meta = with lib; { 82 description = "Brazillian government application for reporting income tax"; 83 longDescription = '' 84 Brazillian government application for reporting income tax. 85 86 IRFP - Imposto de Renda Pessoa Física - Receita Federal do Brasil. 87 ''; 88 homepage = "https://www.gov.br/receitafederal/pt-br"; 89 license = licenses.unfree; 90 platforms = platforms.all; 91 sourceProvenance = with sourceTypes; [ binaryBytecode ]; 92 maintainers = with maintainers; [ 93 atila 94 bryanasdev000 95 ]; 96 mainProgram = "irpf"; 97 }; 98})