From 67d19f473ccd3e89c7af3d547e21cb2ba800a5bb Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 24 Jun 2022 17:34:54 +0300 Subject: [PATCH 1/4] phpPackage.mkExtension: makeOverridable --- pkgs/top-level/php-packages.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index 41c507a1aed..ce3af252abc 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -66,8 +66,8 @@ lib.makeScope pkgs.newScope (self: with self; { # # Build inputs is used for extra deps that may be needed. And zendExtension # will mark the extension as a zend extension or not. - mkExtension = - { name + mkExtension = lib.makeOverridable + ({ name , configureFlags ? [ "--enable-${name}" ] , internalDeps ? [ ] , postPhpize ? "" @@ -151,7 +151,7 @@ lib.makeScope pkgs.newScope (self: with self; { description = "PHP upstream extension: ${name}"; inherit (php.meta) maintainers homepage license; }; - }); + })); php = phpPackage; From 6bce3fc64efd39e7e6b6cc2917eb533afbe33719 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 24 Jun 2022 16:58:17 +0300 Subject: [PATCH 2/4] curl: use finalAttrs allows using the correct package in passthru remove unneeded replaceStrings in urls --- pkgs/tools/networking/curl/default.nix | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix index d0e3e7a61a6..f07789cd730 100644 --- a/pkgs/tools/networking/curl/default.nix +++ b/pkgs/tools/networking/curl/default.nix @@ -61,14 +61,14 @@ assert wolfsslSupport -> wolfssl != null; assert zlibSupport -> zlib != null; assert zstdSupport -> zstd != null; -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "curl"; version = "7.83.1"; src = fetchurl { urls = [ - "https://curl.haxx.se/download/${pname}-${version}.tar.bz2" - "https://github.com/curl/curl/releases/download/${lib.replaceStrings ["."] ["_"] pname}-${version}/${pname}-${version}.tar.bz2" + "https://curl.haxx.se/download/curl-${finalAttrs.version}.tar.bz2" + "https://github.com/curl/curl/releases/download/curl-${finalAttrs.version}/curl-${finalAttrs.version}.tar.bz2" ]; sha256 = "sha256-9Tmjb7RKgmDsXZd+Tg290u7intkPztqpvDyfeKETv/A="; }; @@ -177,16 +177,21 @@ stdenv.mkDerivation rec { ln $out/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libcurl-gnutls${stdenv.hostPlatform.extensions.sharedLibrary}.4.4.0 ''; - passthru = { + passthru = let + useThisCurl = attr: attr.override { curl = finalAttrs.finalPackage; }; + in { inherit opensslSupport openssl; tests = { - inherit curlpp coeurl; - haskell-curl = haskellPackages.curl; - ocaml-curly = ocamlPackages.curly; - php-curl = phpExtensions.curl; - pycurl = python3.pkgs.pycurl; + curlpp = useThisCurl curlpp; + coeurl = useThisCurl coeurl; + haskell-curl = useThisCurl haskellPackages.curl; + ocaml-curly = useThisCurl ocamlPackages.curly; + pycurl = useThisCurl python3.pkgs.pycurl; + php-curl = useThisCurl phpExtensions.curl; + # error: attribute 'override' missing # Additional checking with support http3 protocol. - inherit (nixosTests) nginx-http3; + # nginx-http3 = useThisCurl nixosTests.nginx-http3; + nginx-http3 = nixosTests.nginx-http3; }; }; @@ -199,4 +204,4 @@ stdenv.mkDerivation rec { # Fails to link against static brotli or gss broken = stdenv.hostPlatform.isStatic && (brotliSupport || gssSupport); }; -} +}) From 47b58ff43ebaef0307f4ef2de4e760ced3066cbf Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 24 Jun 2022 19:25:32 +0300 Subject: [PATCH 3/4] curl: put tests in tests.withCheck curl is built many times during a stdenv rebuild they are a bottleneck --- pkgs/tools/networking/curl/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix index f07789cd730..60b324d716c 100644 --- a/pkgs/tools/networking/curl/default.nix +++ b/pkgs/tools/networking/curl/default.nix @@ -33,6 +33,8 @@ , ocamlPackages , phpExtensions , python3 +, tests +, fetchpatch }: # Note: this package is used for bootstrapping fetchurl, and thus @@ -152,7 +154,10 @@ stdenv.mkDerivation (finalAttrs: { CXX = "${stdenv.cc.targetPrefix}c++"; CXXCPP = "${stdenv.cc.targetPrefix}c++ -E"; - doCheck = true; + # takes 14 minutes on a 24 core and because many other packages depend on curl + # they cannot be run concurrently and are a bottleneck + # tests are available in passthru.tests.withCheck + doCheck = false; preCheck = '' patchShebangs tests/ '' + lib.optionalString stdenv.isDarwin '' @@ -182,6 +187,8 @@ stdenv.mkDerivation (finalAttrs: { in { inherit opensslSupport openssl; tests = { + withCheck = finalAttrs.finalPackage.overrideAttrs (_: { doCheck = true; }); + fetchpatch = tests.fetchpatch.simple.override { fetchpatch = fetchpatch.override { fetchurl = useThisCurl fetchurl; }; }; curlpp = useThisCurl curlpp; coeurl = useThisCurl coeurl; haskell-curl = useThisCurl haskellPackages.curl; From 7141ab0f0b404a95509503e7b16a7f0072a66902 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 29 Jun 2022 17:38:34 +0300 Subject: [PATCH 4/4] release: add tests.packageTestsForChannelBlockers.curl.withCheck as a channel blocker we can't add 'nixpkgs.curl.tests' to hydra jobs due to 'tests' (and 'passthru') being stripped TODO: add a function in lib-release.nix to get derivations and add `.x86_64-linux` to them then we can just point release files to nixpkgs.tests.packageTestsForChannelBlockers instead of nixpkgs.tests.packageTestsForChannelBlockers.curl.withCheck --- nixos/release-combined.nix | 1 + nixos/release-small.nix | 1 + pkgs/test/default.nix | 8 ++++++++ pkgs/top-level/release.nix | 2 ++ 4 files changed, 12 insertions(+) diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index 7f81ca1c69b..626a16bd9e2 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -156,6 +156,7 @@ in rec { (onSystems ["i686-linux"] "nixos.tests.zfs.installer") (onFullSupported "nixpkgs.emacs") (onFullSupported "nixpkgs.jdk") + (onFullSupported "nixpkgs.tests.packageTestsForChannelBlockers.curl.withCheck") ["nixpkgs.tarball"] ]; }; diff --git a/nixos/release-small.nix b/nixos/release-small.nix index 1d51b4e7f28..bd1e1b95d1f 100644 --- a/nixos/release-small.nix +++ b/nixos/release-small.nix @@ -120,6 +120,7 @@ in rec { "nixos.tests.proxy.x86_64-linux" "nixos.tests.simple.x86_64-linux" "nixpkgs.jdk.x86_64-linux" + "nixpkgs.tests.packageTestsForChannelBlockers.curl.withCheck.x86_64-linux" "nixpkgs.tarball" ]; }; diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 48bd6ac7746..f78e8099e72 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -24,6 +24,14 @@ with pkgs; config = callPackage ./config.nix { }; + # we can't add 'nixpkgs.curl.tests' to hydra jobs due to 'tests' (and 'passthru') being stripped + # TODO: add a function in lib-release.nix to get derivations and add `.x86_64-linux` to them + # then we can just point release files to nixpkgs.tests.packageTestsForChannelBlockers instead of + # nixpkgs.tests.packageTestsForChannelBlockers.curl.withCheck + packageTestsForChannelBlockers = recurseIntoAttrs { + curl = recurseIntoAttrs pkgs.curl.tests; + }; + haskell = callPackage ./haskell { }; cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; }; diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index bac3d1b1171..c2d21b196a8 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -97,6 +97,7 @@ let jobs.lib-tests jobs.pkgs-lib-tests jobs.stdenv.x86_64-linux + jobs.tests.packageTestsForChannelBlockers.curl.withCheck.x86_64-linux jobs.cargo.x86_64-linux jobs.go.x86_64-linux jobs.linux.x86_64-linux @@ -133,6 +134,7 @@ let ++ lib.collect lib.isDerivation jobs.stdenvBootstrapTools ++ lib.optionals supportDarwin.x86_64 [ jobs.stdenv.x86_64-darwin + jobs.tests.packageTestsForChannelBlockers.curl.withCheck.x86_64-darwin jobs.cargo.x86_64-darwin jobs.cachix.x86_64-darwin jobs.go.x86_64-darwin