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 `<nixpkgs>.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.
This commit is contained in:
parent
a91d00fd94
commit
b47ca8b876
4 changed files with 29 additions and 7 deletions
8
.envrc
8
.envrc
|
@ -1,7 +1 @@
|
||||||
export BRIEFCASE=~/briefcase
|
eval "$(lorri direnv)"
|
||||||
export DEPOT=~/depot
|
|
||||||
export NIXPKGS=$HOME/nixpkgs
|
|
||||||
export DESKTOP=zeno.lon.corp.google.com
|
|
||||||
export LAPTOP=seneca
|
|
||||||
export CLOUDTOP=wpcarro.c.googlers.com
|
|
||||||
NIX_PATH=nixpkgs=$NIXPKGS:depot=$DEPOT:briefcase=$BRIEFCASE
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
# source_up traversing up directories until it finds the nearest .envrc file,
|
# source_up traversing up directories until it finds the nearest .envrc file,
|
||||||
# which it uses to extend the environment in this .envrc.
|
# 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
|
source_up
|
||||||
export client_id="$(pass show finance/monzo/client-id)"
|
export client_id="$(pass show finance/monzo/client-id)"
|
||||||
export client_secret="$(pass show finance/monzo/client-secret)"
|
export client_secret="$(pass show finance/monzo/client-secret)"
|
||||||
|
eval "$(lorri direnv)"
|
||||||
|
|
9
monzo_ynab/shell.nix
Normal file
9
monzo_ynab/shell.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {}, ... }:
|
||||||
|
|
||||||
|
pkgs.mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
pkgs.go
|
||||||
|
pkgs.goimports
|
||||||
|
pkgs.godef
|
||||||
|
];
|
||||||
|
}
|
14
shell.nix
Normal file
14
shell.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {}, ... }:
|
||||||
|
|
||||||
|
pkgs.mkShell rec {
|
||||||
|
buildInputs = [];
|
||||||
|
# TODO(wpcarro): How does pkgs.mkShell handle exported and non-exported
|
||||||
|
# variable definitions?
|
||||||
|
BRIEFCASE = builtins.toPath ~/briefcase;
|
||||||
|
DEPOT = builtins.toPath ~/depot;
|
||||||
|
NIXPKGS = builtins.toPath ~/nixpkgs;
|
||||||
|
NIX_PATH="nixpkgs=${NIXPKGS}:depot=${DEPOT}:briefcase=${BRIEFCASE}";
|
||||||
|
DESKTOP = "zeno.lon.corp.google.com";
|
||||||
|
LAPTOP = "seneca";
|
||||||
|
CLOUDTOP = "wpcarro.c.googlers.com";
|
||||||
|
}
|
Loading…
Reference in a new issue