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

iosevka: Simplify custom build process #69219

Merged
merged 7 commits into from Sep 24, 2019
Merged

Conversation

rileyinman
Copy link
Contributor

Although hopefully this can eventually be added to nodePackages, it uses
some devDependencies to build custom fonts. Node2nix doesn't currently
support enabling devDependencies for a single package.

  • Got rid of redundant let-in statements.
  • node-packages.json now only pulls in Iosevka.
  • generate.sh
    • Uses a nix-shell shebang to ensure it builds using the current
      version of node2nix (the old version caused some issues due to the
      19.03 release version being 1.6.0 instead of 1.7.0).
    • Builds in development mode to fix the devDependencies issue.
  • Use the tree of the built node package as sourceRoot instead of
    installing node dependencies manually. This means the source will have
    to be updated in both node-packages.json and default.nix, but to make
    things easier the derivation inherits the version number.
  • Disparate build options now all live under privateBuildPlan, which is
    converted first with builtins.toJSON and then to TOML using remarshal
    (Unfortunately there is not currently a builtins.toTOML, see New builtin: toTOML nix#2967).
  • Extra parameters can also be provided that will be converted to JSON
    then TOML. This will overwrite the default parameters.toml file.
Motivation for this change

I was already working on bumping the version when the PR came in a few days ago, but I still had a few improvements I thought would help for the future! Making node2nix and remarshal do most of the work seemed like a good idea.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nix-review --run "nix-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.
Notify maintainers

cc @cstrahan @jfrankenau @ttuegel @babariviere

Although hopefully this can eventually be added to nodePackages, it uses
some devDependencies to build custom fonts. Node2nix doesn't currently
support enabling devDependencies for a single package.

- Got rid of redundant let-in statements.
- node-packages.json now only pulls in Iosevka.
- generate.sh
  * Uses a nix-shell shebang to ensure it builds using the current
    version of node2nix (the old version caused some issues due to the
    19.03 release version being 1.6.0 instead of 1.7.0).
  * Builds in development mode to fix the devDependencies issue.
- Use the tree of the built node package as sourceRoot instead of
  installing node dependencies manually. This means the source will have
  to be updated in both node-packages.json and default.nix, but to make
  things easier the derivation inherits the version number.
- Disparate build options now all live under privateBuildPlan, which is
  converted first with builtins.toJSON and then to TOML using remarshal
  (Unfortunately there is not currently a builtins.toTOML).
- Extra parameters can also be provided that will be converted to JSON
  then TOML. This will overwrite the default parameters.toml file.
pkgs/data/fonts/iosevka/default.nix Outdated Show resolved Hide resolved
pkgs/data/fonts/iosevka/default.nix Outdated Show resolved Hide resolved
@babariviere babariviere mentioned this pull request Sep 22, 2019
10 tasks
@babariviere
Copy link
Member

@rileyinman You can also add yourself as a maintainer, if you want to.

@rileyinman
Copy link
Contributor Author

Do you want me to force-push to squash these commits?

@babariviere
Copy link
Member

Don't worry, we can squash it with github. I cannot merge your PR but it's ok for me.

@rileyinman
Copy link
Contributor Author

With suggestions from @hlolli in #68820, I can try merging the build deps into nodePackages. This would have the disadvantage of having to keep a package.json up to date with whatever Iosevka decides to do but would also mean no several-thousand line generated node file :P I personally wouldn't mind having the package.json be part of the update process, but what does everyone else think?

@rileyinman
Copy link
Contributor Author

I went ahead and pushed the change up, let me know if there are any objections to this :)

pkgs/data/fonts/iosevka/default.nix Outdated Show resolved Hide resolved
pkgs/data/fonts/iosevka/default.nix Outdated Show resolved Hide resolved
@hlolli
Copy link
Member

hlolli commented Sep 23, 2019

Very good, this would be the way I would do it. It also locks iosevka's npm dependencies in 1 build dependency. So when bumping this package, it will be a ceremony to compare the package.json files and re-generate the node-packages. But ofc I recommend using node2nix locally for development. The only wart in this process is the fact that the package-name takes the relative local path, other than that, looks good to me :D

@rileyinman
Copy link
Contributor Author

@hlolli do you have any ways the package name thing could be better? I just copied it off what you did in lumo

@ofborg ofborg bot requested a review from babariviere September 23, 2019 19:24
@ttuegel ttuegel merged commit 7a4d7c5 into NixOS:master Sep 24, 2019
@ttuegel
Copy link
Member

ttuegel commented Sep 24, 2019

Thanks!

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

4 participants