summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home-manager/cli.nix
blob: 6b5d261112798d64db1edac59a8436057573e06f (plain)
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
38
39
40
41
42
43
44
45
46
{pkgs, ... }: {
  imports = [ ./zsh.nix ];
  home-manager.users.makefu = {
    services.gpg-agent = {
      enable = true;
      defaultCacheTtl = 900;
      maxCacheTtl = 7200;
      defaultCacheTtlSsh = 3600;
      maxCacheTtlSsh = 86400;
      enableSshSupport = true;
      enableScDaemon = true;
    };
    programs.direnv = {
      stdlib = ''
use_nix() {
  local cache=".direnv.$(nixos-version --hash)"

  if [[ ! -e "$cache" ]] || \
    [[ "$HOME/.direnvrc" -nt "$cache" ]] || \
    [[ ".envrc" -nt "$cache" ]] || \
    [[ "default.nix" -nt "$cache" ]] || \
    [[ "shell.nix" -nt "$cache" ]];
  then
    local tmp="$(mktemp "$${cache}.tmp-XXXXXXXX")"
    trap "rm -rf '$tmp' >/dev/null" EXIT
    nix-shell --show-trace "$@" --run 'direnv dump' > "$tmp" && \
    mv "$tmp" "$cache"
  fi

  direnv_load cat "$cache"

  if [[ $# = 0 ]]; then
    watch_file default.nix
    watch_file shell.nix
    rm direnv.* 2>/dev/null
  fi
}
'';
      enableZshIntegration = true;
    };
  };
  services.udev.packages = [
    pkgs.libu2f-host
    pkgs.yubikey-personalization
  ];
}