From 0f4255bf112a34a6d4f8a159d2444d176f2d79db Mon Sep 17 00:00:00 2001 From: Andrew Pan Date: Thu, 31 Aug 2023 12:53:48 -0500 Subject: [PATCH] emacs: fix `env` shallow merge Fixes regression caused by #252244. `env` was first defined in its own attrset, which was merged with a second attrset: ```nix ... { env = { NATIVE_FULL_AOT = "1"; LIBRARY_PATH = lib.concatStringsSep ":" libGccJitLibraryPaths; }; } // { ... env.NIX_CFLAGS_COMPILE = ... ... } ``` In this situation, the `env` from the first attrset is not preserved, since `//` does a shallow merge. Signed-off-by: Andrew Pan --- pkgs/applications/editors/emacs/generic.nix | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/editors/emacs/generic.nix b/pkgs/applications/editors/emacs/generic.nix index 494355b4353e..77adcd27f500 100644 --- a/pkgs/applications/editors/emacs/generic.nix +++ b/pkgs/applications/editors/emacs/generic.nix @@ -140,12 +140,7 @@ let then llvmPackages_14.stdenv else stdenv) mkDerivation; in -mkDerivation (finalAttrs: (lib.optionalAttrs withNativeCompilation { - env = { - NATIVE_FULL_AOT = "1"; - LIBRARY_PATH = lib.concatStringsSep ":" libGccJitLibraryPaths; - }; -} // { +mkDerivation (finalAttrs: { pname = pname + (if noGui then "-nox" else if variant == "macport" then "-macport" @@ -341,10 +336,14 @@ mkDerivation (finalAttrs: (lib.optionalAttrs withNativeCompilation { ++ lib.optional withXwidgets "--with-xwidgets" ; - # Fixes intermittent segfaults when compiled with LLVM >= 7.0. - # See https://github.com/NixOS/nixpkgs/issues/127902 - env.NIX_CFLAGS_COMPILE = lib.optionalString (variant == "macport") - "-include ${./macport_noescape_noop.h}"; + env = lib.optionalAttrs withNativeCompilation { + NATIVE_FULL_AOT = "1"; + LIBRARY_PATH = lib.concatStringsSep ":" libGccJitLibraryPaths; + } // lib.optionalAttrs (variant == "macport") { + # Fixes intermittent segfaults when compiled with LLVM >= 7.0. + # See https://github.com/NixOS/nixpkgs/issues/127902 + NIX_CFLAGS_COMPILE = "-include ${./macport_noescape_noop.h}"; + }; enableParallelBuilding = true; @@ -405,4 +404,4 @@ mkDerivation (finalAttrs: (lib.optionalAttrs withNativeCompilation { meta = meta // { broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform); }; -})) +})