Bundle Nix derivations to run anywhere!
Go to file
Matthew Justin Bauer d4c15a15a0 Update README.md
2016-11-28 22:49:44 -06:00
.gitignore Mod .gitignore. 2016-06-15 18:53:25 +00:00
arx.nix Add nix-bundle.sh. 2016-11-26 01:05:43 -06:00
default.nix Add nix-bundle.sh. 2016-11-26 01:05:43 -06:00
install-nix-from-closure.sh Add nix installer. 2016-06-15 18:53:47 +00:00
makebootstrap.nix Add nix-bundle.sh. 2016-11-26 01:05:43 -06:00
maketar.nix Quiet output. 2016-11-28 22:15:41 -06:00
nix-bootstrap.nix Add nix-bundle.sh. 2016-11-26 01:05:43 -06:00
nix-bundle.sh Get rid of cg warning 2016-11-28 12:20:50 -06:00
nix-installer.nix Add nix-bundle.sh. 2016-11-26 01:05:43 -06:00
nix-user-chroot.nix Get rid of gcc hacks. 2016-11-28 22:11:50 -06:00
README.md Update README.md 2016-11-28 22:49:44 -06:00

nix-bundle

Benefits

  • Single-file output
  • Can be run by non-root users
  • No runtime
  • Distro agnostic
  • Completely portable
  • No installation

Getting started

Make sure you have installed Nix already. See http://nixos.org/nix/ for more details.

Once you have a working Nix install, you can run:

$ ./nix-bundle.sh hello /bin/hello

This will create the file "hello". Running it:

$ ./hello
Hello, world!

This is a standalone file that is completely portable! As long as you are running a Linux kernel with the same architecture that you ran the command on it will run. No external dependencies are required besides a compatible Linux kernel.

Some others to try:

./nix-bundle.sh nano /bin/nano
./nix-bundle.sh firefox /bin/firefox
./nix-bundle.sh emacs /bin/emacs

Comparison with AppImage, FlatPak, Snappy

TODO

How it works

Nix-bundle glues together four different projects to work correctly:

  • Nix - a functional package manager
  • nixpkgs
  • nix-user-chroot - a small bootstrap that uses Linux namespaces to
  • Arx - an archive execution tool

Drawbacks

Nix-bundle has some drawbacks that need to be worked on:

  • Slow startup
  • Large files (Firefox 150MB)
  • Only compatible Linux
  • Outputs built on x86-64 will not run on i386
  • Requires Linux kernel with CAP_SYS_USER_NS on and permissions setup correctly