From 18be6cd37bbfddeec13aedc13901241b11a14575 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 9 Jan 2020 19:46:48 -0500 Subject: [PATCH] Add test/shell.nix files for Emacs 26 & HEAD --- test/shell.head.nix | 24 +++++++++++++++++++++++ test/shell.nix | 47 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 test/shell.head.nix create mode 100644 test/shell.nix diff --git a/test/shell.head.nix b/test/shell.head.nix new file mode 100644 index 000000000..dd5e47ea1 --- /dev/null +++ b/test/shell.head.nix @@ -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 { + 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 new file mode 100644 index 000000000..fb00ab446 --- /dev/null +++ b/test/shell.nix @@ -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 {}) +, 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 + ''; +}