Run nix packages anywhere, inspired by appimage.
Run nix packages anywhere, inspired by appimage.
experimental-features = nix-command flakes
nix bundle --bundler 'github:Zzorz/NixImage#niximage' 'nixpkgs#hello'
hello-$version.tar.gz
in current work directory and run hello-$version/hello
hello-$version.tar.gz
to any machinehttps://github.com/user-attachments/assets/0d52aa46-249a-4ac9-90eb-79c0b4e4ea19
In summary, this tool is a combination of squashfuse and bubblewrap. Squashfs is used to pack the closure of drv.out into a single file, which is then mounted to a directory on the host system at runtime. Bubblewrap is used to create a new mount namespace and rebind the mounted Nix store to /nix/store.
Furthermore, during the build process, niximage will traverse all executable files under ${drv}/bin
and create the corresponding symbolic links. You can execute the files under ${drv}/bin/
via these symbolic links, or you can run the ${drv.name}.niximage
executable to get an interactive environment. In this environment, ${drv}/bin
will be prepended to the PATH environment variable.