about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-03-27T10·47+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-03-27T10·59+0000
commit6b224a9e314b6faedd25fc5361a5bb6ac8c3e0a3 (patch)
treeac2eb6daf0d73d4b98a032feac679f5b5840cdd9
parent47a0b45f5f5620aa683f90186008526b8a4c6d68 (diff)
Drop support for lorri
Lorri does not cleanly integrate with my corporate device, which cannot run
NixOS. To expose dependencies to Emacs buffers, I will use nix-buffer.el, which
reads its values from dir-locals.nix. To easily expose dependencies from my
existing shell.nix files into dir-locals.nix, I wrote a Nix utility function.
-rw-r--r--.envrc7
-rw-r--r--configs/.config/nixpkgs/home.nix2
-rw-r--r--go/.envrc2
-rw-r--r--go/dir-locals.nix3
-rw-r--r--go/shell.nix6
-rw-r--r--monzo_ynab/.envrc9
-rw-r--r--monzo_ynab/dir-locals.nix3
-rw-r--r--monzo_ynab/shell.nix8
-rw-r--r--nixos/socrates/configuration.nix2
-rw-r--r--scratch/deepmind/part_two/.envrc1
-rw-r--r--scratch/deepmind/part_two/dir-locals.nix3
-rw-r--r--scratch/deepmind/part_two/shell.nix6
-rw-r--r--shell.nix13
-rw-r--r--tools/run/.envrc1
-rw-r--r--tools/run/dir-locals.nix3
-rw-r--r--tools/run/shell.nix8
-rw-r--r--utils/default.nix6
-rw-r--r--website/blog/.envrc1
-rw-r--r--website/goals/dir-locals.nix3
-rw-r--r--website/sandbox/nut-score/shell.nix8
20 files changed, 43 insertions, 52 deletions
diff --git a/.envrc b/.envrc
index 051d09d292a8..76937ae6f439 100644
--- a/.envrc
+++ b/.envrc
@@ -1 +1,6 @@
-eval "$(lorri direnv)"
+export BRIEFCASE="$(realpath ~/briefcase)"
+export DEPOT="$(realpath ~/depot)"
+export NIXPKGS="$(realpath ~/nixpkgs)"
+export NIX_PATH="nixpkgs=${NIXPKGS}:depot=${DEPOT}:briefcase=${BRIEFCASE}";
+export DESKTOP="zeno.lon.corp.google.com";
+export LAPTOP="seneca";
diff --git a/configs/.config/nixpkgs/home.nix b/configs/.config/nixpkgs/home.nix
index 2011381ab479..9c7d441658e0 100644
--- a/configs/.config/nixpkgs/home.nix
+++ b/configs/.config/nixpkgs/home.nix
@@ -208,8 +208,6 @@ in {
   # Support mouseless workflows.
   services.keynav.enable = true;
 
-  services.lorri.enable = true;
-
   services.gpg-agent = {
     enable = true;
     defaultCacheTtl = 8 * 60 * 60; # 8 hours
diff --git a/go/.envrc b/go/.envrc
index be81feddb1a5..1abb058f60d5 100644
--- a/go/.envrc
+++ b/go/.envrc
@@ -1 +1 @@
-eval "$(lorri direnv)"
\ No newline at end of file
+source_up
diff --git a/go/dir-locals.nix b/go/dir-locals.nix
new file mode 100644
index 000000000000..498f4b5055f8
--- /dev/null
+++ b/go/dir-locals.nix
@@ -0,0 +1,3 @@
+let
+  briefcase = import <briefcase> {};
+in briefcase.utils.nixBufferFromShell ./shell.nix
diff --git a/go/shell.nix b/go/shell.nix
index e98da7d0f84a..aab4123bff9a 100644
--- a/go/shell.nix
+++ b/go/shell.nix
@@ -1,6 +1,6 @@
-{ pkgs, ... }:
-
-pkgs.mkShell {
+let
+  pkgs = import <nixpkgs> {};
+in pkgs.mkShell {
   buildInputs = [
     pkgs.go
     pkgs.goimports
diff --git a/monzo_ynab/.envrc b/monzo_ynab/.envrc
index 16fd7e76a39c..14829cb12390 100644
--- a/monzo_ynab/.envrc
+++ b/monzo_ynab/.envrc
@@ -1,14 +1,7 @@
-# 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 monzo_client_id="$(pass show finance/monzo/client-id)"
 export monzo_client_secret="$(pass show finance/monzo/client-secret)"
-export store_path="$(pwd)"
 export ynab_personal_access_token="$(pass show finance/youneedabudget.com/personal-access-token)"
 export ynab_account_id="$(pass show finance/youneedabudget.com/personal-access-token)"
 export ynab_budget_id="$(pass show finance/youneedabudget.com/budget-id)"
-eval "$(lorri direnv)"
+export store_path="$(pwd)"
diff --git a/monzo_ynab/dir-locals.nix b/monzo_ynab/dir-locals.nix
new file mode 100644
index 000000000000..498f4b5055f8
--- /dev/null
+++ b/monzo_ynab/dir-locals.nix
@@ -0,0 +1,3 @@
+let
+  briefcase = import <briefcase> {};
+in briefcase.utils.nixBufferFromShell ./shell.nix
diff --git a/monzo_ynab/shell.nix b/monzo_ynab/shell.nix
index efdc5d3e4233..aab4123bff9a 100644
--- a/monzo_ynab/shell.nix
+++ b/monzo_ynab/shell.nix
@@ -1,11 +1,9 @@
-{ pkgs, briefcase, ... }:
-
-pkgs.mkShell {
+let
+  pkgs = import <nixpkgs> {};
+in pkgs.mkShell {
   buildInputs = [
     pkgs.go
     pkgs.goimports
     pkgs.godef
-    briefcase.monzo_ynab.job
-    briefcase.monzo_ynab.tokens
   ];
 }
diff --git a/nixos/socrates/configuration.nix b/nixos/socrates/configuration.nix
index 97a414cc4f90..a78da84d92e0 100644
--- a/nixos/socrates/configuration.nix
+++ b/nixos/socrates/configuration.nix
@@ -81,8 +81,6 @@ in {
 
   services.openssh.enable = true;
 
-  services.lorri.enable = true;
-
   systemd.services.gogs = {
     enable = true;
     description = "Easy-to-use Git server written in golang";
diff --git a/scratch/deepmind/part_two/.envrc b/scratch/deepmind/part_two/.envrc
index b80e28b4b815..1abb058f60d5 100644
--- a/scratch/deepmind/part_two/.envrc
+++ b/scratch/deepmind/part_two/.envrc
@@ -1,2 +1 @@
 source_up
-eval "$(lorri direnv)"
diff --git a/scratch/deepmind/part_two/dir-locals.nix b/scratch/deepmind/part_two/dir-locals.nix
new file mode 100644
index 000000000000..498f4b5055f8
--- /dev/null
+++ b/scratch/deepmind/part_two/dir-locals.nix
@@ -0,0 +1,3 @@
+let
+  briefcase = import <briefcase> {};
+in briefcase.utils.nixBufferFromShell ./shell.nix
diff --git a/scratch/deepmind/part_two/shell.nix b/scratch/deepmind/part_two/shell.nix
index 606dd7167f7c..65de884696d0 100644
--- a/scratch/deepmind/part_two/shell.nix
+++ b/scratch/deepmind/part_two/shell.nix
@@ -1,6 +1,6 @@
-{ pkgs ? import <nixpkgs> {}, ... }:
-
-pkgs.mkShell {
+let
+  pkgs = import <nixpkgs> {};
+in pkgs.mkShell {
   buildInputs = with pkgs; [
     nodejs
     python3
diff --git a/shell.nix b/shell.nix
deleted file mode 100644
index 674ae1da08b7..000000000000
--- a/shell.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-{ pkgs, ... }:
-
-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";
-}
diff --git a/tools/run/.envrc b/tools/run/.envrc
index b80e28b4b815..1abb058f60d5 100644
--- a/tools/run/.envrc
+++ b/tools/run/.envrc
@@ -1,2 +1 @@
 source_up
-eval "$(lorri direnv)"
diff --git a/tools/run/dir-locals.nix b/tools/run/dir-locals.nix
new file mode 100644
index 000000000000..498f4b5055f8
--- /dev/null
+++ b/tools/run/dir-locals.nix
@@ -0,0 +1,3 @@
+let
+  briefcase = import <briefcase> {};
+in briefcase.utils.nixBufferFromShell ./shell.nix
diff --git a/tools/run/shell.nix b/tools/run/shell.nix
index de192ae150c7..97d8ed61ec59 100644
--- a/tools/run/shell.nix
+++ b/tools/run/shell.nix
@@ -1,7 +1,9 @@
-{ pkgs, ... }:
-
-pkgs.mkShell {
+let
+  pkgs = import <nixpkgs> {};
+in pkgs.mkShell {
   buildInputs = with pkgs; [
     go
+    goimports
+    godef
   ];
 }
diff --git a/utils/default.nix b/utils/default.nix
index df9673daec70..d5130c10ccff 100644
--- a/utils/default.nix
+++ b/utils/default.nix
@@ -11,4 +11,10 @@
   wrapNonNixProgram = { path, as }: pkgs.writeShellScriptBin as ''
     exec ${path} "$@"
   '';
+
+  # Expose the buildInputs from a Nix shell to an Emacs buffer. Intended to be
+  # called from dir-locals.nix files.
+  nixBufferFromShell = path: let
+    shell = import path;
+  in pkgs.nixBufferBuilders.withPackages shell.buildInputs;
 }
diff --git a/website/blog/.envrc b/website/blog/.envrc
index b80e28b4b815..1abb058f60d5 100644
--- a/website/blog/.envrc
+++ b/website/blog/.envrc
@@ -1,2 +1 @@
 source_up
-eval "$(lorri direnv)"
diff --git a/website/goals/dir-locals.nix b/website/goals/dir-locals.nix
new file mode 100644
index 000000000000..498f4b5055f8
--- /dev/null
+++ b/website/goals/dir-locals.nix
@@ -0,0 +1,3 @@
+let
+  briefcase = import <briefcase> {};
+in briefcase.utils.nixBufferFromShell ./shell.nix
diff --git a/website/sandbox/nut-score/shell.nix b/website/sandbox/nut-score/shell.nix
deleted file mode 100644
index 501fc07c8fdc..000000000000
--- a/website/sandbox/nut-score/shell.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-let
-  pkgs = import <nixpkgs> {};
-in pkgs.mkShell {
-  name = "nut-score";
-  buildInputs = with pkgs; [
-    yarn
-  ];
-}