pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / build-support / php / builders / v2 / build-composer-project.nix
blobbfbd2327812bcd822e32d741775ec23d03554177
2   nix-update-script,
3   stdenvNoCC,
4   lib,
5   php,
6 }:
8 let
9   buildComposerProjectOverride =
10     finalAttrs: previousAttrs:
12     let
13       phpDrv = finalAttrs.php or php;
14       composer = finalAttrs.composer or phpDrv.packages.composer;
15     in
16     {
17       composerLock = previousAttrs.composerLock or null;
18       composerNoDev = previousAttrs.composerNoDev or true;
19       composerNoPlugins = previousAttrs.composerNoPlugins or true;
20       composerNoScripts = previousAttrs.composerNoScripts or true;
21       composerStrictValidation = previousAttrs.composerStrictValidation or true;
23       nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [
24         composer
25         phpDrv
26         phpDrv.composerHooks2.composerInstallHook
27       ];
29       buildInputs = (previousAttrs.buildInputs or [ ]) ++ [ phpDrv ];
31       patches = previousAttrs.patches or [ ];
32       strictDeps = previousAttrs.strictDeps or true;
34       # Should we keep these empty phases?
35       configurePhase =
36         previousAttrs.configurePhase or ''
37           runHook preConfigure
39           runHook postConfigure
40         '';
42       buildPhase =
43         previousAttrs.buildPhase or ''
44           runHook preBuild
46           runHook postBuild
47         '';
49       doCheck = previousAttrs.doCheck or true;
50       checkPhase =
51         previousAttrs.checkPhase or ''
52           runHook preCheck
54           runHook postCheck
55         '';
57       installPhase =
58         previousAttrs.installPhase or ''
59           runHook preInstall
61           runHook postInstall
62         '';
64       doInstallCheck = previousAttrs.doInstallCheck or false;
65       installCheckPhase =
66         previousAttrs.installCheckPhase or ''
67           runHook preInstallCheck
69           runHook postInstallCheck
70         '';
72       composerVendor =
73         previousAttrs.composerVendor or (phpDrv.mkComposerVendor {
74           inherit composer;
75           inherit (finalAttrs)
76             patches
77             pname
78             src
79             vendorHash
80             version
81             ;
83           composerLock = previousAttrs.composerLock or null;
84           composerNoDev = previousAttrs.composerNoDev or true;
85           composerNoPlugins = previousAttrs.composerNoPlugins or true;
86           composerNoScripts = previousAttrs.composerNoScripts or true;
87           composerStrictValidation = previousAttrs.composerStrictValidation or true;
88         });
90       # Projects providing a lockfile from upstream can be automatically updated.
91       passthru = previousAttrs.passthru or { } // {
92         updateScript =
93           previousAttrs.passthru.updateScript
94             or (if finalAttrs.composerVendor.composerLock == null then nix-update-script { } else null);
95       };
97       meta = previousAttrs.meta or { } // {
98         platforms = lib.platforms.all;
99       };
100     };
102 args: (stdenvNoCC.mkDerivation args).overrideAttrs buildComposerProjectOverride