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

radicle-upstream: init at 0.1.5 #105674

Merged
merged 1 commit into from Dec 15, 2020
Merged

Conversation

d-xo
Copy link
Contributor

@d-xo d-xo commented Dec 2, 2020

Motivation for this change

Adds a package for the radicle-upstream p2p code collaboration client (homepage).

Some notes:

  • This is an electron app bundled as an appimage. I just downloaded the appimage directly from the releases site. My understanding is that the infra for from source builds of electron apps doesn't really exist in nixpkgs atm, so this is an acceptable practice. Happy to put together a from source build if there are some nice examples I can copy.

  • The package here is a little dirty because radicle-upstream drops a git helper git-remote-rad into the users home directory. This is a dynamically linked binary, so I needed to open up the appimage and patchelf it before bulding the final wrapped appimage. In the future it might make sense to add a seperate package for the git-remote-rad helper and allow interaction with the radicle network without the UI. I kept them together for now as it allows the simplest installation experience (a single package), and the git helper can't publish to the network without the UI running at the moment anyway, so it's currently not very useful by itself.

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.

@SuperSandro2000
Copy link
Member

drops a git helper git-remote-rad into the users home directory.

Can we get rid of this trough patching?

@d-xo
Copy link
Contributor Author

d-xo commented Dec 2, 2020

You mean patching radicle-upstream so it doesn't drop this binary in the home directory anymore?

@xla
Copy link

xla commented Dec 2, 2020

* the git helper can't publish to the network without the UI running at the moment anyway,

Hej, to clarify: The local state radicle maintains has a certain layout and shape, so whenever you do any git operation on it, it needs some translation which git-remote-rad takes care of. This is independent of publishing to the network which is done by the long-running application process. So the app is disseminating data on the network, the remote helper allows git operations on custom rad remotes.

Let me know if there are other questions about its internals.

@midchildan
Copy link
Member

midchildan commented Dec 3, 2020

From a cursory look, it seems that other packages are building electron apps with something like this:

nativeBuildInputs = [ makeWrapper ];
postInstall = ''
  makeWrapper '${electron}/bin/electron' "$out/bin/application-name" \
    --add-flags "$out/share/path-to-application"
'';

Here's a full example: element-desktop

Could you try building from source using a similar approach? Building from source would be beneficial because it would make this package available for platforms other than x86_64-linux.

@adisbladis
Copy link
Member

I gave a stab at packaging Radicle from source but it's currently not possible because it uses unstable rust features. I have my branch here: https://github.com/adisbladis/nixpkgs/tree/radicle-src.

We should nudge upstream to stop using unstable features and make it possible to compile Radicle with a stable rust compiler.

@bbigras
Copy link
Contributor

bbigras commented Dec 8, 2020

We should nudge upstream to stop using unstable features and make it possible to compile Radicle with a stable rust compiler.

There's no way to use rust nightly for a package?

@d-xo
Copy link
Contributor Author

d-xo commented Dec 8, 2020

Hey sorry, I spaced out on this a little. I've been working on a from source package, I just pushed what I have so far.

There are two issues remaining:

  1. as mentioned by @adisbladis, the usage of unstable features in the proxy. I was able to hack around this by using RUSTC_BOOTSTRAP, but I'm not sure if that's considered acceptable or not....
  2. Some of the tests are failing in the proxy package, I still wasn't able to figure out what's going on there. If I skip the tests everything seems to work fine (I was even able to submit a contribution using the resulting binary...).

oh, and I also bumped the package to the just released v0.1.5

@Nemo157
Copy link

Nemo157 commented Dec 8, 2020

  1. as mentioned by @adisbladis, the usage of unstable features in the proxy. I was able to hack around this by using RUSTC_BOOTSTRAP, but I'm not sure if that's considered acceptable or not....

The unstable features used are very unstable (as in may cause UB on some versions of the compiler), I would be wary of attempting to compile a package using anything other than the exact nightly compiler specified in the rust-toolchain.

@xla
Copy link

xla commented Dec 9, 2020

2\. Some of the tests are failing in the proxy package, I still wasn't able to figure out what's going on there. If I skip the tests everything seems to work fine (I was even able to submit a contribution using the resulting binary...).

If you share the failing test cases with the exact output I can help shed some light on it.

@d-xo
Copy link
Contributor Author

d-xo commented Dec 10, 2020

@xla here, thanks a lot! 🙏 ✨

@midchildan @adisbladis it seems that an appimage build with patched binaries is the way forward here. If you agree I'll revert to that?

Also as a side note I don't understand the ofborg error here, the package builds fine for me locally. What am I missing?

@midchildan
Copy link
Member

@xwvvvvwx

it seems that an appimage build with patched binaries is the way forward here. If you agree I'll revert to that?

It's ok with me. I appreciate your effort. Could you add also add a comment explaining why source builds are currently not possible with a link to this PR?

Also as a side note I don't understand the ofborg error here, the package builds fine for me locally. What am I missing?

Perhaps the test is attempting a network request?

@xla

Would it be possible to eventually remove unstable rust features? If so, I think it's best if we create a new issue upstream so that we could switch to doing source builds when it's ready.

@adisbladis
Copy link
Member

adisbladis commented Dec 11, 2020

it seems that an appimage build with patched binaries is the way forward here. If you agree I'll revert to that?

@xwvvvvwx I absolutely agree, let's not let perfect be the enemy of good. We can always fix a source build at a later stage.

@d-xo d-xo changed the title radicle-upstream: init at 0.1.4 radicle-upstream: init at 0.1.5 Dec 11, 2020
@d-xo
Copy link
Contributor Author

d-xo commented Dec 11, 2020

pushed a tweaked version of the patched appimage based package.

In this version of the package, I just drop the git-remote-rad helper directly in the users path, meaning they don't need to mess around with shell profiles. This is a nicer experience, but does mean that the prominent instructions in the app to do this are now wrong:

image

I could also patch the git-remote-rad binary that gets dropped into the home dir, but decided not to since it would make the package a bit messy, happy to change this if people want.

@maralorn
Copy link
Member

I think having this preinstalled for now is great.
Definitely something that upstream (no pun intended) should expose to packagers to tweak to their liking I'd say. But in my opinion that can wait.

@midchildan
Copy link
Member

I too think that we should keep it as is. Binary patching should be avoided as much as possible because it would require quite a lot more work to upgrade packages on a regular basis.

This could solved more cleanly by submitting a PR upstream to suppress the message if git-remote-rad is found in PATH.

@d-xo
Copy link
Contributor Author

d-xo commented Dec 15, 2020

rebased on master and addressed review comments.

@maralorn
Copy link
Member

Nice! So exited to test this!

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

8 participants