nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, writeShellScript }:
2let
3 output = "hello";
4in
5(writeShellScript "test-script" ''
6 echo ${lib.escapeShellArg output}
7'').overrideAttrs
8 (old: {
9 checkPhase = old.checkPhase or "" + ''
10 expected=${lib.escapeShellArg output}
11 got=$("$target")
12 if [[ "$got" != "$expected" ]]; then
13 echo "wrong output: expected $expected, got $got"
14 exit 1
15 fi
16 '';
17 })