{ config, lib, pkgs, ... }:

let
  cfg = config.samfelag.modules.dev.direnv;
in
{
  options.samfelag.modules.dev.direnv = {
    enable = lib.mkEnableOption "direnv";
  };
  config = lib.mkIf cfg.enable {
    hm.programs.direnv = {
      enable = true;
      nix-direnv.enable = true;
    };

    # Optional: To protect your nix-shell against garbage collection
    nix.extraOptions = ''
      keep-outputs = true
      keep-derivations = true
    '';
  };
}
