emacs: add currently compiling package dirs to load-path

Co-authored-by: Tad Fisher <tadfisher@gmail.com>

authored by Mauricio Collares Tad Fisher and committed by adisbladis ca4db1bc 56923181

+29 -20
+2 -2
pkgs/applications/editors/emacs-modes/elpa-packages.nix
··· 20 21 */ 22 23 - { lib, stdenv, texinfo }: 24 25 self: let 26 ··· 31 }; 32 33 elpaBuild = import ../../../build-support/emacs/elpa.nix { 34 - inherit lib stdenv texinfo; 35 inherit (self) emacs; 36 }; 37
··· 20 21 */ 22 23 + { lib, stdenv, texinfo, writeText }: 24 25 self: let 26 ··· 31 }; 32 33 elpaBuild = import ../../../build-support/emacs/elpa.nix { 34 + inherit lib stdenv texinfo writeText; 35 inherit (self) emacs; 36 }; 37
+2 -2
pkgs/build-support/emacs/elpa.nix
··· 1 # builder for Emacs packages built for packages.el 2 3 - { lib, stdenv, emacs, texinfo }: 4 5 with lib; 6 ··· 19 20 in 21 22 - import ./generic.nix { inherit lib stdenv emacs texinfo; } ({ 23 24 phases = "installPhase fixupPhase distPhase"; 25
··· 1 # builder for Emacs packages built for packages.el 2 3 + { lib, stdenv, emacs, texinfo, writeText }: 4 5 with lib; 6 ··· 19 20 in 21 22 + import ./generic.nix { inherit lib stdenv emacs texinfo writeText; } ({ 23 24 phases = "installPhase fixupPhase distPhase"; 25
+22 -3
pkgs/build-support/emacs/generic.nix
··· 1 # generic builder for Emacs packages 2 3 - { lib, stdenv, emacs, texinfo, ... }: 4 5 with lib; 6 ··· 49 propagatedBuildInputs = packageRequires; 50 propagatedUserEnvPkgs = packageRequires; 51 52 - setupHook = ./setup-hook.sh; 53 54 doCheck = false; 55 ··· 63 addEmacsNativeLoadPath = true; 64 65 postInstall = '' 66 find $out/share/emacs -type f -name '*.el' -print0 \ 67 | xargs -0 -n 1 -I {} -P $NIX_BUILD_CORES sh -c \ 68 - "emacs --batch --eval=\"(add-to-list 'comp-eln-load-path \\\"$out/share/emacs/native-lisp/\\\")\" -f batch-native-compile {} || true" 69 ''; 70 } 71
··· 1 # generic builder for Emacs packages 2 3 + { lib, stdenv, emacs, texinfo, writeText, ... }: 4 5 with lib; 6 ··· 49 propagatedBuildInputs = packageRequires; 50 propagatedUserEnvPkgs = packageRequires; 51 52 + setupHook = writeText "setup-hook.sh" '' 53 + source ${./emacs-funcs.sh} 54 + 55 + if [[ ! -v emacsHookDone ]]; then 56 + emacsHookDone=1 57 + 58 + # If this is for a wrapper derivation, emacs and the dependencies are all 59 + # run-time dependencies. If this is for precompiling packages into bytecode, 60 + # emacs is a compile-time dependency of the package. 61 + addEnvHooks "$hostOffset" addEmacsVars 62 + addEnvHooks "$targetOffset" addEmacsVars 63 + fi 64 + ''; 65 66 doCheck = false; 67 ··· 75 addEmacsNativeLoadPath = true; 76 77 postInstall = '' 78 + # Besides adding the output directory to the native load path, make sure 79 + # the current package's elisp files are in the load path, otherwise 80 + # (require 'file-b) from file-a.el in the same package will fail. 81 + mkdir -p $out/share/emacs/native-lisp 82 + source ${./emacs-funcs.sh} 83 + addEmacsVars "$out" 84 + 85 find $out/share/emacs -type f -name '*.el' -print0 \ 86 | xargs -0 -n 1 -I {} -P $NIX_BUILD_CORES sh -c \ 87 + "emacs --batch -f batch-native-compile {} || true" 88 ''; 89 } 90
+2 -2
pkgs/build-support/emacs/melpa.nix
··· 1 # builder for Emacs packages built for packages.el 2 # using MELPA package-build.el 3 4 - { lib, stdenv, fetchFromGitHub, emacs, texinfo }: 5 6 with lib; 7 ··· 28 29 in 30 31 - import ./generic.nix { inherit lib stdenv emacs texinfo; } ({ 32 33 ename = 34 if ename == null
··· 1 # builder for Emacs packages built for packages.el 2 # using MELPA package-build.el 3 4 + { lib, stdenv, fetchFromGitHub, emacs, texinfo, writeText }: 5 6 with lib; 7 ··· 28 29 in 30 31 + import ./generic.nix { inherit lib stdenv emacs texinfo writeText; } ({ 32 33 ename = 34 if ename == null
-10
pkgs/build-support/emacs/setup-hook.sh pkgs/build-support/emacs/emacs-funcs.sh
··· 32 fi 33 done 34 } 35 - 36 - if [[ ! -v emacsHookDone ]]; then 37 - emacsHookDone=1 38 - 39 - # If this is for a wrapper derivation, emacs and the dependencies are all 40 - # run-time dependencies. If this is for precompiling packages into bytecode, 41 - # emacs is a compile-time dependency of the package. 42 - addEnvHooks "$hostOffset" addEmacsVars 43 - addEnvHooks "$targetOffset" addEmacsVars 44 - fi
··· 32 fi 33 done 34 }
+1 -1
pkgs/top-level/emacs-packages.nix
··· 45 let 46 47 mkElpaPackages = import ../applications/editors/emacs-modes/elpa-packages.nix { 48 - inherit lib stdenv texinfo; 49 }; 50 51 # Contains both melpa stable & unstable
··· 45 let 46 47 mkElpaPackages = import ../applications/editors/emacs-modes/elpa-packages.nix { 48 + inherit lib stdenv texinfo writeText; 49 }; 50 51 # Contains both melpa stable & unstable