mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-10-26 08:42:01 +03:00
Bundle Nix derivations to run anywhere!
.gitignore | ||
arx.nix | ||
default.nix | ||
install-nix-from-closure.sh | ||
makebootstrap.nix | ||
maketar.nix | ||
nix-bootstrap.nix | ||
nix-bundle.sh | ||
nix-installer.nix | ||
nix-user-chroot.nix | ||
README.md |
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