From 69dfddd8b39cfe56da2bc2fea67cf2e55d41e054 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Fri, 1 Mar 2024 13:30:50 -0700 Subject: [PATCH] overlayFor: factor out with final; with commonDeps; Change-Id: I01bfc2cb6b7893a4440f3463d20032cf39ce9f88 --- flake.nix | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index 7d8ff0d8f..83d70d3e0 100644 --- a/flake.nix +++ b/flake.nix @@ -391,17 +391,20 @@ ''; overlayFor = getStdenv: final: prev: - let currentStdenv = getStdenv final; in - { - nixStable = prev.nix; - - nix = - with final; - with commonDeps { + let + currentStdenv = getStdenv final; + comDeps = with final; commonDeps { inherit pkgs; inherit (currentStdenv.hostPlatform) isStatic; }; - let + inherit (final) stdenv boost; + in { + nixStable = prev.nix; + + # Forward from the previous stage as we don’t want it to pick the lowdown override + nixUnstable = prev.nixUnstable; + + nix = let canRunInstalled = currentStdenv.buildPlatform.canExecute currentStdenv.hostPlatform; in currentStdenv.mkDerivation (finalAttrs: { name = "nix-${version}"; @@ -412,13 +415,13 @@ outputs = [ "out" "dev" "doc" ]; - nativeBuildInputs = nativeBuildDeps; - buildInputs = buildDeps + nativeBuildInputs = comDeps.nativeBuildDeps; + buildInputs = comDeps.buildDeps # There have been issues building these dependencies - ++ lib.optionals (currentStdenv.hostPlatform == currentStdenv.buildPlatform) awsDeps - ++ lib.optionals finalAttrs.doCheck checkDeps; + ++ lib.optionals (currentStdenv.hostPlatform == currentStdenv.buildPlatform) comDeps.awsDeps + ++ lib.optionals finalAttrs.doCheck comDeps.checkDeps; - propagatedBuildInputs = propagatedDeps; + propagatedBuildInputs = comDeps.propagatedDeps; disallowedReferences = [ boost ]; @@ -443,11 +446,11 @@ ''} ''; - configureFlags = configureFlags ++ + configureFlags = comDeps.configureFlags ++ [ "--sysconfdir=/etc" ] ++ lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell" ++ [ (lib.enableFeature finalAttrs.doCheck "tests") ] ++ - lib.optionals finalAttrs.doCheck testConfigureFlags ++ + lib.optionals finalAttrs.doCheck comDeps.testConfigureFlags ++ lib.optional (!canRunInstalled) "--disable-doc-gen"; enableParallelBuilding = true;