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 <a@tny.town>
This commit is contained in:
Andrew Pan 2023-08-31 12:53:48 -05:00 committed by Anderson Torres
parent e919958b42
commit 0f4255bf11

View File

@ -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);
};
}))
})