I would like to distribute binary packages but binary caches are annoying to set up and requires a server to be run at all time. Are there any other options for distributing binary packages similar to Debian’s .deb
files and Fedora’s .rpm
files?
nix-store --export
can be used to serialize store paths to NAR format. NAR format is also used when retrieving artifacts from e.g. Hydra.
I think nix-store
is a bit too low level and thus hard to use. IMO the user should only need to execute one command (such as dpkg -i
) to install the package. Also, can nix-store
create symlinks?
It sounds like what you want is to serialize the closure of a specific store path, which includes all its dependencies. nix-store --export
followed by nix-store --import
should work very similar to dpkg -i
, but it may not do what you’re after as they have no way for it to resolve your dependencies for you, as it only knows their hash. If you’re not after closure-copying, then I’m confused by your “it’s to low level and thus hard to use” and don’t know what you mean by “install a package”.
Producing a closure with nix-store
is illustrated by the man page, replace paths with nix-store paths:
nix-store --export $(nix-store -qR paths) > out
You could also use nix-copy-closure
, but it does not dump a file and instead requires an active connection to copy all missing paths
Also, can
nix-store
create symlinks?
Yes, nix-store
must be able to create symlinks for export and import to work correctly.