Home

Awesome

niff

niff is a script that compares two Nix expressions and determines which attributes changed.

Furthermore, diff and pr have an --output argument for controlling the format of the output:

Examples

diff

Check one remote archive against another:

niff diff https://github.com/NixOS/nixpkgs/archive/master.zip https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz

Check a PR against a remote archive (note that the hashtag needs to be escaped):

niff diff pr://28167 https://github.com/NixOS/nixpkgs/archive/master.zip

Check a PR against a local expression:

niff diff pr://28167 ../nixpkgs

Instead of generating a list of attributes its possible to output them together with -A

niff diff pr://28167 ../nixpkgs` --output attrs

pr

To check a PR (note that with niff pr the scheme is not necessary):

niff pr 28167

path

To get a local path to the HEAD of a PR:

niff path pr://28167

To get a local path to a NIX_PATH prefix:

niff path nixpath://nixpkgs

How does it work?

  1. Fetch archives with nix-prefetch-url --unpack and keep the store path, or use a given path to local Nix expression
  2. Run nix-env -qaP to determine a list of attributes that are provided
  3. Compare lists of each expression and output

Arguments

Valid arguments are

Available schemes

General schemes.

SchemeExampleExplanation
file://file:///abs/path/to/expressionLocal expression or archive
https://https://github.com/NixOS/nixpkgs/archive/master.zipRemote archive
nixpath://nixpath://nixpkgsNIX_PATH prefix
github://github://org/repo/refGitHub reference

Nixpkgs-specific.

SchemeExampleExplanation
channel://channel:///nixos-unstableNixpkgs channel
ref://ref://stagingReference in nixpkgs repo
pr://pr://28032Nixpkgs pull request