From a706c3527bce27053feb2e7080470f64a31d26dd Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 25 May 2020 03:29:46 -0400 Subject: [PATCH] Simplify test/shell.nix And merge shell.head.nix into it. A different version can be passed in as an --arg --- test/shell.head.nix | 24 ------------------------ test/shell.nix | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 31 deletions(-) delete mode 100644 test/shell.head.nix diff --git a/test/shell.head.nix b/test/shell.head.nix deleted file mode 100644 index dd5e47ea1..000000000 --- a/test/shell.head.nix +++ /dev/null @@ -1,24 +0,0 @@ -# Builds an sandbox for Doom Emacs with Emacs HEAD (27/28). Warning: it compiles -# Emacs; this takes a while! -# -# To create a doom environment w/ Emacs 27/28 with the test config: -# -# nix-shell shell.head.nix -# -# Or from a custom DOOMDIR: -# -# nix-shell --argstr doomdir ~/.config/doom - -{ emacsdir ? "$(pwd)/../" -, doomdir ? "$(pwd)" -, doomlocaldir ? "$(pwd)/.local.nix.head" }: - -import ./shell.nix rec { - pkgs = import { - overlays = [ - (import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz)) - ]; - }; - emacs = pkgs.emacsGit; - inherit emacsdir doomdir doomlocaldir; -} diff --git a/test/shell.nix b/test/shell.nix index 4cd220174..f23aefc11 100644 --- a/test/shell.nix +++ b/test/shell.nix @@ -1,5 +1,5 @@ -# Builds a sandbox for Doom Emacs with the latest stable Emacs (26.3). Use this -# as a basis for module shell.nix's. +# Builds a sandbox for Emacs (and optionally, Doom) with a particular version of +# Emacs. Use this as a basis for module shell.nix's. # # Usage examples: # @@ -10,24 +10,31 @@ # With your own DOOMDIR: # # nix-shell --argstr doomdir ~/.config/doom +# +# With a specific version of Emacs +# +# nix-shell --arg emacs pkgs.emacs # 26.3 +# nix-shell --arg emacs pkgs.emacsUnstable # 27.x +# nix-shell --arg emacs pkgs.emacs # 28+ { pkgs ? (import {}) , emacs ? pkgs.emacs , emacsdir ? "$(pwd)/.." , doomdir ? "$(pwd)" -, doomlocaldir ? "$(pwd)/.local.nix" }: +, doomlocaldir ? "$(pwd)/.local" }: pkgs.stdenv.mkDerivation { name = "doom-emacs"; - buildInputs = with pkgs; [ + buildInputs = [ emacs - git - (ripgrep.override {withPCRE2 = true;}) + pkgs.git + (pkgs.ripgrep.override {withPCRE2 = true;}) ]; shellHook = '' + export EMACSVERSION="$(emacs --no-site-file --batch --eval '(princ emacs-version)')" export EMACSDIR="$(readlink -f "${emacsdir}")/" export DOOMDIR="$(readlink -f "${doomdir}")/" - export DOOMLOCALDIR="$(readlink -f "${doomlocaldir}")/" + export DOOMLOCALDIR="$(readlink -f "${doomlocaldir}").$EMACSVERSION/" export PATH="$EMACSDIR/bin:$PATH" echo "EMACSDIR=$EMACSDIR" echo "DOOMDIR=$DOOMDIR"