summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home-manager/zsh.nix
blob: c875d52c8a5f1c3e50251afe5f0a45df718e8307 (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
{ pkgs, ... }:
{
  programs = {
    ssh.startAgent = false;
    gnupg.agent = {
      enable = true;
      enableSSHSupport = true;
    };
  };
  imports = [
    { 
      home-manager.users.makefu.home.packages = [
        (pkgs.writers.writeDashBin "privatefox" "exec firefox -P Privatefox")
      ];
    }
    { # bat
      home-manager.users.makefu.home.packages = [ pkgs.bat ];
      home-manager.users.makefu.programs.zsh.shellAliases = {
        cat = "bat --style=header,snip";
        mirage = "sxiv"; # only available when tools/extra-gui is in use
        catn = "${pkgs.coreutils}/bin/cat";
        ncat = "${pkgs.coreutils}/bin/cat";
      };
    }
  ];
  environment.pathsToLink = [
    "/share/zsh"
  ];

  nix.extraOptions = ''
    keep-outputs = true
    keep-derivations = true
  '';

  home-manager.users.makefu = {

    programs.direnv.enable = true;
    programs.direnv.nix-direnv.enable = true;
    programs.direnv.enableZshIntegration = true;
    home.packages = [ (pkgs.writeDashBin "nixify" ''
test ! -e shell.nix && cat > shell.nix <<EOF
{ pkgs ? import <nixpkgs> {}}:

pkgs.mkShell {
  nativeBuildInputs = [ pkgs.hello ];
}
EOF
echo "use nix" >> .envrc
direnv allow
'')
    ];
    #home.packages = [ pkgs.direnv pkgs.nix-direnv ];

    programs.fzf.enable = false; # alt-c
    programs.zsh = {
      enable = true;
      enableAutosuggestions = false;
      enableCompletion = true;
      oh-my-zsh.enable = false;
      history = {
        size = 900001;
        save = 900001;
        ignoreDups = true;
        ignoreSpace = true;

        extended = true;
        share = true;
      };
      sessionVariables = {
        # TERM = "rxvt-unicode-256color";
        TERM = "xterm";
        LANG = "en_US.UTF8";
        LS_COLORS = ":di=1;31:";
        EDITOR = "vim";
      };
      shellAliases = {
        lsl = "ls -lAtr";
        t = "task";
        xo = "mimeopen";
        nmap = "nmap -oN $HOME/loot/scan-`date +\%s`.nmap -oX $HOME/loot/scan-`date +%s`.xml";
      };
      #zplug = {
      #  enable = true;
      #  plugins = [
      #    { name = "denisidoro/navi" ; }
      #    { name = "zsh-users/zsh-autosuggestions" ; }
      #  ];
      #};
      initExtra = ''
        bindkey -e
        zle -N edit-command-line
        # ctrl-x ctrl-e
        bindkey '^xe' edit-command-line
        bindkey '^x^e' edit-command-line
        # shift-tab
        bindkey '^[[Z' reverse-menu-complete
        bindkey "\e[3~" delete-char
        zstyle ':completion:*' menu select

        setopt HIST_IGNORE_ALL_DUPS
        setopt HIST_FIND_NO_DUPS

        compdef _pass brain
        zstyle ':completion::complete:brain::' prefix "$HOME/brain"

        compdef _pass secrets
        zstyle ':completion::complete:secrets::' prefix "$HOME/.secrets-pass/"
      '';
    };
  };
}