From bf3a7126463f45364abcf8d6012dde51e51e4b3f Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 1 May 2022 13:59:01 -0700 Subject: home: add a module for direnv --- home/direnv/default.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 home/direnv/default.nix (limited to 'home/direnv') diff --git a/home/direnv/default.nix b/home/direnv/default.nix new file mode 100644 index 0000000..89d0535 --- /dev/null +++ b/home/direnv/default.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.my.home.direnv; + fishEnabled = config.my.home.fish.enable; +in { + options.my.home.direnv = with lib; { + enable = mkEnableOption "direnv configuration"; + }; + + config = lib.mkIf cfg.enable { + programs.direnv = { + enable = true; + nix-direnv = { + enable = true; + enableFlakes = true; + }; + }; + + programs.fish.interactiveShellInit = lib.mkIf fishEnabled ( + # Using mkAfter to make it more likely to appear after other + # manipulations of the prompt. + lib.mkAfter '' + ${pkgs.direnv}/bin/direnv hook fish | source + ''); + + home.sessionVariables = { DIRENV_DEFAULT_FLAKE = "nixpkgs"; }; + }; +} -- cgit 1.4.1