Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php: Refactor to have the different versions as separate files #102818

Merged
merged 1 commit into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions pkgs/development/interpreters/php/7.3.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ callPackage, lib, stdenv, nixosTests, ... }@_args:

let
generic = (import ./generic.nix) _args;

base = callPackage generic (_args // {
version = "7.3.24";
sha256 = "1655rj4w63n5fkvdj3kz9f5jfyjgvzw8a6j8zkzgic1p42xszdsm";

# https://bugs.php.net/bug.php?id=76826
extraPatches = lib.optional stdenv.isDarwin ./php73-darwin-isfinite.patch;
});

in base.withExtensions ({ all, ... }: with all; ([
bcmath calendar curl ctype dom exif fileinfo filter ftp gd
gettext gmp hash iconv intl json ldap mbstring mysqli mysqlnd
opcache openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite
pgsql posix readline session simplexml sockets soap sodium sqlite3
tokenizer xmlreader xmlwriter zip zlib
] ++ lib.optionals (!stdenv.isDarwin) [ imap ]))
17 changes: 17 additions & 0 deletions pkgs/development/interpreters/php/7.4.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ callPackage, lib, stdenv, nixosTests, ... }@_args:

let
generic = (import ./generic.nix) _args;

base = callPackage generic (_args // {
version = "7.4.12";
sha256 = "0rwrl7xgfq2bbgmy34klgfsqa7v935074ibanmic9pwy4g676vvf";
});

in base.withExtensions ({ all, ... }: with all; ([
bcmath calendar curl ctype dom exif fileinfo filter ftp gd
gettext gmp iconv intl json ldap mbstring mysqli mysqlnd opcache
openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql
posix readline session simplexml sockets soap sodium sqlite3
tokenizer xmlreader xmlwriter zip zlib
] ++ lib.optionals (!stdenv.isDarwin) [ imap ]))
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# We have tests for PCRE and PHP-FPM in nixos/tests/php/ or
# both in the same attribute named nixosTests.php

{ callPackage, lib, stdenv, nixosTests }@_args:
{ callPackage, lib, stdenv, nixosTests, ... }:

let
generic =
Expand Down Expand Up @@ -271,34 +271,4 @@ let
outputsToInstall = [ "out" "dev" ];
};
};

php73base = callPackage generic (_args // {
version = "7.3.24";
sha256 = "1655rj4w63n5fkvdj3kz9f5jfyjgvzw8a6j8zkzgic1p42xszdsm";

# https://bugs.php.net/bug.php?id=76826
extraPatches = lib.optional stdenv.isDarwin ./php73-darwin-isfinite.patch;
});

php74base = callPackage generic (_args // {
version = "7.4.12";
sha256 = "0rwrl7xgfq2bbgmy34klgfsqa7v935074ibanmic9pwy4g676vvf";
});

defaultPhpExtensions = { all, ... }: with all; ([
bcmath calendar curl ctype dom exif fileinfo filter ftp gd
gettext gmp iconv intl json ldap mbstring mysqli mysqlnd opcache
openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql
posix readline session simplexml sockets soap sodium sqlite3
tokenizer xmlreader xmlwriter zip zlib
] ++ lib.optionals (!stdenv.isDarwin) [ imap ]);

defaultPhpExtensionsWithHash = { all, ... }:
(defaultPhpExtensions { inherit all; }) ++ [ all.hash ];

php74 = php74base.withExtensions defaultPhpExtensions;
php73 = php73base.withExtensions defaultPhpExtensionsWithHash;

in {
inherit php73 php74;
}
in generic
23 changes: 16 additions & 7 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10315,19 +10315,28 @@ in

pachyderm = callPackage ../applications/networking/cluster/pachyderm { };

php = php74;

# PHP interpreters, packages and extensions.
#
# Set default PHP interpreter, extensions and packages
php = php74;
phpExtensions = php74Extensions;
phpPackages = php74Packages;
php73Packages = recurseIntoAttrs php73.packages;
php74Packages = recurseIntoAttrs php74.packages;

phpExtensions = php74Extensions;
php73Extensions = recurseIntoAttrs php73.extensions;
# Import PHP74 interpreter, extensions and packages
php74 = callPackage ../development/interpreters/php/7.4.nix {
stdenv = if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv;
};
php74Extensions = recurseIntoAttrs php74.extensions;
php74Packages = recurseIntoAttrs php74.packages;

inherit (callPackage ../development/interpreters/php {
# Import PHP73 interpreter, extensions and packages
php73 = callPackage ../development/interpreters/php/7.3.nix {
stdenv = if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv;
}) php74 php73;
};
php73Extensions = recurseIntoAttrs php73.extensions;
php73Packages = recurseIntoAttrs php73.packages;


picoc = callPackage ../development/interpreters/picoc {};

Expand Down