From bbc9af1f0a30fe8106d6fb90f15ebb01845b3008 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Mon, 30 Nov 2020 14:20:28 +0100 Subject: [PATCH] tree-wide: do not use pkgs.extend in nixpkgs Each invocation of pkgs.extends adds 130MB of allocation to the hydra evaluator. We are already struggling with the amount of memory nixpkgs requires. `pkgs.extend` is a useful escape-hatch, but should be not be used inside of nixpkgs directly. --- doc/using/overlays.xml | 1 + pkgs/applications/audio/cadence/default.nix | 2 + pkgs/applications/gis/qgis/unwrapped.nix | 3 ++ .../video/openshot-qt/default.nix | 3 ++ pkgs/top-level/all-packages.nix | 44 +++---------------- pkgs/top-level/stage.nix | 3 ++ 6 files changed, 17 insertions(+), 39 deletions(-) diff --git a/doc/using/overlays.xml b/doc/using/overlays.xml index 4937e950885..caacb0a0462 100644 --- a/doc/using/overlays.xml +++ b/doc/using/overlays.xml @@ -28,6 +28,7 @@ + NOTE: DO NOT USE THIS in nixpkgs. Further overlays can be added by calling the pkgs.extend or pkgs.appendOverlays, although it is often preferable to avoid these functions, because they recompute the Nixpkgs fixpoint, which is somewhat expensive to do. diff --git a/pkgs/applications/audio/cadence/default.nix b/pkgs/applications/audio/cadence/default.nix index 53adb3f146f..ea8a5269625 100644 --- a/pkgs/applications/audio/cadence/default.nix +++ b/pkgs/applications/audio/cadence/default.nix @@ -96,5 +96,7 @@ mkDerivation rec { license = stdenv.lib.licenses.gpl2Plus; maintainers = with stdenv.lib.maintainers; [ worldofpeace ]; platforms = [ "x86_64-linux" ]; + # Needs QT 5.14 + broken = true; }; } diff --git a/pkgs/applications/gis/qgis/unwrapped.nix b/pkgs/applications/gis/qgis/unwrapped.nix index 13990c33875..54d3d598759 100644 --- a/pkgs/applications/gis/qgis/unwrapped.nix +++ b/pkgs/applications/gis/qgis/unwrapped.nix @@ -53,5 +53,8 @@ in mkDerivation rec { license = lib.licenses.gpl2Plus; platforms = with lib.platforms; linux; maintainers = with lib.maintainers; [ lsix ]; + # Our 3.10 LTS cannot use a newer Qt (5.15) version because it requires qtwebkit + # and our qtwebkit fails to build with 5.15. 01bcfd3579219d60e5d07df309a000f96b2b658b + broken = true; }; } diff --git a/pkgs/applications/video/openshot-qt/default.nix b/pkgs/applications/video/openshot-qt/default.nix index ede47ad061f..9245bdf03e4 100644 --- a/pkgs/applications/video/openshot-qt/default.nix +++ b/pkgs/applications/video/openshot-qt/default.nix @@ -55,5 +55,8 @@ mkDerivationWith python3Packages.buildPythonApplication rec { license = with licenses; gpl3Plus; maintainers = with maintainers; [ AndersonTorres ]; platforms = with platforms; unix; + # Cannot use a newer Qt (5.15) version because it requires qtwebkit + # and our qtwebkit fails to build with 5.15. 01bcfd3579219d60e5d07df309a000f96b2b658b + broken = true; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a0af82b8b14..56dfda43310 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9543,15 +9543,7 @@ in graalvm8-ee graalvm11-ee; - # Cannot use a newer Qt (5.15) version because it requires qtwebkit - # and our qtwebkit fails to build with 5.15. 01bcfd3579219d60e5d07df309a000f96b2b658b - openshot-qt = (pkgs.extend (final: prev: rec { - qt5 = if stdenv.isDarwin then prev.qt5 else prev.qt514; - libsForQt5 = if stdenv.isDarwin then prev.libsForQt5 else prev.libsForQt514; - pythonInterpreters = prev.pythonInterpreters.override { - pkgs = final; - }; - })).libsForQt5.callPackage ../applications/video/openshot-qt { }; + openshot-qt = libsForQt5.callPackage ../applications/video/openshot-qt { }; openspin = callPackage ../development/compilers/openspin { }; @@ -10541,12 +10533,7 @@ in python2Packages = python2.pkgs; python3Packages = python3.pkgs; - pythonInterpreters = callPackage ./../development/interpreters/python { - # Overrides that apply to all Python interpreters and their packages - # Generally, this should be avoided. - pkgs = pkgs.extend (final: _: { - }); - }; + pythonInterpreters = callPackage ./../development/interpreters/python { }; inherit (pythonInterpreters) python27 python36 python37 python38 python39 python310 python3Minimal pypy27 pypy36; # Python package sets. @@ -20227,17 +20214,7 @@ in bambootracker = libsForQt5.callPackage ../applications/audio/bambootracker { }; - cadence = let - # Use Qt 5.14 consistently - pkgs_ = pkgs.extend(_: prev: { - pythonInterpreters = prev.pythonInterpreters.override(oldAttrs: { - pkgs = oldAttrs.pkgs.extend(_: _: { - qt5 = pkgs.qt514; - libsForQt5 = pkgs.libsForQt514; - }); - }); - }); - in pkgs_.libsForQt514.callPackage ../applications/audio/cadence { }; + cadence = libsForQt5.callPackage ../applications/audio/cadence { }; cheesecutter = callPackage ../applications/audio/cheesecutter { }; @@ -23355,19 +23332,8 @@ in qemu-utils = callPackage ../applications/virtualization/qemu/utils.nix {}; - # Our 3.10 LTS cannot use a newer Qt (5.15) version because it requires qtwebkit - # and our qtwebkit fails to build with 5.15. 01bcfd3579219d60e5d07df309a000f96b2b658b - qgis-unwrapped = let - pkgs_ = pkgs.extend(_: prev: { - pythonInterpreters = prev.pythonInterpreters.override(oldAttrs: { - pkgs = oldAttrs.pkgs.extend(_: _: { - qt5 = pkgs.qt514; - libsForQt5 = pkgs.libsForQt514; - }); - }); - }); - in pkgs_.libsForQt514.callPackage ../applications/gis/qgis/unwrapped.nix { - withGrass = false; + qgis-unwrapped = libsForQt5.callPackage ../applications/gis/qgis/unwrapped.nix { + withGrass = false; }; qgis = callPackage ../applications/gis/qgis { }; diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 58b0300cc79..8fc460ca522 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -200,6 +200,9 @@ let then self else import ./stage.nix (args // { overlays = args.overlays ++ extraOverlays; }); + # NOTE: each call to extend causes a full nixpkgs rebuild, adding ~130MB + # of allocations. DO NOT USE THIS IN NIXPKGS. + # # Extend the package set with a single overlay. This preserves # preexisting overlays. Prefer to initialize with the right overlays # in one go when calling Nixpkgs, for performance and simplicity.