commit 53b2082993c29408040fe274762720c48a7e36e1
parent db48c0ee5a12fc4a99a291ab0bd846344d967a23
Author: Vincent Demeester <vincent@sbr.pm>
Date: Thu, 27 Jun 2019 17:00:22 +0200
profiles.direnv: initial direnv module
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/modules/module-list.nix b/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
diff --git a/modules/profiles/direnv.nix b/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;
+ })
+ ]);
+}
diff --git a/modules/profiles/fish.nix b/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