about summary refs log tree commit diff
path: root/pkgs/build-support/php/builders/v1/hooks/default.nix
blob: 4c0ba1b18801c665f63135147469d924b1f39303 (plain) (blame)
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,
  makeSetupHook,
  jq,
  writeShellApplication,
  moreutils,
  cacert,
  buildPackages,
}:

let
  php-script-utils = writeShellApplication {
    name = "php-script-utils";
    runtimeInputs = [ jq ];
    text = builtins.readFile ./php-script-utils.bash;
  };
in
{
  composerRepositoryHook = makeSetupHook {
    name = "composer-repository-hook.sh";
    propagatedBuildInputs = [
      jq
      moreutils
      cacert
    ];
    substitutions = {
      phpScriptUtils = lib.getExe php-script-utils;
    };
  } ./composer-repository-hook.sh;

  composerInstallHook = makeSetupHook {
    name = "composer-install-hook.sh";
    propagatedBuildInputs = [
      jq
      moreutils
      cacert
    ];
    substitutions = {
      # Specify the stdenv's `diff` by abspath to ensure that the user's build
      # inputs do not cause us to find the wrong `diff`.
      cmp = "${lib.getBin buildPackages.diffutils}/bin/cmp";
      phpScriptUtils = lib.getExe php-script-utils;
    };
  } ./composer-install-hook.sh;
}