LinuxCommandLibrary

nix-flake-info

Display information about a Nix flake

TLDR

Show flake metadata of the flake in the current directory

$ nix flake info
copy

Show flake metadata from GitHub as a json on a single line
$ nix flake info [github:owner/repo] --json --no-pretty
copy

Show flake metadata from Github as a multi-line indented json
$ nix flake info [github:owner/repo] --json --pretty
copy

SYNOPSIS

nix flake info [flake-reference] [options…]

PARAMETERS

--json
    Print output in JSON format instead of human-readable

--refresh
    Update flake inputs from original sources before querying

--fallback
    Fall back to flake.nix if flake.lock is missing

--impure
    Allow access to more files than pure evaluation permits

--package name
    Show JSON only for the specified package output

--override-input input flake-ref
    Override a specific input with another flake

--repair
    Repair missing or corrupt inputs in the lock file

--lock-file path
    Use a custom path for the flake's lock file

--no-write-lock-file
    Prevent writing updates to the lock file

--show-trace
    Display a detailed evaluation trace on errors

DESCRIPTION

The nix flake info command provides an overview of a Nix flake, a format for packaging Nix projects with locked dependencies for reproducibility. It shows details like the flake's URL, original and locked input versions, available outputs (packages, apps, checks, etc.), and flake metadata.

Flakes enable declarative, reproducible builds by specifying inputs in flake.nix and locking them in flake.lock. This command verifies flake structure, lists outputs, and detects issues like missing locks. Use it to inspect remote or local flakes before building or installing.

Output is human-readable by default but supports JSON for scripting. It requires flakes enabled (--extra-experimental-features flakes in older Nix). Ideal for developers checking dependencies or CI pipelines validating flakes.

CAVEATS

Requires Nix with flakes enabled (experimental in Nix < 2.18). Fails if flake lacks valid outputs or inputs. Remote flakes need network access unless cached.

EXAMPLE

nix flake info nixpkgs
Shows info for the nixpkgs flake from registry.

nix flake info --json github:NixOS/nixpkgs/nixos-unstable
Outputs structured JSON for parsing.

OUTPUT FIELDS

Includes url, locked/{inputs,outputs}, root, rev, description. Use --json to access programmatically.

HISTORY

Introduced experimentally in Nix 2.4 (2021) with the flakes feature by Eelco Dolstra. Stabilized in Nix 2.18 (2024). Evolved to support JSON output and overrides for better tooling integration.

SEE ALSO

nix flake show(1), nix flake check(1), nix flake update(1), nix(1)

Copied to clipboard