From f6b4eb5c5a75317b3bf8913f16f466826789c33b Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski <2151333+piotrkwiecinski@users.noreply.github.com> Date: Mon, 26 Jan 2026 13:32:56 +0100 Subject: [PATCH] php: refactor top-level definitions --- pkgs/development/interpreters/php/default.nix | 21 ++++++++ pkgs/top-level/all-packages.nix | 49 ++++++------------- 2 files changed, 36 insertions(+), 34 deletions(-) create mode 100644 pkgs/development/interpreters/php/default.nix diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix new file mode 100644 index 000000000000..ba59bef5f802 --- /dev/null +++ b/pkgs/development/interpreters/php/default.nix @@ -0,0 +1,21 @@ +{ + callPackage, + stdenv, + llvmPackages, + pcre2, +}: + +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 + }; + }; +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; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b6e468fbb7d5..b134341e07b7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5381,45 +5381,26 @@ with pkgs; phpExtensions = recurseIntoAttrs php.extensions; phpPackages = recurseIntoAttrs php.packages; - # Import PHP85 interpreter, extensions and packages - php85 = callPackage ../development/interpreters/php/8.5.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 - }; - }; - php85Extensions = recurseIntoAttrs php85.extensions; - php85Packages = recurseIntoAttrs php85.packages; + # Import PHP interpreters + inherit (callPackage ./../development/interpreters/php { }) + php82 + php83 + php84 + php85 + ; - # Import PHP84 interpreter, extensions and packages - php84 = callPackage ../development/interpreters/php/8.4.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 - }; - }; - php84Extensions = recurseIntoAttrs php84.extensions; - php84Packages = recurseIntoAttrs php84.packages; + # PHP Extensions and Packages + php82Extensions = recurseIntoAttrs php82.extensions; + php82Packages = recurseIntoAttrs php82.packages; - # Import PHP83 interpreter, extensions and packages - php83 = callPackage ../development/interpreters/php/8.3.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 - }; - }; php83Extensions = recurseIntoAttrs php83.extensions; php83Packages = recurseIntoAttrs php83.packages; - # Import PHP82 interpreter, extensions and packages - php82 = callPackage ../development/interpreters/php/8.2.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 - }; - }; - php82Extensions = recurseIntoAttrs php82.extensions; - php82Packages = recurseIntoAttrs php82.packages; + php84Extensions = recurseIntoAttrs php84.extensions; + php84Packages = recurseIntoAttrs php84.packages; + + php85Extensions = recurseIntoAttrs php85.extensions; + php85Packages = recurseIntoAttrs php85.packages; polyml = callPackage ../development/compilers/polyml { }; polyml56 = callPackage ../development/compilers/polyml/5.6.nix { };