Skip to content
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

line-awesome: init at 1.3.0 #83537

Merged
merged 1 commit into from Apr 15, 2020
Merged

line-awesome: init at 1.3.0 #83537

merged 1 commit into from Apr 15, 2020

Conversation

puzzlewolf
Copy link
Contributor

Motivation for this change

Line Awesome is a free alternative to Font Awesome, in line icon style.
https://icons8.com/line-awesome/

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@Emantor Emantor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on NixOS unstable.


postFetch = ''
mkdir -p $out/share/fonts
unzip -j $downloadedFile ${version}/fonts/\*.ttf -d $out/share/fonts/truetype
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? Shouldn't fetchzip take care of the unpacking?

Copy link
Contributor Author

@puzzlewolf puzzlewolf Apr 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing!

Hm. I modeled the PR after #78409 and other fonts do the same thing, e.g. yanone-kaffeesatz or ubuntu-fonts. But that doesn't mean it's correct 🤔

I think this overrides the postFetch defined by fetchzip, which is where the unpacking takes place. So it has to be done manually. But I concur, it's weird.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it seems very weird. If we're unzipping manually anyway, we might as well use fetchurl.

Maybe this should use mkDerivation instead, disable the unnecessary phases (mostly build) and do the installation in installPhase. I don't have much experience with fonts in nixpkgs though. @marsam, what are your thoughts on this?

Copy link
Member

@timokau timokau Apr 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Its possible I won't be able to react to emails over the rest of the weekend. So if someone else wants to merge, no need to wait for my approval)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@puzzlewolf according to the docs, you should just add unzip to nativeBuildInputs, see: https://nixos.org/nixpkgs/manual/#ssec-unpack-phase .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doronbehar Do you want me to model this after e.g. nafees? It's quite different from e.g. ubuntu-fonts, it uses mkDerivation instead of fetchzip. Do you know of a community-agreed default way of doing this kind of font packages?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see that we have many fonts installed with fetchzip which is a bit unfortunate since this has the disadvantage that it makes it impossible to override these derivations with <font>.overrideAttrs. nafees is written great so yes, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, now it uses mkDerivation.


postFetch = ''
mkdir -p $out/share/fonts
unzip -j $downloadedFile ${version}/fonts/\*.ttf -d $out/share/fonts/truetype
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@puzzlewolf according to the docs, you should just add unzip to nativeBuildInputs, see: https://nixos.org/nixpkgs/manual/#ssec-unpack-phase .

@puzzlewolf puzzlewolf force-pushed the line-awesome branch 2 times, most recently from c7ccf1f to 4b06f32 Compare April 15, 2020 10:51
@puzzlewolf
Copy link
Contributor Author

puzzlewolf commented Apr 15, 2020

And now it's fixed-output. It should be, right? The manual seems pretty clear: https://nixos.org/nix/manual/#sec-advanced-attributes, but fixed-output derivations seem to be their own can of worms NixOS/nix#2270.

Copy link
Member

@timokau timokau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much cleaner now!

It shouldn't be fixed output though. Fixed output is a tool that should only be used when needed, as it has many downsides (as you noted yourself). It isn't needed in this case.

pkgs/data/fonts/line-awesome/default.nix Show resolved Hide resolved
Copy link
Member

@timokau timokau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks a lot for the contribution, your receptiveness to feedback and your patience.

@timokau timokau merged commit c6ca626 into NixOS:master Apr 15, 2020
@timokau
Copy link
Member

timokau commented Apr 15, 2020

If there's anything else you would like me to take a look at (a PR of yours or one you have reviewed), let me know. No guarantees of course.

@puzzlewolf
Copy link
Contributor Author

Thanks for reviewing, explaining and your receptiveness on discourse 🚀. Currently, there is only #83028, which should probably also go the mkDerivation way.

I wonder if we should document somewhere in the manual that mkDerivation should be preferred over fetchzip for font packages. What do you think?

@puzzlewolf puzzlewolf deleted the line-awesome branch April 15, 2020 14:47
@timokau
Copy link
Member

timokau commented Apr 15, 2020

Yes, I think #83028 could be modeled after this PR. Documentation would be great! Are you up to writing that? I think the ´fetchX` functions are pretty much just intended to be used as part of a package, but never as the top-level package.

If you feel up to it, you could write some documentation. We can then look for some people who have contributed fetchzip derivations in the past and ping them, as they might have had reasons for that (though I can't think of any). After giving them some time to respond, we could go forward and hopefully have one less "gray area" in nixpkgs :)

@rasendubi rasendubi mentioned this pull request Apr 19, 2020
9 tasks
@puzzlewolf puzzlewolf mentioned this pull request Jun 15, 2020
10 tasks
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/guidelines-on-packaging-fonts/7683/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants