Skip to content

Commit

Permalink
emacs: fix env shallow merge
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tnytown authored and AndersonTorres committed Aug 31, 2023
1 parent e919958 commit 0f4255b
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions pkgs/applications/editors/emacs/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -405,4 +404,4 @@ mkDerivation (finalAttrs: (lib.optionalAttrs withNativeCompilation {
meta = meta // {
broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform);
};
}))
})

0 comments on commit 0f4255b

Please sign in to comment.