summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
authorAlan Pearce2023-04-11 15:12:03 +0200
committerAlan Pearce2023-04-11 15:12:03 +0200
commitd2711022cde38d2e0035edd917d7f17f2b7c9ff2 (patch)
tree167ad4754f3b8c169cd5a0afc041ac4e5050cb14 /user
parentaa43b171944d5393f23e6e2902ceb7191714ab03 (diff)
downloadnixfiles-d2711022cde38d2e0035edd917d7f17f2b7c9ff2.tar.lz
nixfiles-d2711022cde38d2e0035edd917d7f17f2b7c9ff2.tar.zst
nixfiles-d2711022cde38d2e0035edd917d7f17f2b7c9ff2.zip
Enable automatic per-project nix development shells with direnv
Diffstat (limited to 'user')
-rw-r--r--user/settings/development/base.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/user/settings/development/base.nix b/user/settings/development/base.nix
index a1ebca38..9de20fc4 100644
--- a/user/settings/development/base.nix
+++ b/user/settings/development/base.nix
@@ -2,7 +2,13 @@
 , lib
 , pkgs
 , ...
-}: {
+}:
+let
+  direnvHook = pkgs.runCommandLocal "direnv_hook" { } ''
+    ${pkgs.direnv}/bin/direnv hook zsh > $out
+  '';
+in
+{
   home.packages = with pkgs;
     [
       shellcheck
@@ -31,4 +37,14 @@
       ripgrep = super.ripgrep.override { withPCRE2 = true; };
     })
   ];
+
+  programs.direnv = {
+    enable = true;
+    nix-direnv = {
+      enable = true;
+    };
+  };
+  programs.zsh.initExtra = ''
+    source ${direnvHook}
+  '';
 }