From b47ca8b8769883557ac1ef62a6fb1cd815f08fb6 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Thu, 6 Feb 2020 21:39:23 +0000 Subject: Support lorri From what I currently understand, lorri is a tool (sponsored by Target) that uses nix and direnv to build and switch between environments quickly and easily. When you run `lorri init` inside of a directory, lorri creates a shell.nix and an .envrc file. The .envrc file calls `eval "$(lorri direnv)"` and the shell.nix calls `.mkShell`, which creates a shell environment exposing dependencies on $PATH and environment variables. lorri uses direnv to ensure that $PATH and the environment variables are available depending on your CWD. lorri becomes especially powerful because of Emacs's `direnv-mode`, which ensures that Emacs buffers can access anything exposed by direnv as well. I still need to learn more about how lorri works and how it will affect my workflow, but I'm enjoying what I've seen thus far, and I'm optimistic about the road ahead. --- monzo_ynab/.envrc | 5 +++++ monzo_ynab/shell.nix | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 monzo_ynab/shell.nix (limited to 'monzo_ynab') diff --git a/monzo_ynab/.envrc b/monzo_ynab/.envrc index 265077343800..121cc134de18 100644 --- a/monzo_ynab/.envrc +++ b/monzo_ynab/.envrc @@ -1,5 +1,10 @@ # source_up traversing up directories until it finds the nearest .envrc file, # which it uses to extend the environment in this .envrc. +# +# Since ../.envrc calls `eval "$(lorri direnv)"`, the buildInputs and variables +# definitions inside of the attribute set passed to pkgs.mkShell become +# available here as well. source_up export client_id="$(pass show finance/monzo/client-id)" export client_secret="$(pass show finance/monzo/client-secret)" +eval "$(lorri direnv)" diff --git a/monzo_ynab/shell.nix b/monzo_ynab/shell.nix new file mode 100644 index 000000000000..836718d85f29 --- /dev/null +++ b/monzo_ynab/shell.nix @@ -0,0 +1,9 @@ +{ pkgs ? import {}, ... }: + +pkgs.mkShell { + buildInputs = [ + pkgs.go + pkgs.goimports + pkgs.godef + ]; +} -- cgit 1.4.1