-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
nerdfonts: separate into individual font packages, 3.2.1 -> 3.3.0 #354543
base: master
Are you sure you want to change the base?
Conversation
efb304d
to
859ddb9
Compare
10ac908
to
a607e0c
Compare
4f9938b
to
c39fc62
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.
Should we not create a top-level attribute for each font, and then an additional one that bundles all of them?
builtins.listToAttrs ( | ||
map (font: lib.attrsets.nameValuePair font.attrName (makeNerdFont font)) ( | ||
lib.trivial.importJSON ./fonts.json | ||
) | ||
) |
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.
builtins.listToAttrs ( | |
map (font: lib.attrsets.nameValuePair font.attrName (makeNerdFont font)) ( | |
lib.trivial.importJSON ./fonts.json | |
) | |
) | |
symlinkJoin { | |
name = "nerd-fonts"; | |
paths = map makeNerdFont (lib.trivial.importJSON ./fonts.json); | |
} |
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.
We need to produce a single derivation here, containing all fonts, right?
Maybe you want to use callPackages
instead (note the s
at the end), and then additionally add the symlinkJoin to the set to have a derivation containing all fonts.
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 don't think bundling different fonts together (as in the legacy nerdfonts
) is a good idea. They have different origins, different descriptions, different licenses and different tarballs. I.e. they have nothing to do with one another except that they live and get patched in the same repo. Should we agglomerate them together, we would have to bundle many of the kdePackages
together too, which is so meaningless as well as impractical.
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 meant that we remove the code for the old derivation altogether, we add the new derivations, and we add a symlinkJoin with all of them as the replacement for the old package.
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.
No... Even if we manage to make such a mono-package, either it can't share the interface with its predecessor, or it shares the defeat as well -- difficulty to be built by Hydra due to its too many variants. On the other hand, the user may choose all the fonts by just appending the whole package set to their "fonts" or "packages" list.
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.
Well no, that's the thing of symlinkjoin, it just symlinks. So the package would be tiny, it just links to all the others.
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 don't know what Hydra actually do to build the cache. But if it was overwhelmed by the old package, which fetched only one GiB or two of tarballs, it must had made a huge number of random compositions on the overridable font choices. For the new package set, however, you can just mix the fonts in any manners as for other packages. Specifying font members and building a dedicated mono-derivation, lightweight or not, is quite redundant.
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 agree with @rc-zb in this topic. I'll only add that if someone really wants to get all the fonts they can use Nix code to simply take all attrValues
of nerd-fonts
.
What's the reason for keeping the old derivation? |
c39fc62
to
ac5a62f
Compare
ac5a62f
to
5998576
Compare
5998576
to
fe4d85a
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.
Beautiful work! Thanks :). I can't believe only now someone has thought about this.
9c8ddc3
to
5deea25
Compare
bfc0b4f
to
fd4877e
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.
simply vendoring both files - upstream's release SHA-256.txt, and fonts.json, and with pure Nix, generate the derivations
If the font families information were still needed, we would have to download and unpack the tarballs and
fc-query
the info anyway.
Then I think at this point I would let it go - it is not that important and usually in people's configuration the font families of each font is something that should stay constant in future releases of nerd fonts.
builtins.listToAttrs ( | ||
map (font: lib.attrsets.nameValuePair font.attrName (makeNerdFont font)) ( | ||
lib.trivial.importJSON ./fonts.json | ||
) | ||
) |
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 agree with @rc-zb in this topic. I'll only add that if someone really wants to get all the fonts they can use Nix code to simply take all attrValues
of nerd-fonts
.
builtins.listToAttrs ( | ||
map (font: lib.attrsets.nameValuePair font.attrName (makeNerdFont font)) ( | ||
lib.trivial.importJSON ./fonts.json | ||
) | ||
) |
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.
Maybe it'd be easier to use lib.genAttrs
?
"Bitstream-Vera AND MIT" = [ | ||
bitstreamVera | ||
mit | ||
]; |
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 use strings here,
9ceb003
to
9f6b6f6
Compare
9f6b6f6
to
ec76232
Compare
Now it goes. |
ec76232
to
47e3d6b
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.
Sorry for taking so long to reply, I'm pretty busy. I also wish I could have helped more directly by simply checking out locally the PR and testing and pushing my suggestions.
if builtins.match "[[:digit:]].*" version != null then | ||
version | ||
else | ||
"0-unstable-" + builtins.head (lib.strings.splitString "T" releaseInfo.published_at); |
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 think the version of the nerd-fonts release tag should be used here, and this would allow you to take slightly less info from that large release info json file.
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.
This would break the consistency among versions of different fonts. And if the upstream does not want to specify some of the individual versions, why do we care about them?
The size does not matter, because there is only one published_at
in the response.
c3f5951
to
7318ffa
Compare
So eventually some sort of "algorithms" are still needed for the script? And the checksums JSON become similar to the one before refactoring, except for the removal of |
7318ffa
to
ba6dc04
Compare
Not running I pushed a few small improvements to the https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#supported-features Now you can run the script only with Glad I finally found the time to help with this too :). Waiting to see your approval. Please note how you can
And get the same result. |
ba6dc04
to
2fdd01f
Compare
|
||
installPhase = | ||
let | ||
dirName = lib.strings.concatStrings (lib.strings.splitString " " patchedName); |
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.
BTW Why did you decide to not use folderName
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.
Because folderName
is essentially the original name concatenated, not the font (family) name of the released patched font, some of which have to deviate from the former due to their RFN policy. Also, the texts in the preview images on the website are generated from patchedName
instead of folderName
.
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.
Love it; thank you! After installing pkgs.nerdfonts
just to get a single font, and then getting a bit of a shock when looking at nix-tree
, this is a welcome change.
2fdd01f
to
4c5bc27
Compare
Let's see a nixpkgs-review report when CI is green, and merge 🎉. |
4c5bc27
to
536dc87
Compare
Fixed merge conflict in the last push, and labeled the PR so it will be backported to release-24.11. |
I've also built all |
Separate Nerd Fonts into individual packages under the namespace of
nerd-fonts
.And update it to 3.3.0.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Mention the package maintainers
@doronbehar
Add a 👍 reaction to pull requests you find important.