Add test/shell.nix files for Emacs 26 & HEAD

This commit is contained in:
Henrik Lissner 2020-01-09 19:46:48 -05:00
parent 59a6cb72be
commit 18be6cd37b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 71 additions and 0 deletions

24
test/shell.head.nix Normal file
View file

@ -0,0 +1,24 @@
# 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;
}

47
test/shell.nix Normal file
View file

@ -0,0 +1,47 @@
# Builds a sandbox for Doom Emacs with the latest stable Emacs (26.3). Use this
# as a basis for module shell.nix's.
#
# Usage examples:
#
# To create a doom environment with the test config:
#
# nix-shell
#
# With your own DOOMDIR:
#
# nix-shell --argstr doomdir ~/.config/doom
{ pkgs ? (import <nixpkgs> {})
, emacs ? pkgs.emacs
, emacsdir ? "$(pwd)/.."
, doomdir ? "$(pwd)"
, doomlocaldir ? "$(pwd)/.local.nix" }:
pkgs.stdenv.mkDerivation {
name = "doom-emacs";
buildInputs = with pkgs; [
emacs
git
(ripgrep.override {withPCRE2 = true;})
];
shellHook = ''
export EMACSDIR="$(readlink -f "${emacsdir}")/"
export DOOMDIR="$(readlink -f "${doomdir}")/"
export DOOMLOCALDIR="$(readlink -f "${doomlocaldir}")/"
export PATH="$EMACSDIR/bin:$PATH"
echo "EMACSDIR=$EMACSDIR"
echo "DOOMDIR=$DOOMDIR"
echo "DOOMLOCALDIR=$DOOMLOCALDIR"
# Copy your existing repos over to optimize on install times (but not the
# builds, because that may contain stale bytecode).
mkdir -p "$DOOMLOCALDIR/straight"
pushd "$DOOMLOCALDIR/straight" >/dev/null
if [[ -d "$EMACSDIR/.local/straight/repos" && ! -d ./repos ]]; then
cp -r "$EMACSDIR/.local/straight/repos" ./repos
fi
popd >/dev/null
doom sync
'';
}