A Rust port of nix-diff, a tool to explain why two Nix derivations differ.

.drv files (pre-built derivations).nix files (will be instantiated automatically)nixpkgs#hello, path:/path/to/flake#package)NO_COLOR environment variablenix run github:Mic92/nix-diff-rs
nix-diff [OPTIONS] <INPUT1> <INPUT2>
Arguments:
<INPUT1> First input (.drv file, store path, .nix file, or flake#attr)
<INPUT2> Second input (.drv file, store path, .nix file, or flake#attr)
Options:
--color <MODE> Color mode: always, auto, never (default: auto)
--no-inline-highlight Disable word-level highlighting within changed lines
--context <LINES> Number of context lines (default: 3)
--input-list-limit <N> Max added/removed inputs to list (default: 10)
--depth <N> Max recursion depth into input derivations
-v, --verbose Show output-path changes and full input lists
-h, --help Show this help message
By default, the output hides mechanical noise such as output-path changes
(which differ whenever anything else differs) and env vars that mirror
output paths ($out, $dev, ...). Use --verbose to show everything,
or --depth N to limit how deep the diff recurses into dependencies.
When color is enabled, changed words within changed lines are highlighted
with reverse-video (like delta or diff-so-fancy), so you can instantly
spot store-path hash changes and version bumps without scanning full lines.
Compare two derivations:
nix-diff /nix/store/abc123-hello.drv /nix/store/def456-hello.drv
Compare realized store paths:
nix-diff /nix/store/abc123-hello /nix/store/def456-hello
Compare Nix files (will be instantiated automatically):
nix-diff hello.nix goodbye.nix
Compare flake outputs:
# Compare packages from flakes
nix-diff nixpkgs#hello nixpkgs#hello-wayland
# Compare local flake outputs
nix-diff .#packages.x86_64-linux.myapp .#packages.x86_64-linux.myapp-dev
# Compare using flake paths
nix-diff path:/path/to/flake1#package path:/path/to/flake2#package
Limit recursion depth (useful when stdenv changed and you only care about the top-level differences):
nix-diff --depth 1 nixpkgs/nixos-25.11#hello nixpkgs/nixos-unstable#hello
Disable colors:
nix-diff --color never input1 input2
# or
NO_COLOR=1 nix-diff input1 input2
# Enter development shell
nix develop
# Build
cargo build
# Run tests
cargo test
# Run benchmarks
cargo bench
# Format code
nix fmt
BSD-3-Clause (same as the original nix-diff)
$ claude mcp add nix-diff-rs \
-- python -m otcore.mcp_server <graph>