Merge pull request #69045 from rycee/emacs-wrapper-using-runcommand

emacs: use runCommand to generate wrapper
This commit is contained in:
adisbladis 2019-09-27 12:58:38 +01:00 committed by GitHub
commit 17a388d9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 89 deletions

View File

@ -32,7 +32,7 @@ in customEmacsPackages.emacsWithPackages (epkgs: [ epkgs.evil epkgs.magit ])
*/ */
{ lib, lndir, makeWrapper, runCommand, stdenv }: self: { lib, lndir, makeWrapper, runCommand }: self:
with lib; let inherit (self) emacs; in with lib; let inherit (self) emacs; in
@ -45,11 +45,15 @@ let
else packagesFun; else packagesFun;
in in
stdenv.mkDerivation { runCommand
name = (appendToName "with-packages" emacs).name; (appendToName "with-packages" emacs).name
{
nativeBuildInputs = [ emacs lndir makeWrapper ]; nativeBuildInputs = [ emacs lndir makeWrapper ];
inherit emacs explicitRequires; inherit emacs explicitRequires;
preferLocalBuild = true;
allowSubstitutes = false;
# Store all paths we want to add to emacs here, so that we only need to add # Store all paths we want to add to emacs here, so that we only need to add
# one path to the load lists # one path to the load lists
deps = runCommand "emacs-packages-deps" deps = runCommand "emacs-packages-deps"
@ -131,10 +135,10 @@ stdenv.mkDerivation {
# they are specified in, so user and system profile paths are searched last. # they are specified in, so user and system profile paths are searched last.
rm -f $siteStart $siteStartByteCompiled $subdirs $subdirsByteCompiled rm -f $siteStart $siteStartByteCompiled $subdirs $subdirsByteCompiled
cat >"$siteStart" <<EOF cat >"$siteStart" <<EOF
(load-file "$emacs/share/emacs/site-lisp/site-start.el") (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/site-lisp")
(add-to-list 'exec-path "$out/bin") (add-to-list 'exec-path "$out/bin")
EOF EOF
# Link subdirs.el from the emacs distribution # Link subdirs.el from the emacs distribution
ln -s $emacs/share/emacs/site-lisp/subdirs.el -T $subdirs ln -s $emacs/share/emacs/site-lisp/subdirs.el -T $subdirs
@ -142,8 +146,9 @@ EOF
$emacs/bin/emacs --batch -f batch-byte-compile "$siteStart" "$subdirs" $emacs/bin/emacs --batch -f batch-byte-compile "$siteStart" "$subdirs"
''; '';
phases = [ "installPhase" ]; inherit (emacs) meta;
installPhase = '' }
''
mkdir -p "$out/bin" mkdir -p "$out/bin"
# Wrap emacs and friends so they find our site-start.el before the original. # Wrap emacs and friends so they find our site-start.el before the original.
@ -172,6 +177,4 @@ EOF
for dir in applications icons info man; do for dir in applications icons info man; do
ln -s $emacs/share/$dir $out/share/$dir ln -s $emacs/share/$dir $out/share/$dir
done done
''; ''
inherit (emacs) meta;
}

View File

@ -60,7 +60,7 @@ let
}; };
emacsWithPackages = import ../build-support/emacs/wrapper.nix { emacsWithPackages = import ../build-support/emacs/wrapper.nix {
inherit lib lndir makeWrapper stdenv runCommand; inherit lib lndir makeWrapper runCommand;
}; };
mkManualPackages = import ../applications/editors/emacs-modes/manual-packages.nix { mkManualPackages = import ../applications/editors/emacs-modes/manual-packages.nix {