pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / build-support / php / builders / v2 / build-composer-vendor.nix
blobcbbe643d20f1ee571f160dd5f82e5a4cbcd491a8
2   stdenvNoCC,
3   lib,
4   php,
5 }:
7 let
8   mkComposerVendorOverride =
9     /*
10       We cannot destruct finalAttrs since the attrset below is used to construct it
11       and Nix currently does not support lazy attribute names.
12       {
13       php ? null,
14       composer ? null,
15       composerLock ? "composer.lock",
16       src,
17       vendorHash,
18       ...
19       }@finalAttrs:
20     */
21     finalAttrs: previousAttrs:
23     let
24       phpDrv = finalAttrs.php or php;
25       composer = finalAttrs.composer or phpDrv.packages.composer;
26     in
27     assert (lib.assertMsg (previousAttrs ? src) "mkComposerVendor expects src argument.");
28     assert (lib.assertMsg (previousAttrs ? vendorHash) "mkComposerVendor expects vendorHash argument.");
29     assert (lib.assertMsg (previousAttrs ? version) "mkComposerVendor expects version argument.");
30     assert (lib.assertMsg (previousAttrs ? pname) "mkComposerVendor expects pname argument.");
31     {
32       composerNoDev = previousAttrs.composerNoDev or true;
33       composerNoPlugins = previousAttrs.composerNoPlugins or true;
34       composerNoScripts = previousAttrs.composerNoScripts or true;
35       composerStrictValidation = previousAttrs.composerStrictValidation or true;
37       name = "${previousAttrs.pname}-${previousAttrs.version}-composer-repository";
39       # See https://github.com/NixOS/nix/issues/6660
40       dontPatchShebangs = previousAttrs.dontPatchShebangs or true;
42       nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [
43         composer
44         phpDrv
45         phpDrv.composerHooks2.composerVendorHook
46       ];
48       buildInputs = previousAttrs.buildInputs or [ ];
50       strictDeps = previousAttrs.strictDeps or true;
52       # Should we keep these empty phases?
53       configurePhase =
54         previousAttrs.configurePhase or ''
55           runHook preConfigure
57           runHook postConfigure
58         '';
60       buildPhase =
61         previousAttrs.buildPhase or ''
62           runHook preBuild
64           runHook postBuild
65         '';
67       doCheck = previousAttrs.doCheck or true;
68       checkPhase =
69         previousAttrs.checkPhase or ''
70           runHook preCheck
72           runHook postCheck
73         '';
75       installPhase =
76         previousAttrs.installPhase or ''
77           runHook preInstall
79           runHook postInstall
80         '';
82       doInstallCheck = previousAttrs.doInstallCheck or false;
83       installCheckPhase =
84         previousAttrs.installCheckPhase or ''
85           runHook preInstallCheck
87           runHook postInstallCheck
88         '';
90       outputHashMode = "recursive";
91       outputHashAlgo =
92         if (finalAttrs ? vendorHash && finalAttrs.vendorHash != "") then null else "sha256";
93       outputHash = finalAttrs.vendorHash or "";
94     };
96 args: (stdenvNoCC.mkDerivation args).overrideAttrs mkComposerVendorOverride