Use composer from nixpkgs
The composer pinned here, was outdated and broken with PHP 7.3, the default in NixOS 19.09
This commit is contained in:
parent
2fb157acaf
commit
a9911c1933
4 changed files with 7 additions and 38 deletions
|
@ -4,10 +4,10 @@
|
|||
|
||||
let
|
||||
composerEnv = import ./src/Composer2Nix/composer-env.nix {
|
||||
inherit (pkgs) stdenv writeTextFile fetchurl php unzip;
|
||||
inherit (pkgs) stdenv writeTextFile fetchurl php unzip phpPackages;
|
||||
};
|
||||
in
|
||||
import ./php-packages.nix {
|
||||
inherit composerEnv noDev;
|
||||
inherit (pkgs) fetchurl fetchgit fetchhg fetchsvn;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class Composer
|
|||
else if($preferredInstall == "dist")
|
||||
$params .= " --prefer-dist";
|
||||
|
||||
$composerPath = shell_exec("nix-build --no-out-link -E 'let pkgs = import <nixpkgs> {}; composerEnv = import ".__DIR__."/composer-env.nix { inherit (pkgs) stdenv writeTextFile fetchurl php unzip; }; in composerEnv.composer'");
|
||||
$composerPath = shell_exec("nix-build --no-out-link -E 'let pkgs = import <nixpkgs> {}; composerEnv = import ".__DIR__."/composer-env.nix { inherit (pkgs) stdenv writeTextFile fetchurl php unzip phpPackages; }; in composerEnv.composer'");
|
||||
if($composerPath === false)
|
||||
throw new Exception("Cannot deploy the composer Nix package!");
|
||||
|
||||
|
|
|
@ -81,7 +81,8 @@ class CompositionExpression extends NixASTNode
|
|||
"writeTextFile" => new NixInherit("pkgs"),
|
||||
"fetchurl" => new NixInherit("pkgs"),
|
||||
"php" => new NixInherit("pkgs"),
|
||||
"unzip" => new NixInherit("pkgs")
|
||||
"unzip" => new NixInherit("pkgs"),
|
||||
"phpPackages" => new NixInherit("pkgs")
|
||||
))
|
||||
), new NixFunInvocation(new NixImport(new NixFile($this->prefixRelativePath($this->outputFile))), array(
|
||||
"composerEnv" => new NixInherit(),
|
||||
|
|
|
@ -1,41 +1,9 @@
|
|||
# This file originates from composer2nix
|
||||
|
||||
{ stdenv, writeTextFile, fetchurl, php, unzip }:
|
||||
{ stdenv, writeTextFile, fetchurl, php, unzip, phpPackages }:
|
||||
|
||||
let
|
||||
composer = stdenv.mkDerivation {
|
||||
name = "composer-1.6.5";
|
||||
src = fetchurl {
|
||||
url = https://github.com/composer/composer/releases/download/1.6.5/composer.phar;
|
||||
sha256 = "07xkpg9y1dd4s33y3cbf7r5fphpgc39mpm066a8m9y4ffsf539f0";
|
||||
};
|
||||
buildInputs = [ php ];
|
||||
|
||||
# We must wrap the composer.phar because of the impure shebang.
|
||||
# We cannot use patchShebangs because the executable verifies its own integrity and will detect that somebody has tampered with it.
|
||||
|
||||
buildCommand = ''
|
||||
# Copy phar file
|
||||
mkdir -p $out/share/php
|
||||
cp $src $out/share/php/composer.phar
|
||||
chmod 755 $out/share/php/composer.phar
|
||||
|
||||
# Create wrapper executable
|
||||
mkdir -p $out/bin
|
||||
cat > $out/bin/composer <<EOF
|
||||
#! ${stdenv.shell} -e
|
||||
exec ${php}/bin/php $out/share/php/composer.phar "\$@"
|
||||
EOF
|
||||
chmod +x $out/bin/composer
|
||||
'';
|
||||
meta = {
|
||||
description = "Dependency Manager for PHP";
|
||||
#license = stdenv.licenses.mit;
|
||||
maintainers = [ stdenv.lib.maintainers.sander ];
|
||||
platforms = stdenv.lib.platforms.unix;
|
||||
};
|
||||
};
|
||||
|
||||
inherit (phpPackages) composer;
|
||||
buildZipPackage = { name, src }:
|
||||
stdenv.mkDerivation {
|
||||
inherit name src;
|
||||
|
|
Loading…
Reference in a new issue