mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
build-support/php: add composerNoDev
, composerNoPlugins
and composerNoScripts
attributes
This commit is contained in:
parent
1173a34d15
commit
3eb168da92
@ -7,9 +7,13 @@ let
|
||||
phpDrv = finalAttrs.php or php;
|
||||
composer = finalAttrs.composer or phpDrv.packages.composer;
|
||||
composer-local-repo-plugin = callPackage ./pkgs/composer-local-repo-plugin.nix { };
|
||||
composerLock = finalAttrs.composerLock or null;
|
||||
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 [ ]) ++ [
|
||||
composer
|
||||
composer-local-repo-plugin
|
||||
@ -50,8 +54,13 @@ let
|
||||
'';
|
||||
|
||||
composerRepository = phpDrv.mkComposerRepository {
|
||||
inherit composer composer-local-repo-plugin composerLock;
|
||||
inherit composer composer-local-repo-plugin;
|
||||
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 { } // {
|
||||
|
@ -25,7 +25,14 @@ let
|
||||
assert (lib.assertMsg (previousAttrs ? vendorHash) "mkComposerRepository expects vendorHash argument.");
|
||||
assert (lib.assertMsg (previousAttrs ? version) "mkComposerRepository expects version 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";
|
||||
|
||||
# See https://github.com/NixOS/nix/issues/6660
|
||||
|
@ -1,6 +1,8 @@
|
||||
declare composerHomeDir
|
||||
declare composerRepository
|
||||
declare version
|
||||
declare composerNoDev
|
||||
declare composerNoPlugins
|
||||
declare composerNoScripts
|
||||
|
||||
preConfigureHooks+=(composerInstallConfigureHook)
|
||||
preBuildHooks+=(composerInstallBuildHook)
|
||||
@ -59,8 +61,9 @@ composerInstallBuildHook() {
|
||||
--no-ansi \
|
||||
--no-install \
|
||||
--no-interaction \
|
||||
--no-plugins \
|
||||
--no-scripts \
|
||||
${composerNoDev:+--no-dev} \
|
||||
${composerNoPlugins:+--no-plugins} \
|
||||
${composerNoScripts:+--no-scripts} \
|
||||
update
|
||||
|
||||
echo "Finished composerInstallBuildHook"
|
||||
@ -88,8 +91,9 @@ composerInstallInstallHook() {
|
||||
composer \
|
||||
--no-ansi \
|
||||
--no-interaction \
|
||||
--no-scripts \
|
||||
--no-plugins \
|
||||
${composerNoDev:+--no-dev} \
|
||||
${composerNoPlugins:+--no-plugins} \
|
||||
${composerNoScripts:+--no-scripts} \
|
||||
install
|
||||
|
||||
# Remove packages.json, we don't need it in the store.
|
||||
|
@ -1,6 +1,8 @@
|
||||
declare composerHomeDir
|
||||
declare composerLock
|
||||
declare version
|
||||
declare composerNoDev
|
||||
declare composerNoPlugins
|
||||
declare composerNoScripts
|
||||
|
||||
preConfigureHooks+=(composerRepositoryConfigureHook)
|
||||
preBuildHooks+=(composerRepositoryBuildHook)
|
||||
@ -20,8 +22,9 @@ composerRepositoryConfigureHook() {
|
||||
--no-ansi \
|
||||
--no-install \
|
||||
--no-interaction \
|
||||
--no-plugins \
|
||||
--no-scripts \
|
||||
${composerNoDev:+--no-dev} \
|
||||
${composerNoPlugins:+--no-plugins} \
|
||||
${composerNoScripts:+--no-scripts} \
|
||||
update
|
||||
echo "Using an autogenerated composer.lock file."
|
||||
fi
|
||||
@ -38,7 +41,7 @@ composerRepositoryBuildHook() {
|
||||
# The command 'build-local-repo' is provided by the Composer plugin
|
||||
# nix-community/composer-local-repo-plugin.
|
||||
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"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user