Commit 53b2082993c2

Vincent Demeester <vincent@sbr.pm>
2019-06-27 17:00:22
profiles.direnv: initial direnv module
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent db48c0e
Changed files (3)
modules/profiles/direnv.nix
@@ -0,0 +1,43 @@
+{ config, lib, ... }:
+
+with lib;
+let
+  cfg = config.profiles.direnv;
+in
+{
+  options = {
+    profiles.direnv = {
+      enable = mkOption {
+        default = true;
+        description = "Enable direnv profile and configuration";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable (mkMerge [
+    {
+      programs.direnv = {
+        enable = true;
+        config = {
+          whitelist = {
+            prefix = [
+            "${config.home.homeDirectory}/src/github.com/knative"
+            "${config.home.homeDirectory}/src/github.com/openshift"
+            "${config.home.homeDirectory}/src/github.com/tektoncd"
+            "${config.home.homeDirectory}/src/github.com/vdemeester"
+            ];
+          };
+        };
+      };
+    }
+    (mkIf config.profiles.fish.enable {
+      programs.direnv.enableFishIntegration = true;
+    })
+    (mkIf config.profiles.zsh.enable {
+      programs.direnv.enableZshIntegration = true;
+    })
+    (mkIf config.profiles.bash.enable {
+      programs.direnv.enableBashIntegration = true;
+    })
+  ]);
+}
modules/profiles/fish.nix
@@ -19,7 +19,6 @@ in
     enable = true;
     shellAliases = import ./aliases.shell.nix;
     shellInit = ''
-      eval (${pkgs.direnv}/bin/direnv hook fish)
       # emacs ansi-term support
       if test -n "$EMACS"
         set -x TERM eterm-color
modules/module-list.nix
@@ -10,6 +10,7 @@
     ./profiles/dev.js.nix
     ./profiles/dev.python.nix
     ./profiles/dev.rust.nix
+    ./profiles/direnv.nix
     ./profiles/docker.nix
     ./profiles/emacs.nix
     ./profiles/finances.nix