about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/tools/build-managers/gnumake/default.nix25
-rw-r--r--pkgs/stdenv/linux/default.nix7
2 files changed, 27 insertions, 5 deletions
diff --git a/pkgs/development/tools/build-managers/gnumake/default.nix b/pkgs/development/tools/build-managers/gnumake/default.nix
index 7c4b0ad4650e8..7a6b78ec084ba 100644
--- a/pkgs/development/tools/build-managers/gnumake/default.nix
+++ b/pkgs/development/tools/build-managers/gnumake/default.nix
@@ -1,4 +1,16 @@
-{ lib, stdenv, fetchurl, guileSupport ? false, pkg-config, guile }:
+{ lib
+, stdenv
+, fetchurl
+, guileSupport ? false, guile
+# avoid guile depend on bootstrap to prevent dependency cycles
+, inBootstrap ? false
+, pkg-config
+, gnumake
+}:
+
+let
+  guileEnabled = guileSupport && !inBootstrap;
+in
 
 stdenv.mkDerivation rec {
   pname = "gnumake";
@@ -19,10 +31,10 @@ stdenv.mkDerivation rec {
     ./0002-remove-impure-dirs.patch
   ];
 
-  nativeBuildInputs = lib.optionals guileSupport [ pkg-config ];
-  buildInputs = lib.optionals guileSupport [ guile ];
+  nativeBuildInputs = lib.optionals guileEnabled [ pkg-config ];
+  buildInputs = lib.optionals guileEnabled [ guile ];
 
-  configureFlags = lib.optional guileSupport "--with-guile"
+  configureFlags = lib.optional guileEnabled "--with-guile"
 
     # Make uses this test to decide whether it should keep track of
     # subseconds. Apple made this possible with APFS and macOS 10.13.
@@ -36,6 +48,11 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "man" "info" ];
   separateDebugInfo = true;
 
+  passthru.tests = {
+    # make sure that the override doesn't break bootstrapping
+    gnumakeWithGuile = gnumake.override { guileSupport = true; };
+  };
+
   meta = with lib; {
     description = "A tool to control the generation of non-source files from sources";
     longDescription = ''
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index ff9602722bf3a..09a0a50c0037b 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -356,6 +356,10 @@ in
       #   stage5.gcc -> stage4.coreutils -> stage3.glibc -> bootstrap
       gmp = lib.makeOverridable (super.gmp.override { stdenv = self.stdenv; }).overrideAttrs (a: { pname = "${a.pname}-stage4"; });
 
+      # To allow users' overrides inhibit dependencies too heavy for
+      # bootstrap, like guile: https://github.com/NixOS/nixpkgs/issues/181188
+      gnumake = super.gnumake.override { inBootstrap = true; };
+
       gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) {
         nativeTools = false;
         nativeLibc = false;
@@ -446,7 +450,7 @@ in
       overrides = self: super: {
         inherit (prevStage)
           gzip bzip2 xz bash coreutils diffutils findutils gawk
-          gnumake gnused gnutar gnugrep gnupatch patchelf
+          gnused gnutar gnugrep gnupatch patchelf
           attr acl zlib pcre libunistring;
         ${localSystem.libc} = getLibc prevStage;
 
@@ -457,6 +461,7 @@ in
           inherit (self) stdenv runCommandLocal patchelf libunistring;
         };
 
+        gnumake = super.gnumake.override { inBootstrap = false; };
       } // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
         # Need to get rid of these when cross-compiling.
         inherit (prevStage) binutils binutils-unwrapped;