php: simplify version definitions (#493765)

This commit is contained in:
Maximilian Bosch
2026-02-28 14:21:09 +00:00
committed by GitHub
6 changed files with 78 additions and 245 deletions
-59
View File
@@ -1,59 +0,0 @@
{ callPackage, ... }@_args:
let
base = callPackage ./generic.nix (
_args
// {
version = "8.2.30";
hash = "sha256-EEggtsj8lZ3eSzNCE19CvavyRuhpGKFjgaF9hEfIZvo=";
}
);
in
base.withExtensions (
{ all, ... }:
with all;
[
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
imap
intl
ldap
mbstring
mysqli
mysqlnd
opcache
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]
)
-59
View File
@@ -1,59 +0,0 @@
{ callPackage, ... }@_args:
let
base = callPackage ./generic.nix (
_args
// {
version = "8.3.30";
hash = "sha256-gAt7btULc8jueETuXy98xhL6p4daCqfEUp6O1YZqUDA=";
}
);
in
base.withExtensions (
{ all, ... }:
with all;
[
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
imap
intl
ldap
mbstring
mysqli
mysqlnd
opcache
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]
)
-58
View File
@@ -1,58 +0,0 @@
{ callPackage, ... }@_args:
let
base = callPackage ./generic.nix (
_args
// {
version = "8.4.18";
hash = "sha256-WGsy2Szrz7yklcX2rRozZAVT0KnAv9LmcVM02VnPmFg=";
}
);
in
base.withExtensions (
{ all, ... }:
with all;
[
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
intl
ldap
mbstring
mysqli
mysqlnd
opcache
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]
)
-57
View File
@@ -1,57 +0,0 @@
{ callPackage, ... }@_args:
let
base = callPackage ./generic.nix (
_args
// {
version = "8.5.3";
hash = "sha256-/F7KvBg862TZ/KPc04e9KbK2dEgyavmY/eADEkkWgjs=";
}
);
in
base.withExtensions (
{ all, ... }:
with all;
[
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
intl
ldap
mbstring
mysqli
mysqlnd
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]
)
+76 -10
View File
@@ -1,4 +1,5 @@
{
lib,
callPackage,
stdenv,
llvmPackages,
@@ -6,16 +7,81 @@
}:
let
commonArgs = {
stdenv = if stdenv.cc.isClang then llvmPackages.stdenv else stdenv;
pcre2 = pcre2.override {
withJitSealloc = false; # See https://bugs.php.net/bug.php?id=78927 and https://bugs.php.net/bug.php?id=78630
};
};
mkPhp =
{ version, hash }:
let
base = callPackage ./generic.nix {
stdenv = if stdenv.cc.isClang then llvmPackages.stdenv else stdenv;
pcre2 = pcre2.override {
withJitSealloc = false; # See https://bugs.php.net/bug.php?id=78927 and https://bugs.php.net/bug.php?id=78630
};
inherit version hash;
};
in
base.withExtensions (
{ all, ... }:
with all;
[
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
intl
ldap
mbstring
mysqli
mysqlnd
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]
++ lib.optionals (lib.versionOlder version "8.4") [ all.imap ]
++ lib.optionals (lib.versionOlder version "8.5") [ all.opcache ]
);
in
{
php82 = callPackage ./8.2.nix commonArgs;
php83 = callPackage ./8.3.nix commonArgs;
php84 = callPackage ./8.4.nix commonArgs;
php85 = callPackage ./8.5.nix commonArgs;
php82 = mkPhp {
version = "8.2.30";
hash = "sha256-EEggtsj8lZ3eSzNCE19CvavyRuhpGKFjgaF9hEfIZvo=";
};
php83 = mkPhp {
version = "8.3.30";
hash = "sha256-gAt7btULc8jueETuXy98xhL6p4daCqfEUp6O1YZqUDA=";
};
php84 = mkPhp {
version = "8.4.18";
hash = "sha256-WGsy2Szrz7yklcX2rRozZAVT0KnAv9LmcVM02VnPmFg=";
};
php85 = mkPhp {
version = "8.5.3";
hash = "sha256-/F7KvBg862TZ/KPc04e9KbK2dEgyavmY/eADEkkWgjs=";
};
}
@@ -382,14 +382,14 @@ let
jq
]
}
new_version=$(curl --silent "https://www.php.net/releases/active" | jq --raw-output '."${lib.versions.major version}"."${lib.versions.majorMinor version}".version')
new_version=$(curl --silent "https://www.php.net/releases/active.php" | jq --raw-output '."${lib.versions.major version}"."${lib.versions.majorMinor version}".version')
update-source-version "$UPDATE_NIX_ATTR_PATH.unwrapped" "$new_version" "--file=$1"
'';
in
[
script
# Passed as an argument so that update.nix can ensure it does not become a store path.
(./. + "/${lib.versions.majorMinor version}.nix")
./default.nix
];
buildEnv = mkBuildEnv { } [ ];
withExtensions = mkWithExtensions { } [ ];