about summary refs log tree commit diff
path: root/pkgs/sternenseemann/rust/default.nix
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-03-18 15:14:37 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-03-18 15:14:37 +0100
commit88e0867d362a836eca870b0efecbefa57069fad5 (patch)
treec93f585a755eb520647218a6a950b7de9c7add10 /pkgs/sternenseemann/rust/default.nix
parent06b78c72027ed680f9e8e1e59814dc300b83f8c3 (diff)
pkgs/sternenseemann/nix-env-diff: utility for comparing nix-env evals
nix-env-diff is a tiny utility which parses and compares the output of
`nix-env -qaP --out-path`, printing all changed and added out paths (or
attributes if desired). This facilitates a simple way to determine
rebuilds or changed reverse dependencies when working on nixpkgs in a
similar way as nixpkgs-review and ofborg do it.

Both the new evaluation and the base evaluation to compare against have
to be created manually using nix-env, which in turn also allows
considering attribute sets that are normally not evaluated do to missing
`lib.recurseIntoAttrs`. As an example, here is an example building all
changed attributes in `ocaml-ng.ocamlPackages_4_12`:

```
nix-env -qaP -A ocaml-ng.ocamlPackages_4_12 --out-path -f . \
  | nix-env-diff --attrs ./base-ocamlPackages_4_12 \
  | xargs -n 1 -P 4 nix-instantiate --quiet -A \
  | xargs nix-store --realise --builders 'ssh://edwin'
```

`./base-ocamlPackages_4_12` contains the result of the `nix-env`
invocation executed on the master branch.
Diffstat (limited to 'pkgs/sternenseemann/rust/default.nix')
-rw-r--r--pkgs/sternenseemann/rust/default.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/sternenseemann/rust/default.nix b/pkgs/sternenseemann/rust/default.nix
index f79644a8..bc4e785b 100644
--- a/pkgs/sternenseemann/rust/default.nix
+++ b/pkgs/sternenseemann/rust/default.nix
@@ -1,4 +1,5 @@
 { writeRustSimpleLib
+, writeRustSimpleBin
 , testRustSimple
 }:
 
@@ -13,8 +14,15 @@ let
       };
     } ./temp.rs);
 
+  nix-env-diff = writeRustSimpleBin "nix-env-diff" {
+    meta = {
+      description = "Print changed attrs / outpath for nix-env outputs";
+    };
+  } ./nix-env-diff.rs;
+
 in {
   inherit
     temp
+    nix-env-diff
     ;
   }