core/pkgs/build-support/php/hooks/default.nix

28 lines
996 B
Nix
Raw Normal View History

2024-05-13 21:24:10 +00:00
{ lib, makeSetupHook, diffutils, jq, writeShellApplication, moreutils
, makeBinaryWrapper, cacert, buildPackages }:
2024-05-02 00:46:19 +00:00
let
php-script-utils = writeShellApplication {
name = "php-script-utils";
runtimeInputs = [ jq ];
text = builtins.readFile ./php-script-utils.bash;
};
2024-05-13 21:24:10 +00:00
in {
composerRepositoryHook = makeSetupHook {
name = "composer-repository-hook.sh";
propagatedBuildInputs = [ jq moreutils cacert ];
substitutions = { phpScriptUtils = lib.getExe php-script-utils; };
} ./composer-repository-hook.sh;
2024-05-02 00:46:19 +00:00
2024-05-13 21:24:10 +00:00
composerInstallHook = makeSetupHook {
name = "composer-install-hook.sh";
propagatedBuildInputs = [ jq makeBinaryWrapper 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;
2024-05-02 00:46:19 +00:00
}