Skip to content

Commit

Permalink
phpPackages: convert to scope
Browse files Browse the repository at this point in the history
This will make it easier to make overridable.

Had to rename `packages` attribute to `tools` in `php-packages.nix` because `packages` is shadowed by `makeScope`.
  • Loading branch information
jtojnar committed Dec 15, 2020
1 parent f310317 commit 7e8b2b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
5 changes: 3 additions & 2 deletions pkgs/development/interpreters/php/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ let
php = generic filteredArgs;

php-packages = (callPackage ../../../top-level/php-packages.nix {
php = phpWithExtensions;
phpPackage = phpWithExtensions;
});

allExtensionFunctions = prevExtensionFunctions ++ [ extensions ];
Expand Down Expand Up @@ -112,7 +112,8 @@ let
phpIni = "${phpWithExtensions}/lib/php.ini";
unwrapped = php;
tests = nixosTests.php;
inherit (php-packages) packages extensions buildPecl;
inherit (php-packages) extensions buildPecl;
packages = php-packages.tools;
meta = php.meta // {
outputsToInstall = [ "out" ];
};
Expand Down
15 changes: 5 additions & 10 deletions pkgs/top-level/php-packages.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{ stdenv, lib, pkgs, fetchgit, php, autoconf, pkgconfig, re2c
{ stdenv, lib, pkgs, fetchgit, phpPackage, autoconf, pkgconfig, re2c
, gettext, bzip2, curl, libxml2, openssl, gmp, icu64, oniguruma, libsodium
, html-tidy, libzip, zlib, pcre, pcre2, libxslt, aspell, openldap, cyrus_sasl
, uwimap, pam, libiconv, enchant1, libXpm, gd, libwebp, libjpeg, libpng
, freetype, libffi, freetds, postgresql, sqlite, net-snmp, unixODBC, libedit
, readline, rsync, fetchpatch, valgrind
}:

let
lib.makeScope pkgs.newScope (self: with self; {
buildPecl = import ../build-support/build-pecl.nix {
php = php.unwrapped;
inherit lib;
Expand All @@ -21,15 +21,10 @@ let

pcre' = if (lib.versionAtLeast php.version "7.3") then pcre2 else pcre;

callPackage = pkgs.newScope {
inherit mkDerivation php buildPecl pcre';
};
in
{
inherit buildPecl;
php = phpPackage;

# This is a set of interactive tools based on PHP.
packages = {
tools = {
box = callPackage ../development/php-packages/box { };

composer = callPackage ../development/php-packages/composer { };
Expand Down Expand Up @@ -550,4 +545,4 @@ in

# Produce the final attribute set of all extensions defined.
in builtins.listToAttrs namedExtensions);
}
})

0 comments on commit 7e8b2b7

Please sign in to comment.