summaryrefslogtreecommitdiff
path: root/darwin/home.nix
blob: e0b1bb07432c20db717f105f97574ee13f9ddd54 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{ config, pkgs, ... }:

{
  home.username = "shubh";
  home.homeDirectory = "/Users/shubh";

  # You should not change this value, even if you update Home Manager. If you do
  # want to update the value, then make sure to first check the Home Manager
  # release notes.
  home.stateVersion = "23.05";

  home.packages = with pkgs; [
    git
    unzip
    wget
    gnupg
    pass
    tmux
    fzf
    docker
    neovim
    nmap
    lf
    pinentry_mac
    postgresql
    docker
    kubectl
    kubelogin-oidc
    terraform
    kops
    k9s
    kubernetes-helm
    python38
    # gui
    zoom-us
    slack
  ];

  home.file = {
    ".gnupg/gpg-agent.conf" = {
      text = ''
      pinentry-program ${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac
      '';
    };
  };

  home.sessionVariables = {
    PATH = "$PATH:$HOME/.bin";
    EDITOR = "nvim";
    MANPAGER = "nvim +Man!";
  };

  programs.home-manager.enable = true;
  programs.zsh = {
    enable = true;
    enableCompletion = true;
    enableAutosuggestions = true;
    dotDir = ".zsh";
    history = {
      ignoreAllDups = true;
      path = "$HOME/.zsh/history";
    };
    initExtra = ''
      zstyle ':completion:*' menu select
      zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
      zmodload zsh/complist
      bindkey -M menuselect 'h' vi-backward-char
      bindkey -M menuselect 'k' vi-up-line-or-history
      bindkey -M menuselect 'l' vi-forward-char
      bindkey -M menuselect 'j' vi-down-line-or-history
      bindkey '^f' autosuggest-accept
      source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
      zvm_after_init_commands+=('source ${pkgs.fzf}/share/fzf/completion.zsh && source ${pkgs.fzf}/share/fzf/key-bindings.zsh')
    '';
    shellAliases = {
      ".." = "cd ..";
      l = "ls --color -al";
      ls = "ls --color";
      v = "nvim";
      o = "xdg-open";
      t = "tmux";
      f = "lf";
      tf = "terraform";
      k = "kubectl";
      gst = "git status --short";
      ga = "git add";
      gp = "git push";
      gl = "git log --oneline --decorate --graph";
      gc = "git commit -v -S";
      gd = "git diff --minimal";
    };
    plugins = [
      {
        name = "pure";
        src = pkgs.fetchFromGitHub {
          owner = "sindresorhus";
          repo = "pure";
          rev = "v1.22.0";
          sha256 = "177vabhvgrxdcwvc29rmfmfr96wl75hrkhymnd8qcaky2v4047jd";
        };
      }
    ];
  };
  programs.fzf = {
    enable = true;
    enableZshIntegration = false;
    defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ];
  };
  programs.git = {
    enable = true;
    userEmail = "ssaini@fispan.com";
    userName = "Shubham Saini";
    signing = {
      key = "E0404DDE4BCF9DB5";
      signByDefault = true;
    };
  };
  programs.lf = {
    enable = true;
    settings = {
      shell = "sh";
      icons = true;
      drawbox = true;
      scrolloff = 10;
      shellopts = "-eu";
    };
    commands = {
      extract = ''
        %{{
          set -f
          case $f in
              *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
              *.tar.gz|*.tgz) tar xzvf $f;;
              *.tar.xz|*.txz) tar xJvf $f;;
              *.zip) unzip $f;;
              *.rar) unrar x $f;;
              *.7z) 7z x $f;;
          esac
        }}
      '';
      open = ''
        %{{
          case $(file --mime-type -Lb $f) in
              text/*) lf -remote "send $id \$$EDITOR \$fx";;
              *) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;;
          esac
        }}
      '';
    };
    keybindings = {
      "<enter>" = "shell";
      "." = "set hidden!";
    };
  };
}