From 0b40ae50ca8d9094ecd314df31e077f318fc928f Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 22 Aug 2023 15:35:40 +0200 Subject: [PATCH] home: move direnv around, disable direnv logging, add helper command --- users/max/home.nix | 9 +-------- users/max/home/direnv.nix | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 users/max/home/direnv.nix diff --git a/users/max/home.nix b/users/max/home.nix index f206dad..c0cbb64 100644 --- a/users/max/home.nix +++ b/users/max/home.nix @@ -64,6 +64,7 @@ in imports = [ ./home/bat.nix ./home/editor + ./home/direnv.nix ./home/fzf.nix ./home/lsd.nix ./home/git.nix @@ -71,14 +72,6 @@ in ./home/ssh.nix ] ++ optionalDesktopModule; - # direnv - programs.direnv.enable = true; - programs.direnv.nix-direnv.enable = true; - programs.direnv.enableFishIntegration = false; - programs.direnv.enableZshIntegration = true; - programs.direnv.config = { - global.warn_timeout = "24h"; - }; programs.home-manager.enable = systemProfile == "headless"; programs.zsh.enable = true; home.activation = lib.mkIf (systemProfile == "headless") { diff --git a/users/max/home/direnv.nix b/users/max/home/direnv.nix new file mode 100644 index 0000000..aa37f7b --- /dev/null +++ b/users/max/home/direnv.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: + +let + use = pkgs.writeShellScriptBin "use" '' + echo "use ''${@:-flake}" >> .envrc + ${pkgs.direnv}/bin/direnv allow + ''; +in + +{ + programs.direnv = { + enable = true; + nix-direnv.enable = true; + enableFishIntegration = false; + enableZshIntegration = true; + config.global.warn_timeout = "24h"; + }; + + home.sessionVariables.DIRENV_LOG_FORMAT = ""; + + home.packages = [ use ]; +}