~ruther/nixos-config

ref: 7febab38bb34a9254054a639c98c41f4b681c6c0 nixos-config/modules/shell/direnv.nix -rw-r--r-- 704 bytes
7febab38 — František Boháček feat: add initial configurations 1 year, 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
# Direnv
#
# create a shell.nix
# create a .envrc and add use nix shell.nix
# direnv allow
# add direnv package to emacs
# add 'eval "$(direnv hook zsh)"' to .zshrc (and same for bash)
#

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

{
  programs = lib.mkIf (config.programs.zsh.enable) {
    zsh = {
      shellInit = ''
        emulate zsh -c "$(direnv hook zsh)"
      '';
    };
  };

  environment = {
    systemPackages = with pkgs; [ direnv nix-direnv ];
    pathsToLink = [
      "/share/nix-direnv"
    ];
  };

  nix.settings = {
    keep-outputs = true;
    keep-derivations = true;
  };

  nixpkgs.overlays = [
    (self: super: { nix-direnv = super.nix-direnv.override { enableFlakes = true; }; } )
  ];
}
Do not follow this link