Introducing relocatable.nix

A fun project created when I am tired of my work. May be helpful for someone.

4 Likes

That would be very cool. On how many things have you tried that yet?

Some small utilities, for bigger programs I’ve tried chromium, it can launch but failed to find certificates.
I haven’t figured it out yet, maybe some dedenpencies failed to be captured?

For some much bigger programs, like jetbrains.idea, the generated script is too long that /bin/sh refused to execute. I’m trying to find an appropriate approach to handle this situation.

These problems are now fixed in the latest commit. I’ve tested neovim, chromium and jetbrains.idea-community on a ubuntu virtual machine and they all works fine.

I didn’t know about nix bundle yet, a few questions:

  • Can I run a bundled application on a non-nix or nixos machine?
  • Will bundling something like neovim also include the config?
  • Depends on the bundler, but they are usually intended to be used on machines without nix. Because, why not install that derivation directly when you have nix?
  • Usually not, the bundler takes a derivation as its input and output the bundle application. It should include the runtime clsoure of the input derivation, which usually does not include the config of neovim. However you could write another derivation to introduce your config together with neovim into the closure.
2 Likes

This seems to be doing something roughly similar to GitHub - timjrd/nixrewrite: Prototype implementation of Nix store path rewriting . Is that correct?

Can we add this to GitHub - NixOS/bundlers ?

Oh I hadn’t heard of that project, yes they share similar ideas, but my tool generates self-extracted scripts that will rewrite store paths on the fly. It may be more convenient for arbitrary deployment.

Or maybe I reinvented the wheels, it happens : )

This was an experiment to turn the nixrewrite into a bundle: GitHub - tomberek/relocate. I’d love to have a variant of a rewriting approach available (either approach, or both? whatever makes the most sense) and maintained in the bundlers repo. Care to PR it?