composer-local-repo-plugin: init at 1.0.0

This commit is contained in:
Pol Dellaiera 2023-06-12 08:43:49 +02:00
parent db6bc2d6dd
commit 27e3b694e7
No known key found for this signature in database
GPG key ID: D476DFE9C67467CA
2 changed files with 115 additions and 0 deletions

View file

@ -0,0 +1,110 @@
{ stdenvNoCC, lib, fetchFromGitHub, composer, makeBinaryWrapper }:
let
composerKeys = stdenvNoCC.mkDerivation (finalComposerKeysAttrs: {
pname = "composer-keys";
version = "fa5a62092f33e094073fbda23bbfc7188df3cbc5";
src = fetchFromGitHub {
owner = "composer";
repo = "composer.github.io";
rev = "${finalComposerKeysAttrs.version}";
hash = "sha256-3Sfn71LDG1jHwuEIU8iEnV3k6D6QTX7KVIKVaNSuCVE=";
};
installPhase = ''
runHook preInstall
mkdir -p $out
install releases.pub $out/keys.tags.pub
install snapshots.pub $out/keys.dev.pub
runHook postInstall
'';
});
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "composer-local-repo-plugin";
version = "1.0.0";
src = fetchFromGitHub {
owner = "nix-community";
repo = "composer-local-repo-plugin";
rev = finalAttrs.version;
hash = "sha256-sjWV4JXK8YJ5XLASMPipKlk9u57352wIDV2PPFIP+sk=";
};
COMPOSER_CACHE_DIR = "/dev/null";
COMPOSER_MIRROR_PATH_REPOS = "1";
COMPOSER_HTACCESS_PROTECT = "0";
COMPOSER_DISABLE_NETWORK = "1";
nativeBuildInputs = [
makeBinaryWrapper
];
buildInputs = [
composer
];
configurePhase = ''
runHook preConfigure
export COMPOSER_HOME=${placeholder "out"}
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
# Configure composer globally
composer global init --quiet --no-interaction --no-ansi \
--name="nixos/composer" \
--homepage "https://nixos.org/" \
--description "Composer with nix-community/composer-local-repo-plugin" \
--license "MIT"
composer global config --quiet minimum-stability dev
composer global config --quiet prefer-stable true
composer global config --quiet autoloader-suffix "nixPredictableAutoloaderSuffix"
composer global config --quiet apcu-autoloader false
composer global config --quiet allow-plugins.nix-community/composer-local-repo-plugin true
composer global config --quiet repo.packagist false
composer global config --quiet repo.plugin path $src
# Install the local repository plugin
composer global require --quiet --no-ansi --no-interaction nix-community/composer-local-repo-plugin
runHook postBuild
'';
checkPhase = ''
runHook preCheck
composer global validate --no-ansi
composer global show --no-ansi nix-community/composer-local-repo-plugin
runHook postCheck
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -ar ${composerKeys}/* $out/
makeWrapper ${composer}/bin/composer $out/bin/composer-local-repo-plugin \
--prefix COMPOSER_HOME : $out
runHook postInstall
'';
meta = {
description = "Composer local repo plugin for Composer";
homepage = "https://github.com/nix-community/composer-local-repo-plugin";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ drupol ];
platforms = lib.platforms.all;
};
})

View file

@ -17991,6 +17991,11 @@ with pkgs;
# PHP interpreters, packages and extensions.
composer = callPackage ../development/tools/misc/composer { };
composer-local-repo-plugin = callPackage ../build-support/php/composer-local-repo-plugin.nix {};
#
# Set default PHP interpreter, extensions and packages
php = php82;