-
-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
irpf: init at 2022-1.0 #163352
irpf: init at 2022-1.0 #163352
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is the site guarded? (I am unable to access it)
in | ||
stdenvNoCC.mkDerivation rec { | ||
pname = "irpf"; | ||
version = "2.22.1.0"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version = "2.22.1.0"; | |
version = "2022-1.0"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for the review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What website? the one for the pkgbuild or the homepage for the software?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://downloadirpf.receita.fazenda.gov.br/irpf/2022/irpf/arquivos/IRPF2022-1.0.zip
When i initially commented, I was getting a server not found error, so I assumed maybe they only allow downloads if its from brazil.
But now its working, (either my internet or the site was temporarily down)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh ok, this website is not the most stable for sure.
{ lib, stdenvNoCC, jdk11, makeWrapper, hicolor-icon-theme, fetchzip, fetchgit }: | ||
|
||
let | ||
year = "2022"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
year = "2022"; |
src = fetchzip rec { | ||
url = "https://downloadirpf.receita.fazenda.gov.br/irpf/${year}/irpf/arquivos/IRPF${year}-1.0.zip"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src = fetchzip rec { | |
url = "https://downloadirpf.receita.fazenda.gov.br/irpf/${year}/irpf/arquivos/IRPF${year}-1.0.zip"; | |
src = let | |
year = lib.head (lib.splitVersion version); | |
in fetchzip { | |
url = "https://downloadirpf.receita.fazenda.gov.br/irpf/${year}/irpf/arquivos/IRPF${version}.zip"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I didn't even know this was possible. Thx!
cp -rf help "$BASEDIR/" | ||
cp -rf lib "$BASEDIR/" | ||
cp -rf lib-modulos "$BASEDIR/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp -rf help "$BASEDIR/" | |
cp -rf lib "$BASEDIR/" | |
cp -rf lib-modulos "$BASEDIR/" | |
cp -rf help lib lib-modulos "$BASEDIR" |
Also, would you mind adding a comment as to why the f
flag is used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I just copied from the arch linux pkgbuild, but it seems indeed unecessary.
install -Dm644 Leia-me.htm "$BASEDIR/" | ||
install -Dm644 offline.png "$BASEDIR/" | ||
install -Dm644 online.png "$BASEDIR/" | ||
install -Dm644 pgd-updater.jar "$BASEDIR/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
install -Dm644 Leia-me.htm "$BASEDIR/" | |
install -Dm644 offline.png "$BASEDIR/" | |
install -Dm644 online.png "$BASEDIR/" | |
install -Dm644 pgd-updater.jar "$BASEDIR/" | |
install -Dm644 Leia-me.htm offline.png online.png pgd-updater "$BASEDIR" |
(btw, i dont think trailing /
's matter here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx!
{ lib, stdenvNoCC, jdk11, makeWrapper, hicolor-icon-theme, fetchzip, fetchgit }: | ||
|
||
let | ||
pkgbuild = fetchgit rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkgbuild = fetchgit rec { | |
pkgbuild = fetchgit { |
in | ||
stdenvNoCC.mkDerivation rec { | ||
pname = "irpf"; | ||
version = "2022.1.0"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version = "2022.1.0"; | |
version = "2022-1.0"; |
src = let | ||
year = lib.head (lib.splitVersion version); | ||
in fetchzip { | ||
url = "https://downloadirpf.receita.fazenda.gov.br/irpf/${year}/irpf/arquivos/IRPF${year}-1.0.zip"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url = "https://downloadirpf.receita.fazenda.gov.br/irpf/${year}/irpf/arquivos/IRPF${year}-1.0.zip"; | |
url = "https://downloadirpf.receita.fazenda.gov.br/irpf/${year}/irpf/arquivos/IRPF${version}.zip"; |
--add-flags "-Dawt.useSystemAAFontSettings=on \ | ||
-Dswing.aatext=true \ | ||
-jar $BASEDIR/${pname}.jar" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--add-flags "-Dawt.useSystemAAFontSettings=on \ | |
-Dswing.aatext=true \ | |
-jar $BASEDIR/${pname}.jar" \ | |
--add-flags "-Dawt.useSystemAAFontSettings=on" \ | |
--add-flags "-Dswing.aatext=true" \ | |
--add-flags "-jar $BASEDIR/${pname}.jar" \ |
I find this makes it more clear that these flags are not directly being added to makeWrapper
''; | ||
|
||
meta = with lib; { | ||
descriptions = "Programa Oficial da Receita para elaboração do IRPF"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
descriptions = "Programa Oficial da Receita para elaboração do IRPF"; | |
description = "Programa Oficial da Receita para elaboração do IRPF"; |
ofborg detected this
--add-flags "-Dawt.useSystemAAFontSettings=on \ | ||
-Dswing.aatext=true \ | ||
-jar $BASEDIR/${pname}.jar" \ | ||
--prefix _JAVA_AWT_WM_NONREPARENTING=1 AWT_TOOLKIT=MToolkit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--prefix _JAVA_AWT_WM_NONREPARENTING=1 AWT_TOOLKIT=MToolkit | |
--set _JAVA_AWT_WM_NONREPARENTING 1 \ | |
--set AWT_TOOLKIT MToolkit |
see arguments here https://github.com/NixOS/nixpkgs/blob/c8b5c9526415905e90e3a64586ebecc55a2827dd/pkgs/build-support/setup-hooks/make-wrapper.sh.
mkdir -p "$out/share/icons/hicolor/128x128/apps" | ||
mkdir -p "$out/share/applications" | ||
mkdir -p "$out/share/licenses/${pname}" | ||
mkdir -p "$out/share/${pname}" | ||
mkdir "$out/bin" | ||
BASEDIR="$out/share/${pname}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mkdir -p "$out/share/icons/hicolor/128x128/apps" | |
mkdir -p "$out/share/applications" | |
mkdir -p "$out/share/licenses/${pname}" | |
mkdir -p "$out/share/${pname}" | |
mkdir "$out/bin" | |
BASEDIR="$out/share/${pname}" | |
BASEDIR="$out/share/${pname}" | |
mkdir -p "$BASEDIR" |
I think placing the mkdirs where needed is neater (also install -D
makes directories when target directory is specified)
|
||
install -Dm755 irpf.jar "$BASEDIR/${pname}.jar" | ||
install -Dm644 Leia-me.htm offline.png online.png pgd-updater.jar "$BASEDIR" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mkdir -p $out/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah indeed this isnt required makeWrapper does this. (my bad)
mkdir -p "$(dirname "$wrapper")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, I actually discovered it by accident.
BASEDIR="$out/share/${pname}" | ||
|
||
cp -r help lib lib-modulos "$BASEDIR" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
install -Dm644 ${pkgbuild}/irpf.png $out/share/icons/hicolor/128x128/apps/ | ||
install -Dm644 ${pkgbuild}/irpf.desktop $out/share/applications/ | ||
install -Dm644 ${pkgbuild}/Copyright $out/share/licenses/${pname}/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
install -Dm644 ${pkgbuild}/irpf.png $out/share/icons/hicolor/128x128/apps/ | |
install -Dm644 ${pkgbuild}/irpf.desktop $out/share/applications/ | |
install -Dm644 ${pkgbuild}/Copyright $out/share/licenses/${pname}/ | |
install -Dtm644 $out/share/icons/hicolor/128x128/apps ${pkgbuild}/irpf.png | |
install -Dtm644 $out/share/applications ${pkgbuild}/irpf.desktop | |
install -Dtm644 $out/share/licenses/${pname} ${pkgbuild}/Copyright |
This auto creates the directories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this and it didn't work, but I implemented something that will.
Thanks for the suggestions! I think I fixed it all. I was actually struggling on how to make the install phase smaller and u gave it to me, thx! |
Oh miss clicked the close button |
{ lib, stdenvNoCC, jdk11, makeWrapper, hicolor-icon-theme, fetchzip, fetchgit }: | ||
|
||
let | ||
pkgbuild = fetchgit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the meaning of life of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for the review again Anderson, I was waiting for someone to ask as this has to do with the reproducibility of this derivation. There are three files I'm getting from the aur pkgbuild: copyright file, the desktop file and the desktop icon. I could forgo the first two since they are text files, as I could either hardcode them or use the proper tools like makeDesktopItem. However, the desktop icon should be hosted in a website whereas it can be fetched using the same url for at least 10 years. Having this in mind, fetching the icon from the government website seems prone to failure, as they can, and most likely will, change urls.
I thought about creating a personal github only for those three files but it seems unecessary whereas there is already a git repo (although from aur git) with those. I'm looking for a better solution, but this is what I've got so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish they just shipped the icon together with the program, but no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be it, how did u get it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sincerely don't, but I can take a look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here. It is embedded in the website, any idea of how to get it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I looked a bit more and I found a file irpf.jar/IRPF-Licenses.txt
the header of it reads
Termo Público de Cessão de Direito de Uso:
A Secretaria da Receita Federal do Brasil informa que o Programa
Aplicativo para Preenchimento da Declaração de Ajuste Anual do
Imposto de Renda de Pessoa Física do exercício de 2019, ano-calendário de 2018 (IRPF2019),
desenvolvido pelo SERPRO para a RFB, é objeto de propriedade intelectual da União
e tem seu uso licenciado para o contribuinte, para ser utilizado exclusivamente
para os fins a que se destina. Seu uso indiscriminado para finalidade
diversa sujeita o responsável às penas da lei.
.... I dont speak Portuguese ... but when I ran it through google translate, it was more or less the same except some clear contextual translation errors also.... the year is different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you prefer to use a hard-coded one, its cool and how you have it already works well.
Also, the idea is get everything from one source (as far as possible), so reading an excerpt from a website (which is bad enough) is a no go.
Im also questioning if the copyright file is needed as its embedded in their jar file also ... what purpose does it serve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
U are being of such help that I cannot thank you enough. This small text is the same thing. I just thought that including thing would be necessary as far as licensing goes, but I guess that specifying that it is unfree might be enough, maybe I should just remove it.
422122e
to
0fcb97a
Compare
mkdir -p $out/share/pixmaps | ||
unzip -j lib/ppgd-icones-4.0.jar icones/rfb64.png -d $out/share/pixmaps | ||
|
||
install -Dm644 ${desktopItem}/share/applications/irpf.desktop $out/share/applications/irpf.desktop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use copyDesktopItems as used in https://github.com/NixOS/nixpkgs/blob/12d3b345c960458f62b77134b2ca1da5268277c9/pkgs/development/tools/mars-mips/default.nix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done haha.
0504403
to
6b3d10d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find its good but im not a committer :p
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
nativeBuildInputs = [ makeWrapper copyDesktopItems ]; | ||
buildInputs = [ unzip ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nativeBuildInputs = [ makeWrapper copyDesktopItems ]; | |
buildInputs = [ unzip ]; | |
nativeBuildInputs = [ makeWrapper copyDesktopItems unzip ]; |
@AtilaSaraiva PING |
Oh, sorry, gonna do. |
Done, and also made a rebase to solve the conflict with the master branch. |
You forgot to move |
Oh, u're right, I managed to fix it rn. |
Last modification: edit the commit message Use Instead of |
Done, thx for the patience 🥇 |
Backport failed for Please cherry-pick the changes locally. git fetch origin release-21.11
git worktree add -d .worktree/backport-163352-to-release-21.11 origin/release-21.11
cd .worktree/backport-163352-to-release-21.11
git checkout -b backport-163352-to-release-21.11
ancref=$(git merge-base aee602ac0ee907c7b7d0a15c815b29d098a0bbd7 899f1131d406ee4881b8e3962b14f06e2219cb87)
git cherry-pick -x $ancref..899f1131d406ee4881b8e3962b14f06e2219cb87 |
Description of changes
I wrote this derivation to be able to use the software to write and submit income tax reports officially in my country, Brazil. I hope it can help my nix maniacs compatriots.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes