From e1d79a8b6b9a15d0543ed88dda5650872e6537d7 Mon Sep 17 00:00:00 2001 From: surtur Date: Sat, 10 Sep 2022 23:44:31 +0200 Subject: [PATCH] home-manager: start managing direnv --- .config/direnv/direnvrc | 8 -------- nix/cli.nix | 9 +++++++++ nix/cli/direnv.nix | 24 ++++++++++++++++++++++++ nix/programs.nix | 2 ++ 4 files changed, 35 insertions(+), 8 deletions(-) delete mode 100644 .config/direnv/direnvrc create mode 100644 nix/cli.nix create mode 100644 nix/cli/direnv.nix diff --git a/.config/direnv/direnvrc b/.config/direnv/direnvrc deleted file mode 100644 index ddc37b1..0000000 --- a/.config/direnv/direnvrc +++ /dev/null @@ -1,8 +0,0 @@ -# as per https://github.com/direnv/direnv/wiki/Vim -add_extra_vimrc() { - local extravim="$(find_up .vimrc)" - if [ -n "$extravim" ]; then - echo "Adding extra .vimrc: ${extravim}" - path_add EXTRA_VIM $extravim - fi -} diff --git a/nix/cli.nix b/nix/cli.nix new file mode 100644 index 0000000..ad96a7e --- /dev/null +++ b/nix/cli.nix @@ -0,0 +1,9 @@ +{ + config, + pkgs, + ... +}: { + imports = [ + ./cli/direnv.nix + ]; +} diff --git a/nix/cli/direnv.nix b/nix/cli/direnv.nix new file mode 100644 index 0000000..183c922 --- /dev/null +++ b/nix/cli/direnv.nix @@ -0,0 +1,24 @@ +{ + config, + pkgs, + ... +}: { + programs.direnv = { + enable = true; + nix-direnv.enable = false; + stdlib = '' + if [ -f ''$HOME/.nix-profile/share/nix-direnv/direnvrc ]; then + source ''$HOME/.nix-profile/share/nix-direnv/direnvrc + fi + + # as per https://github.com/direnv/direnv/wiki/Vim + add_extra_vimrc() { + local extravim="''$(find_up .vimrc)" + if [ -n "''$extravim" ]; then + echo "Adding extra .vimrc: ''${extravim}" + path_add EXTRA_VIM ''$extravim + fi + } + ''; + }; +} diff --git a/nix/programs.nix b/nix/programs.nix index 4d66741..98c6515 100644 --- a/nix/programs.nix +++ b/nix/programs.nix @@ -6,5 +6,7 @@ imports = [ ./programs/helix.nix ./programs/newsboat.nix + + ./cli.nix ]; }