query
On this page

testEqualDerivation

pkgs.testers.testEqualDerivation

Functor
Docs pulled from | This Revision | about 1 hour ago


Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.

Noogle detected

This is a Functor

Learn about functors

Implementation

The following is the current implementation of this function.

assertion: a: b:
let
  drvA =
    builtins.unsafeDiscardOutputDependency
      a.drvPath or (throw "testEqualDerivation second argument must be a package");
  drvB =
    builtins.unsafeDiscardOutputDependency
      b.drvPath or (throw "testEqualDerivation third argument must be a package");
  name = if a ? name then "testEqualDerivation-${a.name}" else "testEqualDerivation";
in
if drvA == drvB then
  emptyFile
else
  runCommand name
    {
      inherit assertion drvA drvB;
      nativeBuildInputs = [ nix-diff ];
    }
    ''
      echo "$assertion"
      echo "However, the derivations differ:"
      echo
      echo nix-diff $drvA $drvB
      nix-diff $drvA $drvB
      exit 1
    ''