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

Patchwork #35334

Closed
wants to merge 5 commits into from
Closed

Patchwork #35334

wants to merge 5 commits into from

Conversation

manveru
Copy link
Contributor

@manveru manveru commented Feb 22, 2018

Motivation for this change

Closes #31052 and #24784

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@manveru
Copy link
Contributor Author

manveru commented Feb 22, 2018

Sorry, didn't mean to ping you zimba.

@manveru manveru mentioned this pull request Feb 22, 2018
8 tasks
@manveru
Copy link
Contributor Author

manveru commented Feb 22, 2018

Smilies aren't working yet... will have to strace to see where it's looking for them or maybe it's a font thing.

@matthiasbeyer
Copy link
Contributor

$ nix-build -A patchwork -Q
error: unsupported argument ‘sha256’ to ‘fetchTarball’, at 0x1aedb448
(use ‘--show-trace’ to show detailed location information)

@manveru
Copy link
Contributor Author

manveru commented Feb 22, 2018

Argh, I'm always on nix 1.12 so I didn't notice that. Will try to come up with a fix.

@manveru
Copy link
Contributor Author

manveru commented Feb 22, 2018

Should be fixed now.

@matthiasbeyer
Copy link
Contributor

I love you.

This works for me.

@dtzWill
Copy link
Member

dtzWill commented Feb 22, 2018

  • electron update should probably be a separate commit
  • ... That yarn.lock file is huge (4k+ lines). Can it be fetched instead or something (without causing IFD problems)?

@manveru
Copy link
Contributor Author

manveru commented Feb 22, 2018

Unfortunately the derivation can't be built using npm2nix, so I had to make a yarn.lock file. I could in theory host it somewhere else and download it, but not sure what a good place for that would be.

I can split up electron update into a separate commit. I don't think it'll cause much problems.

@dtzWill
Copy link
Member

dtzWill commented Feb 22, 2018

Same PR is fine, just good practice and makes it more manageable (to cherrypick, revert, ...)

If the file can be fetched without IFD, then definitely let's find a different home for it. Otherwise every single channel updates for forever will include a copy of it! Haha

repo = "yarn2nix";
rev = "d6e05a521bd92b2647bb7e853363d234f21b2cfd";
sha256 = "1nvpii9p41vrb6zvr8rqcvmycrl6lnzzaif85qj1aavizncgb4wy";
}) {
Copy link
Member

Choose a reason for hiding this comment

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

last time I checked import from derivation was not allowed on Hydra, we would have import yarn2nix into nixpkgs first

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just need to find a good location for it... I'll start working on a separate PR. Just hope @moretea is OK with it.

Copy link
Member

Choose a reason for hiding this comment

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

I'm quite sure he's OK with it. The only reason not to include it is that a new yarn2nix nix emerged that is even more powerful: https://github.com/Profpatsch/yarn2nix

nodeHeaders = fetchurl {
url = "https://nodejs.org/download/release/v${nodejs.version}/node-v${nodejs.version}-headers.tar.gz";
sha256 = "1993kcghzr56zmw5sdj8wr8c42mna25806bcjknfxnh62zl4hwpg";
};
Copy link
Member

Choose a reason for hiding this comment

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

I'm doing the exact same thing in another project and it breaks every time I update nixpkgs and the nodejs has been bumped. I think the nodejs package should export the headers in another output like nodejs.dev

@manveru manveru mentioned this pull request Feb 22, 2018
8 tasks
@matthiasbeyer
Copy link
Contributor

Can we please get this ready before the actual nixos 18.03 release?

@manveru
Copy link
Contributor Author

manveru commented Mar 9, 2018

This depends entirely on #35340 making it in.

@zimbatm
Copy link
Member

zimbatm commented Mar 9, 2018

@manveru can you rebase on master?

@zimbatm
Copy link
Member

zimbatm commented Mar 10, 2018

cannot read ‘/nix/store/j9w77q7mb7dnx31h1rnwa4kvzcnwnfq3-source/package.json’, since path ‘/nix/store/knid138m3yqmnm6b8kvlpr94z18kf7pn-source.drv’ is not valid, at /var/lib/gc-of-borg/.nix-test-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/ogden/lib/trivial.nix:122:24

This is the same error we were seeing in yarn2nix

@manveru
Copy link
Contributor Author

manveru commented Mar 10, 2018

I'm not sure how to solve that then. Really would like to avoid adding the package.json and yarn.lock as well to nixpkgs...

@zimbatm
Copy link
Member

zimbatm commented Mar 10, 2018

I don't think we have a choice

@dtzWill
Copy link
Member

dtzWill commented Mar 10, 2018

... That yarn.lock file is huge (4k+ lines). Can it be fetched instead or something (without causing IFD problems)?

Sounds like "without causing IFD problems" is indeed not possible, yes? Still 4K is heavy, not sure how important this is to everyone. It certainly would be a problem if we had many such files...

@zimbatm zimbatm mentioned this pull request Mar 11, 2018
2 tasks
@manveru
Copy link
Contributor Author

manveru commented Mar 11, 2018

So I finally added the yarn.lock and generated yarn.nix to this PR.
I doubt it'll be merged due to the size of over 11k lines, but it should provide some nice food for thought about how we can handle cases like this.

I think this is a really good example to show that for some derivations, import-from-derivation (IFD) can be very valuable. I'm not sure what needs to be done to make this an option though.

If this is not merged you can still get it from my nixpkgs fork, I'll keep the branch around, but probably won't be using Patchwork much myself, so don't expect frequent updates.

@matthiasbeyer
Copy link
Contributor

Thanks for providing this patch!

I want patchwork in nixpkgs, but I don't want this huge file in nixpkgs. This is definitively not the path to take for packages like this and we should look for a better solution how to package things like this (in the general case for nixpkgs, not only in this case).

I would say No! don't merge this.

@manveru
Copy link
Contributor Author

manveru commented Mar 12, 2018

I talked with @globin and @domenkozar yesterday, and they think we could have a combined yarn-packages.nix like we do for other languages. I think it's possible to do that, but due to the nature of NPM, it will have a lot more entries. The benefit is that we can probably share quite some dependencies between different electron apps.

I'll try my hand at packaging #32516 as well and see how much they have in common.

@globin globin mentioned this pull request Mar 13, 2018
8 tasks
@matthiasbeyer
Copy link
Contributor

Any progress?

1 similar comment
@matthiasbeyer
Copy link
Contributor

Any progress?

@mguentner
Copy link
Contributor

mguentner commented Apr 25, 2018

I believe that electron apps are (too) high hanging fruits for nixpkgs with the current amount of humans working on it.

I propose to loosen the sandbox model for such apps, meaning that you can run "npm install" / "yarn install" prior to the buildPhase in some specialDepsPhase.
That would drastically reduce the work needed for packaging electron apps. It will be similar to writing PKGBUILDs for ArchLinux.

Package output:

$ yaourt -Ql ssb-patchwork | cut -d '/' -f 1-4 | uniq
ssb-patchwork /opt/
ssb-patchwork /opt/ssb-patchwork/
ssb-patchwork /opt/ssb-patchwork/LICENSE
ssb-patchwork /opt/ssb-patchwork/README.md
ssb-patchwork /opt/ssb-patchwork/assets
ssb-patchwork /opt/ssb-patchwork/code-of-conduct.md
ssb-patchwork /opt/ssb-patchwork/contributing.md
ssb-patchwork /opt/ssb-patchwork/index.js
ssb-patchwork /opt/ssb-patchwork/lib
ssb-patchwork /opt/ssb-patchwork/locales
ssb-patchwork /opt/ssb-patchwork/main-window.js
ssb-patchwork /opt/ssb-patchwork/modules
ssb-patchwork /opt/ssb-patchwork/node_modules
ssb-patchwork /opt/ssb-patchwork/overrides
ssb-patchwork /opt/ssb-patchwork/package-lock.json
ssb-patchwork /opt/ssb-patchwork/package.json
ssb-patchwork /opt/ssb-patchwork/plugs
ssb-patchwork /opt/ssb-patchwork/sbot
ssb-patchwork /opt/ssb-patchwork/screenshot.jpg
ssb-patchwork /opt/ssb-patchwork/scripts
ssb-patchwork /opt/ssb-patchwork/server-process.js
ssb-patchwork /opt/ssb-patchwork/styles
ssb-patchwork /usr/
ssb-patchwork /usr/bin/
ssb-patchwork /usr/bin/ssb-patchwork
ssb-patchwork /usr/share/
ssb-patchwork /usr/share/applications
ssb-patchwork /usr/share/icons

All deps reside in /opt/ssb-patchwork/node_modules.


These packages would be second class with no guarantees.
Is there already some kind of fetchScript = "npm install" in nixpkgs?

▶️ Apparently the alternative is to add 4000 line yarn lock files to nixpkgs.

@bb010g
Copy link
Member

bb010g commented Jul 2, 2018

Why would node2nix not work here? Patchwork provides a package-lock.json upstream that could probably be used instead of a yarn.lock downstream.

@Ekleog
Copy link
Member

Ekleog commented Oct 1, 2018

(triage) If I read correctly, this is more or less blocked on Hydra turning on IFD? If so, maybe tag it “WIP” or something?

@matthiasbeyer
Copy link
Contributor

For the curious: what is IFD?

@tilpner
Copy link
Member

tilpner commented Oct 1, 2018

"Import-from-derivation": import (runCommand "foo" {} "echo 42 > $out")

@matthiasbeyer
Copy link
Contributor

Any progress?

@c0bw3b
Copy link
Contributor

c0bw3b commented May 27, 2019

#61530 provided an AppImage version of patchwork.
Building from source would still be better but it has stalled for now.

@manveru feel free to open a new PR or ask for reopening this one if you are still working on this

@c0bw3b c0bw3b closed this May 27, 2019
@manveru
Copy link
Contributor Author

manveru commented May 27, 2019

@c0bw3b it's fine, not using it myself anyway.

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