diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-09-25 19:10:21 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-09-25 19:38:44 +0200 |
commit | cf599d3f991d23b37dc3783f2b2539c8c0dc064f (patch) | |
tree | 3caff2fa531d2a7a05390911dc8c314458dd068d /pkgs/applications/editors/emacs | |
parent | 8036ee50aa8e22cabef48961c54b25d6ac6c6a97 (diff) | |
download | nixlib-cf599d3f991d23b37dc3783f2b2539c8c0dc064f.tar nixlib-cf599d3f991d23b37dc3783f2b2539c8c0dc064f.tar.gz nixlib-cf599d3f991d23b37dc3783f2b2539c8c0dc064f.tar.bz2 nixlib-cf599d3f991d23b37dc3783f2b2539c8c0dc064f.tar.lz nixlib-cf599d3f991d23b37dc3783f2b2539c8c0dc064f.tar.xz nixlib-cf599d3f991d23b37dc3783f2b2539c8c0dc064f.tar.zst nixlib-cf599d3f991d23b37dc3783f2b2539c8c0dc064f.zip |
emacs: Clear the environment while dumping
This reduces the closure size of Emacs from 575 to 279 MiB. Dumping Emacs had a chance of leaking parts of the environment (such as $PATH) into the dumped executable. This hopefully fixes it. (It's a bit hard to tell since the effect is not deterministic.)
Diffstat (limited to 'pkgs/applications/editors/emacs')
-rw-r--r-- | pkgs/applications/editors/emacs/clean-env.patch | 15 | ||||
-rw-r--r-- | pkgs/applications/editors/emacs/default.nix | 6 |
2 files changed, 20 insertions, 1 deletions
diff --git a/pkgs/applications/editors/emacs/clean-env.patch b/pkgs/applications/editors/emacs/clean-env.patch new file mode 100644 index 000000000000..f80efeeef706 --- /dev/null +++ b/pkgs/applications/editors/emacs/clean-env.patch @@ -0,0 +1,15 @@ +Dump temacs in an empty environment to prevent -dev paths from ending +up in the dumped image. + +diff -ru -x '*~' emacs-25.3/src/Makefile.in emacs-25.3-new/src/Makefile.in +--- emacs-25.3/src/Makefile.in 2017-04-14 17:02:47.000000000 +0200 ++++ emacs-25.3-new/src/Makefile.in 2017-09-25 19:03:02.173861038 +0200 +@@ -532,7 +532,7 @@ + ifeq ($(CANNOT_DUMP),yes) + ln -f temacs$(EXEEXT) $@ + else +- LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump ++ env -i LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump + ifneq ($(PAXCTL_dumped),) + $(PAXCTL_dumped) $@ + endif diff --git a/pkgs/applications/editors/emacs/default.nix b/pkgs/applications/editors/emacs/default.nix index a00826b98214..af3298a5883e 100644 --- a/pkgs/applications/editors/emacs/default.nix +++ b/pkgs/applications/editors/emacs/default.nix @@ -34,7 +34,11 @@ stdenv.mkDerivation rec { sha256 = "02y00y9q42g1iqgz5qhmsja75hwxd88yrn9zp14lanay0zkwafi5"; }; - patches = (lib.optional stdenv.isDarwin ./at-fdcwd.patch); + enableParallelBuilding = true; + + patches = + [ ./clean-env.patch ] + ++ lib.optional stdenv.isDarwin ./at-fdcwd.patch; nativeBuildInputs = [ pkgconfig ] ++ lib.optionals srcRepo [ autoconf automake texinfo ] |