summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/pa/patchPpdFilesHook/test.nix
blob: 30a8b62ff7436049812faa125b0b1e5b5c495e36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
  lib,
  replaceVars,
  diffutils,
  stdenv,
  patchPpdFilesHook,
}:

let
  inherit (lib.meta) getExe';

  input = replaceVars ./test.ppd {
    keep = "cmp";
    patch = "cmp";
    pathkeep = "/bin/cmp";
    pathpatch = "/bin/cmp";
  };

  output = replaceVars ./test.ppd {
    keep = "cmp";
    patch = getExe' diffutils "cmp";
    pathkeep = "/bin/cmp";
    pathpatch = getExe' diffutils "cmp";
  };
in

stdenv.mkDerivation {
  name = "${patchPpdFilesHook.name}-test";
  buildInputs = [ diffutils ];
  nativeBuildInputs = [
    diffutils
    patchPpdFilesHook
  ];
  dontUnpack = true;
  dontInstall = true;
  ppdFileCommands = [ "cmp" ];
  preFixup = ''
    install -D "${input}" "${placeholder "out"}/share/cups/model/test.ppd"
    install -D "${input}" "${placeholder "out"}/share/ppd/test.ppd"
  '';
  postFixup = ''
    diff --color --report-identical-files "${output}" "${placeholder "out"}/share/cups/model/test.ppd"
    diff --color --report-identical-files "${output}" "${placeholder "out"}/share/ppd/test.ppd"
  '';
}