build-support/php: add composerNoDev
, composerNoPlugins
and composerNoScripts
attributes
This commit is contained in:
parent
1173a34d15
commit
3eb168da92
4 changed files with 34 additions and 11 deletions
|
@ -7,9 +7,13 @@ let
|
||||||
phpDrv = finalAttrs.php or php;
|
phpDrv = finalAttrs.php or php;
|
||||||
composer = finalAttrs.composer or phpDrv.packages.composer;
|
composer = finalAttrs.composer or phpDrv.packages.composer;
|
||||||
composer-local-repo-plugin = callPackage ./pkgs/composer-local-repo-plugin.nix { };
|
composer-local-repo-plugin = callPackage ./pkgs/composer-local-repo-plugin.nix { };
|
||||||
composerLock = finalAttrs.composerLock or null;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
composerLock = previousAttrs.composerLock or null;
|
||||||
|
composerNoDev = previousAttrs.composerNoDev or true;
|
||||||
|
composerNoPlugins = previousAttrs.composerNoPlugins or true;
|
||||||
|
composerNoScripts = previousAttrs.composerNoScripts or true;
|
||||||
|
|
||||||
nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [
|
nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [
|
||||||
composer
|
composer
|
||||||
composer-local-repo-plugin
|
composer-local-repo-plugin
|
||||||
|
@ -50,8 +54,13 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
composerRepository = phpDrv.mkComposerRepository {
|
composerRepository = phpDrv.mkComposerRepository {
|
||||||
inherit composer composer-local-repo-plugin composerLock;
|
inherit composer composer-local-repo-plugin;
|
||||||
inherit (finalAttrs) patches pname src vendorHash version;
|
inherit (finalAttrs) patches pname src vendorHash version;
|
||||||
|
|
||||||
|
composerLock = previousAttrs.composerLock or null;
|
||||||
|
composerNoDev = previousAttrs.composerNoDev or true;
|
||||||
|
composerNoPlugins = previousAttrs.composerNoPlugins or true;
|
||||||
|
composerNoScripts = previousAttrs.composerNoScripts or true;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = previousAttrs.meta or { } // {
|
meta = previousAttrs.meta or { } // {
|
||||||
|
|
|
@ -25,7 +25,14 @@ let
|
||||||
assert (lib.assertMsg (previousAttrs ? vendorHash) "mkComposerRepository expects vendorHash argument.");
|
assert (lib.assertMsg (previousAttrs ? vendorHash) "mkComposerRepository expects vendorHash argument.");
|
||||||
assert (lib.assertMsg (previousAttrs ? version) "mkComposerRepository expects version argument.");
|
assert (lib.assertMsg (previousAttrs ? version) "mkComposerRepository expects version argument.");
|
||||||
assert (lib.assertMsg (previousAttrs ? pname) "mkComposerRepository expects pname argument.");
|
assert (lib.assertMsg (previousAttrs ? pname) "mkComposerRepository expects pname argument.");
|
||||||
|
assert (lib.assertMsg (previousAttrs ? composerNoDev) "mkComposerRepository expects composerNoDev argument.");
|
||||||
|
assert (lib.assertMsg (previousAttrs ? composerNoPlugins) "mkComposerRepository expects composerNoPlugins argument.");
|
||||||
|
assert (lib.assertMsg (previousAttrs ? composerNoScripts) "mkComposerRepository expects composerNoScripts argument.");
|
||||||
{
|
{
|
||||||
|
composerNoDev = previousAttrs.composerNoDev or true;
|
||||||
|
composerNoPlugins = previousAttrs.composerNoPlugins or true;
|
||||||
|
composerNoScripts = previousAttrs.composerNoScripts or true;
|
||||||
|
|
||||||
name = "${previousAttrs.pname}-${previousAttrs.version}-composer-repository";
|
name = "${previousAttrs.pname}-${previousAttrs.version}-composer-repository";
|
||||||
|
|
||||||
# See https://github.com/NixOS/nix/issues/6660
|
# See https://github.com/NixOS/nix/issues/6660
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
declare composerHomeDir
|
|
||||||
declare composerRepository
|
declare composerRepository
|
||||||
declare version
|
declare version
|
||||||
|
declare composerNoDev
|
||||||
|
declare composerNoPlugins
|
||||||
|
declare composerNoScripts
|
||||||
|
|
||||||
preConfigureHooks+=(composerInstallConfigureHook)
|
preConfigureHooks+=(composerInstallConfigureHook)
|
||||||
preBuildHooks+=(composerInstallBuildHook)
|
preBuildHooks+=(composerInstallBuildHook)
|
||||||
|
@ -59,8 +61,9 @@ composerInstallBuildHook() {
|
||||||
--no-ansi \
|
--no-ansi \
|
||||||
--no-install \
|
--no-install \
|
||||||
--no-interaction \
|
--no-interaction \
|
||||||
--no-plugins \
|
${composerNoDev:+--no-dev} \
|
||||||
--no-scripts \
|
${composerNoPlugins:+--no-plugins} \
|
||||||
|
${composerNoScripts:+--no-scripts} \
|
||||||
update
|
update
|
||||||
|
|
||||||
echo "Finished composerInstallBuildHook"
|
echo "Finished composerInstallBuildHook"
|
||||||
|
@ -88,8 +91,9 @@ composerInstallInstallHook() {
|
||||||
composer \
|
composer \
|
||||||
--no-ansi \
|
--no-ansi \
|
||||||
--no-interaction \
|
--no-interaction \
|
||||||
--no-scripts \
|
${composerNoDev:+--no-dev} \
|
||||||
--no-plugins \
|
${composerNoPlugins:+--no-plugins} \
|
||||||
|
${composerNoScripts:+--no-scripts} \
|
||||||
install
|
install
|
||||||
|
|
||||||
# Remove packages.json, we don't need it in the store.
|
# Remove packages.json, we don't need it in the store.
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
declare composerHomeDir
|
|
||||||
declare composerLock
|
declare composerLock
|
||||||
declare version
|
declare version
|
||||||
|
declare composerNoDev
|
||||||
|
declare composerNoPlugins
|
||||||
|
declare composerNoScripts
|
||||||
|
|
||||||
preConfigureHooks+=(composerRepositoryConfigureHook)
|
preConfigureHooks+=(composerRepositoryConfigureHook)
|
||||||
preBuildHooks+=(composerRepositoryBuildHook)
|
preBuildHooks+=(composerRepositoryBuildHook)
|
||||||
|
@ -20,8 +22,9 @@ composerRepositoryConfigureHook() {
|
||||||
--no-ansi \
|
--no-ansi \
|
||||||
--no-install \
|
--no-install \
|
||||||
--no-interaction \
|
--no-interaction \
|
||||||
--no-plugins \
|
${composerNoDev:+--no-dev} \
|
||||||
--no-scripts \
|
${composerNoPlugins:+--no-plugins} \
|
||||||
|
${composerNoScripts:+--no-scripts} \
|
||||||
update
|
update
|
||||||
echo "Using an autogenerated composer.lock file."
|
echo "Using an autogenerated composer.lock file."
|
||||||
fi
|
fi
|
||||||
|
@ -38,7 +41,7 @@ composerRepositoryBuildHook() {
|
||||||
# The command 'build-local-repo' is provided by the Composer plugin
|
# The command 'build-local-repo' is provided by the Composer plugin
|
||||||
# nix-community/composer-local-repo-plugin.
|
# nix-community/composer-local-repo-plugin.
|
||||||
COMPOSER_CACHE_DIR=/dev/null \
|
COMPOSER_CACHE_DIR=/dev/null \
|
||||||
composer-local-repo-plugin --no-ansi build-local-repo -r repository
|
composer-local-repo-plugin --no-ansi build-local-repo ${composerNoDev:+--no-dev} -r repository
|
||||||
|
|
||||||
echo "Finished composerRepositoryBuildHook"
|
echo "Finished composerRepositoryBuildHook"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue