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

ttyd: 1.6.1 -> 1.6.3, generate blob from source #110978

Closed
wants to merge 2 commits into from

Conversation

iblech
Copy link
Contributor

@iblech iblech commented Jan 28, 2021

Motivation for this change

The first commit in this pull request is a very ordinary version bump (1.6.1 to 1.6.3).

In the second, we fix a long-time issue with our ttyd package: The file src/html.h in the ttyd repository is generated from other source files in the html/ subdirectory. Previously, we just used the pre-built file. With this pull request, we are generating it on our own.

I believe this to be in the Nix spirit, please correct me if I'm wrong. It also has the practical benefit that overriding this package is now easier -- before, any changes to the html/ subdirectory wouldn't have any effect.

In order to avoid checking in a 300+ KiB yarn.nix file into nixpkgs (automatically generated from yarn.lock), this pull requests generates it on the fly. Please indicate whether this is weird, if so I'll just check in the generated yarn.nix as a static file.

The current maintainer @thoughtpolice shouldn't have to bear the work of maintaining my addition. Hence I'm adding myself as maintainer. :-)

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.

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/prs-ready-for-review/3032/457

@SuperSandro2000
Copy link
Member

Please check ofborg status before posting on discourse. I usually just skip red ofborgs entirely.

@iblech
Copy link
Contributor Author

iblech commented Feb 4, 2021

The status is only red because I'm not a trusted user, hence ofborg refuses to evaluate the expression. The expression is slightly unusual because it calls yarn2nix at evaluation time. :-) This aspect is what I solicited feedback about.

The alternative would be to skip this dynamical generation and just check in a static 300 KiB automatically-generated .nix file. Would also be totally fine with me, just wanted to know which route I should pursue.

let
yarnNixFile = runCommand "yarn.nix" {}
"${yarn2nix}/bin/yarn2nix --lockfile ${src}/html/yarn.lock --no-patch --builtin-fetchgit > $out";
yarnNix = callPackage yarnNixFile {};
Copy link
Member

Choose a reason for hiding this comment

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

This does import from derivation, which we don't allow in nixpkgs.

Copy link
Member

Choose a reason for hiding this comment

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

Hence the evaluation error.

let
yarnNixFile = runCommand "yarn.nix" {}
"${yarn2nix}/bin/yarn2nix --lockfile ${src}/html/yarn.lock --no-patch --builtin-fetchgit > $out";
yarnNix = callPackage yarnNixFile {};

This comment was marked as duplicate.

@SuperSandro2000 SuperSandro2000 changed the title ttyd: bump to 1.6.3 and generate blob from source ttyd: 1.6.1 -> 1.6.3, generate blob from source Feb 4, 2021
@iblech
Copy link
Contributor Author

iblech commented Feb 4, 2021

Thank you @Mic92 and @SuperSandro2000 for your comments! Accordingly, I removed the dynamic generation and checked in a static yarn.nix file.

Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

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

This is 300KB for a single package? I am against having this in nixpkgs. The problem is that this is also increases nixpkgs evaluation time massively.

@Mic92
Copy link
Member

Mic92 commented Feb 4, 2021

To be honest I rather have pre-compiled html than reviewing 10000 lines generate nix files.

@@ -0,0 +1,10 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p yarn2nix curl
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#!nix-shell -i bash -p yarn2nix curl
#!nix-shell -i bash -p curl gnugrep yarn2nix

@Mic92
Copy link
Member

Mic92 commented Feb 4, 2021

Sorry. For not reading the PR message before putting my comment below. I was asked to have a look at the evaluation error, so I did not pay attention to that.

@stale
Copy link

stale bot commented Aug 4, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 4, 2021
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 5, 2021
Comment on lines 8 to 9
with builtins;

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
with builtins;

@stale
Copy link

stale bot commented Apr 19, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 19, 2022
@Mindavi
Copy link
Contributor

Mindavi commented Apr 24, 2022

Heh, I also bumped ttyd a while ago, so the bump could be dropped after a rebase: #123135. Didn't see this PR at the time. I also don't really like the large files in nixpkgs, so a 👎 from me on this. I think this would be better suited to be carried as an overlay if you want to do such things, rather than being checked in to nixpkgs.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 24, 2022
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