From e89082346762164f5a9f7f3ebc3afa13fb964718 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Thu, 23 Jul 2020 21:34:55 +0200 Subject: [PATCH] emacs: Add native builds for nativeComp enabled emacsen --- pkgs/build-support/emacs/generic.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/build-support/emacs/generic.nix b/pkgs/build-support/emacs/generic.nix index 6fa27f0983927..956787ad59e4e 100644 --- a/pkgs/build-support/emacs/generic.nix +++ b/pkgs/build-support/emacs/generic.nix @@ -56,6 +56,16 @@ stdenv.mkDerivation ({ meta = defaultMeta // meta; } +// lib.optionalAttrs (emacs.nativeComp or false) { + + LIBRARY_PATH = "${lib.getLib stdenv.cc.libc}/lib"; + + postInstall = '' + find $out/share/emacs -type f -name '*.el' -print0 | xargs -0 -n 1 -I {} -P $NIX_BUILD_CORES sh -c "emacs --batch -f batch-native-compile {} || true" + ''; + +} + // removeAttrs args [ "buildInputs" "packageRequires" "meta" ])