Generalize emacs argument in shell.nix
This commit is contained in:
parent
8fc82cacdb
commit
132b8390d0
1 changed files with 17 additions and 6 deletions
|
@ -13,29 +13,40 @@
|
||||||
#
|
#
|
||||||
# With a specific version of Emacs
|
# With a specific version of Emacs
|
||||||
#
|
#
|
||||||
# nix-shell --arg emacs pkgs.emacs # 26.3
|
# nix-shell --arg emacs 26 # 26.3
|
||||||
# nix-shell --arg emacs pkgs.emacsUnstable # 27.x
|
# nix-shell --arg emacs 27 # 27.1
|
||||||
# nix-shell --arg emacs pkgs.emacs # 28+
|
# nix-shell --arg emacs 28 # HEAD
|
||||||
|
|
||||||
{ pkgs ? (import <nixpkgs> {})
|
{ pkgs ?
|
||||||
, emacs ? pkgs.emacs
|
import <nixpkgs> {
|
||||||
|
overlays = [
|
||||||
|
import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
, emacs ? 26
|
||||||
, emacsdir ? "$(pwd)/.."
|
, emacsdir ? "$(pwd)/.."
|
||||||
, doomdir ? "$(pwd)"
|
, doomdir ? "$(pwd)"
|
||||||
, doomlocaldir ? "$(pwd)/.local" }:
|
, doomlocaldir ? "$(pwd)/.local" }:
|
||||||
|
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
name = "doom-emacs";
|
name = "doom-emacs";
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
emacs
|
(if emacs == 28 then pkgs.emacsGit
|
||||||
|
else if emacs == 27 then pkgs.emacsUnstable
|
||||||
|
else pkgs.emacs)
|
||||||
pkgs.git
|
pkgs.git
|
||||||
(pkgs.ripgrep.override {withPCRE2 = true;})
|
(pkgs.ripgrep.override {withPCRE2 = true;})
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export EMACSVERSION="$(emacs --no-site-file --batch --eval '(princ emacs-version)')"
|
export EMACSVERSION="$(emacs --no-site-file --batch --eval '(princ emacs-version)')"
|
||||||
export EMACSDIR="$(readlink -f "${emacsdir}")/"
|
export EMACSDIR="$(readlink -f "${emacsdir}")/"
|
||||||
export DOOMDIR="$(readlink -f "${doomdir}")/"
|
export DOOMDIR="$(readlink -f "${doomdir}")/"
|
||||||
export DOOMLOCALDIR="$(readlink -f "${doomlocaldir}").$EMACSVERSION/"
|
export DOOMLOCALDIR="$(readlink -f "${doomlocaldir}").$EMACSVERSION/"
|
||||||
export PATH="$EMACSDIR/bin:$PATH"
|
export PATH="$EMACSDIR/bin:$PATH"
|
||||||
|
|
||||||
|
echo "Running Emacs $EMACSVERSION"
|
||||||
echo "EMACSDIR=$EMACSDIR"
|
echo "EMACSDIR=$EMACSDIR"
|
||||||
echo "DOOMDIR=$DOOMDIR"
|
echo "DOOMDIR=$DOOMDIR"
|
||||||
echo "DOOMLOCALDIR=$DOOMLOCALDIR"
|
echo "DOOMLOCALDIR=$DOOMLOCALDIR"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue