nix-flake-show
TLDR
Show all the outputs of the flake in the current directory
Show all the outputs of a flake on GitHub and print the output as a json on a single line
Show all the legacyPackages outputs of a flake on GitHub and print the output as a multi-line indented json
List all available flake templates for nix flake init
SYNOPSIS
nix flake show [options...] [flake-reference]
PARAMETERS
--all-systems
Show outputs for all systems supported by the flake
--json
Produce machine-readable JSON output
--package name
Show only the specified package
--allow-import-from-derivation
Allow flake inputs from derivation outputs (implies --impure)
--impure
Allow impure evaluation (access network, etc.)
--override-input input flake-ref
Override a specific input
--inputs-from flake
Use inputs from another flake
--lock-file path
Path to the lock file
--no-write-lock-file
Don't write or update the lock file
--refresh
Update inputs from upstream sources
--arg name expr
Pass Nix expression argument to flake
--argstr name str
Pass string argument to flake
DESCRIPTION
nix flake show is a command in the Nix package manager that inspects and displays the structure, outputs, and metadata of a Nix flake. Nix flakes provide a standardized, reproducible way to define Nix projects with inputs, outputs like packages, apps, devShells, checks, and modules.
Running the command on a directory with flake.nix or specifying a flake reference (e.g., github:NixOS/nixpkgs, nixpkgs) outputs a tree view of available outputs per system architecture (e.g., x86_64-linux). It lists packages, applications, NixOS modules, home-manager configurations, and more.
Key uses include exploring flake contents before building (nix build), evaluating (nix eval), or entering devShells. The --json option produces parseable JSON for scripting. Filters like --package narrow results. Impure evaluation options enable dynamic imports.
This command is vital for Nix users working with modern, flake-based projects, aiding discovery and reproducibility across systems.
CAVEATS
Flakes require Nix ≥2.4 with experimental-features = flakes enabled in nix.conf or via --extra-experimental-features flakes. Output assumes valid flake; invalid flakes error early.
TYPICAL OUTPUT
Tree format:
├── packages
│ └─x86_64-linux.default: hello
├── apps
└── devShells.x86_64-linux.default
EXAMPLE USAGE
nix flake show nixpkgs
Shows nixpkgs outputs.
nix flake show --json github:owner/repo --package hello
JSON for specific package.
HISTORY
Introduced in Nix 2.4 (Jan 2021) with experimental flake support. Enhanced in Nix 2.8+ for better UX and JSON output. Flakes stabilized as preferred Nix workflow in Nix 3.x, now default in NixOS and nixpkgs.


