diff options
author | Samuel Rivas <samuelrivas@gmail.com> | 2016-04-03 21:11:38 +0200 |
---|---|---|
committer | Samuel Rivas <samuelrivas@gmail.com> | 2016-04-03 21:11:38 +0200 |
commit | 2b199537b7fc49a742c4650be55e52be99deed71 (patch) | |
tree | 994b69aa085930f980af2057206e563e60d48572 /pkgs/build-support/emacs | |
parent | c68c0a3c7c3c5c35371fd448fb19c9e9702f6850 (diff) |
emacsWithPackages: move bin and site-lisp to private share directory
This is to avoid unwanted side effects when installing a wrapped emacs in the environment: * All executables in the dependencies become available in the user environment * All site-lisp binaries in the dependencies become accessible to unwrapped emacs Also, both bin and site-lisp would generate conflicts so installing a wrapped emacs becomes really cumbersome
Diffstat (limited to 'pkgs/build-support/emacs')
-rw-r--r-- | pkgs/build-support/emacs/wrapper.nix | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/pkgs/build-support/emacs/wrapper.nix b/pkgs/build-support/emacs/wrapper.nix index efee43d852eae..7a85cfa1ed4f1 100644 --- a/pkgs/build-support/emacs/wrapper.nix +++ b/pkgs/build-support/emacs/wrapper.nix @@ -52,7 +52,8 @@ stdenv.mkDerivation { phases = [ "installPhase" ]; installPhase = '' mkdir -p $out/bin - mkdir -p $out/share/emacs/site-lisp + mkdir -p $out/share/emacs-with-packages/bin + mkdir -p $out/share/emacs-with-packages/site-lisp local requires for pkg in $explicitRequires; do @@ -60,29 +61,32 @@ stdenv.mkDerivation { done # requires now holds all requested packages and their transitive dependencies - siteStart="$out/share/emacs/site-lisp/site-start.el" + siteStart="$out/share/emacs-with-packages/site-lisp/site-start.el" # Begin the new site-start.el by loading the original, which sets some # NixOS-specific paths. Paths are searched in the reverse of the order # they are specified in, so user and system profile paths are searched last. cat >"$siteStart" <<EOF (load-file "$emacs/share/emacs/site-lisp/site-start.el") -(add-to-list 'load-path "$out/share/emacs/site-lisp") +(add-to-list 'load-path "$out/share/emacs-with-packages/site-lisp") +(add-to-list 'exec-path "$out/share/emacs-with-packages/bin") EOF linkPath() { local pkg=$1 - local path=$2 + local origin_path=$2 + local dest_path=$3 + # Add the path to the search path list, but only if it exists - if [[ -d "$pkg/$path" ]]; then - lndir -silent "$pkg/$path" "$out/$path" + if [[ -d "$pkg/$origin_path" ]]; then + lndir -silent "$pkg/$origin_path" "$out/$dest_path" fi } # Add a package's paths to site-start.el linkEmacsPackage() { - linkPath "$1" "bin" - linkPath "$1" "share/emacs/site-lisp" + linkPath "$1" "bin" "share/emacs-with-packages/bin" + linkPath "$1" "share/emacs/site-lisp" "share/emacs-with-packages/site-lisp" } # First, link all the explicitly-required packages. @@ -103,7 +107,7 @@ EOF local progname=$(basename "$prog") rm -f "$out/bin/$progname" makeWrapper "$prog" "$out/bin/$progname" \ - --suffix EMACSLOADPATH ":" "$out/share/emacs/site-lisp:" + --suffix EMACSLOADPATH ":" "$out/share/emacs-with-packages/site-lisp:" done mkdir -p $out/share |