From 61685d4a6e107972aed36dbdee42fef193017c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Thu, 23 Feb 2023 00:12:15 +0100 Subject: [PATCH] nix: improve substituter speed --- overlays/default.nix | 13 +++++++++++++ overlays/nix-increase-substituter-threadpool.diff | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 overlays/nix-increase-substituter-threadpool.diff diff --git a/overlays/default.nix b/overlays/default.nix index dcbe3de1..6b47b583 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -69,6 +69,19 @@ with final; { mlat-client = python3Packages.callPackage ./mlat-client.nix { }; + nixVersions = prev.nixVersions // { + stable = prev.nixVersions.stable.overrideAttrs (oldAttrs: { + patches = oldAttrs.patches or [ ] ++ [ + ./nix-increase-substituter-threadpool.diff + # request compression + (fetchpatch { + url = "https://github.com/NixOS/nix/pull/7712.patch"; + sha256 = "sha256-84C27RxOYi/pamvWLJ/NWsc9zf6VhUAA57llIn8DAT4="; + }) + ]; + }); + }; + openssh = prev.openssh.overrideAttrs (_: { # takes 30 minutes doCheck = false; diff --git a/overlays/nix-increase-substituter-threadpool.diff b/overlays/nix-increase-substituter-threadpool.diff new file mode 100644 index 00000000..9e243274 --- /dev/null +++ b/overlays/nix-increase-substituter-threadpool.diff @@ -0,0 +1,14 @@ +diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc +index fb985c97b..a509d6f4d 100644 +--- a/src/libstore/misc.cc ++++ b/src/libstore/misc.cc +@@ -102,7 +102,8 @@ void Store::queryMissing(const std::vector & targets, + downloadSize_ = narSize_ = 0; + + // FIXME: make async. +- ThreadPool pool(fileTransferSettings.httpConnections); ++ // https://github.com/NixOS/nix/issues/5118 ++ ThreadPool pool(300); + + struct State + {