nix-hash

Installation
SKILL.md

Nix Hash

Hash Formats in Nix

Nix uses several hash encodings:

  • SRI (sha256-BASE64) — The modern standard, used in fetchFromGitHub, fetchurl, etc. Format: <algo>-<base64>
  • Hex / base16 (84a5d14c...) — The encoding most upstream projects publish
  • Base32 (020ay2q1...) — Nix-specific legacy encoding; still printed by default by nix-prefetch-url

SRI is the preferred format. Always use SRI hashes in new derivations.

Flat vs NAR Hashes

Which bytes get hashed depends on how the fetcher consumes the source:

  • Raw file bytes ("flat") — matches plain fetchurl (no unpack = true). Compute with nix hash file.
  • NAR serialisation of an unpacked tree — matches fetchFromGitHub, fetchzip, and any fetcher with unpack = true. Compute with nix hash path.
Installs
6
First Seen
Aug 25, 2026