Simplify test/shell.nix

And merge shell.head.nix into it. A different version can be passed in
as an --arg
This commit is contained in:
Henrik Lissner 2020-05-25 03:29:46 -04:00
parent ccd1764acb
commit a706c3527b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 14 additions and 31 deletions

View file

@ -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 <nixpkgs> {
overlays = [
(import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz))
];
};
emacs = pkgs.emacsGit;
inherit emacsdir doomdir doomlocaldir;
}

View file

@ -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 <nixpkgs> {})
, 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"