blob: 601640b6f0bb9bc7e85ca4886a10f1dc2e0e6b55 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
{
php,
callPackage,
stdenvNoCC,
lib,
fetchFromGitHub,
makeBinaryWrapper,
}:
let
composer = callPackage ./composer-phar.nix { inherit (php.packages.composer) version pharHash; };
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.1.0";
src = fetchFromGitHub {
owner = "nix-community";
repo = "composer-local-repo-plugin";
rev = finalAttrs.version;
hash = "sha256-edbn07r/Uc1g0qOuVBZBs6N1bMN5kIfA1b4FCufdw5M=";
};
env = {
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 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;
};
})
|