Scroll to navigation

nix3-store-prefetch-file(1) General Commands Manual nix3-store-prefetch-file(1)

Warning: This program is experimental and its interface is subject to change.


nix store prefetch-file - download a file into the Nix store


nix store prefetch-file [option…] url


Download a file to the Nix store:

# nix store prefetch-file
Downloaded '' to
'/nix/store/vbdbi42hgnc4h7pyqzp6h2yf77kw93aw-source' (hash
Download a file and get the SHA-512 hash:

# nix store prefetch-file --json --hash-type sha512 \ \ | jq -r .hash sha512-6XJxfym0TNH9knxeH4ZOvns6wElFy3uahunl2hJgovACCMEMXSy42s69zWVyGJALXTI+86tpDJGlIcAySEKBbA==


This command downloads the file url to the Nix store. It prints out the resulting store path and the cryptographic hash of the contents of the file.

The name component of the store path defaults to the last component of url, but this can be overridden using --name.


  • --executable
    Make the resulting file executable. Note that this causes the resulting hash to be a NAR hash rather than a flat file hash.
  • --expected-hash hash
    The expected hash of the file.
  • --hash-type hash-algo
    hash algorithm (‘md5’, ‘sha1’, ‘sha256’, or ‘sha512’)
  • --json
    Produce output in JSON format, suitable for consumption by another program.
  • --name name
    Override the name component of the resulting store path. It defaults to the base name of url.