From a333210fdc00f9891db773ff857860a8e9f7bd1e Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 19 Jan 2024 17:10:22 +0100 Subject: [PATCH] Only change cross stdenv Prevents mass rebuilds in x86, where the envvar doesn't have any effect. --- overlay.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/overlay.nix b/overlay.nix index 9cc6df6..6578708 100644 --- a/overlay.nix +++ b/overlay.nix @@ -33,9 +33,13 @@ final: prev: # To cross compile for riscv64, we need to populate this env variable, not # NIX_CFLAGS_COMPILE, otherwise we affect the packages for x86. - stdenv = prev.stdenvAdapters.addAttrsToDerivation { - NIX_CFLAGS_COMPILE_riscv64_unknown_linux_gnu = "-march=rv64g"; - } prev.stdenv; + stdenv = if prev.stdenv.buildPlatform != prev.stdenv.hostPlatform + then + prev.stdenvAdapters.addAttrsToDerivation { + NIX_CFLAGS_COMPILE_riscv64_unknown_linux_gnu = "-march=rv64g"; + } prev.stdenv + else + prev.stdenv; opensbi-uboot = prev.opensbi.overrideAttrs (old: { makeFlags = old.makeFlags ++ [