Skip to content

Instantly share code, notes, and snippets.

@ajvargo
Created August 5, 2021 15:50
Show Gist options
  • Save ajvargo/d1d78de250a77620bc0438ea0ecfbc90 to your computer and use it in GitHub Desktop.
Save ajvargo/d1d78de250a77620bc0438ea0ecfbc90 to your computer and use it in GitHub Desktop.
Emacs helper to start aspects of my dev environment.
;;; These commands need to be executed when you are in the context of a nix-project.
;;; Requirements:
;; - direnv (shell and emacs)
;; - projectile (emacs)
(defun av-project-buffer-name-function (proc-name)
"Generate a buffer name based on `PROC-NAME'.
The name looks like '**<nix project> `PROC-NAME'**', **lello overmind**"
`(lambda (_mode-name)
(concat "**" ,(getenv "NIX_PROJECT") " " ,proc-name "**")))
(defun av-start (name command)
"Run `COMMAND' in `projectile-project-root' using `NAME' for the buffer name."
(let ((default-directory (projectile-project-root))
(compilation-buffer-name-function (av-project-buffer-name-function name)))
(compile command t)))
(defun av-overmind-start ()
"Run 'overmind start' in current nix project."
(interactive)
(av-start "overmind" "overmind s"))
(defun av-yarn-start ()
"Run 'yarn' in current nix project."
(interactive)
(av-start "yarn" "yarnme"))
(defun server-start ()
"Run 'bin/rails server' in current nix project."
(interactive)
(av-start "server" "bin/rails server"))
(defun av-lello ()
"Start overmind and yarn.
This is a convenience to getting Lello up."
(interactive)
(av-overmind-start)
(av-yarn-start))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment