Name
nix serve - serve a Nix store as a HTTP binary cache
Synopsis
nix serve [option...]
Examples
-
Serve the local Nix store on the default port (8080), listening on localhost only:
# nix serve Listening on http://127.0.0.1:8080/ -
Serve the local store on all interfaces, on port 9000:
# nix serve --listen-address 0.0.0.0 --port 9000On another machine, you can then use this server as a substituter:
# nix copy --from http://other-host:8080 /nix/store/...-hello-2.12.1 -
Serve a chroot store as a binary cache:
# nix serve --store /tmp/my-store
Description
nix serve runs an HTTP server that exposes a Nix store as a binary
cache. Clients can fetch
store paths from this server by adding its URL to their list of
substituters.
NARs are served uncompressed.
Note
nix serveonly handlesGETandHEADrequests; it cannot be used to upload paths to the store. It also does not implement authentication or TLS — if you want to expose it to the public internet, run it behind a reverse proxy such as nginx.
To shut down the server, send it a SIGINT signal.
Options
-
--listen-addressaddressIP address to listen on (default:
127.0.0.1). Use0.0.0.0or::to listen on all interfaces. -
--port/-pportPort to listen on (default: 8080). Use 0 to dynamically allocate a free port.
-
--port-filepathWrite the bound port number to this file.
-
--prioritypriorityPriority of this cache (overrides the store's default).
Logging-related options
-
Set the logging verbosity level to 'debug'.
-
--log-formatformatSet the format of log output; one of
raw,internal-json,barorbar-with-logs. -
--print-build-logs/-LPrint full build logs on standard error.
-
Decrease the logging verbosity level.
-
--verbose/-vIncrease the logging verbosity level.
Miscellaneous global options
-
Show usage information.
-
Disable substituters and consider all previously downloaded files up-to-date.
-
--optionname valueSet the Nix configuration setting name to value (overriding
nix.conf). -
Consider all previously downloaded files out-of-date.
-
Show version information.
Note
See
man nix.conffor overriding configuration settings with command line flags.