summaryrefslogtreecommitdiff
path: root/modules/shell.nix
blob: 06f7edab828cba5738d1eba43a7a5aceb4c843fb (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
{
  config,
  pkgs,
  hmLib,
  lib,
  userOptions,
  ...
}:
{
  home.sessionVariables = {
    EDITOR = "nvim";
  };

  home.sessionPath = [
    "${userOptions.userHome}/.cargo/bin"
  ];

  home.activation.coursierSetup = hmLib.hm.dag.entryAfter [ "writeBoundary" ] ''
    $DRY_RUN_CMD ${pkgs.coursier}/bin/cs setup --env --jvm 21
  '';

  programs.fzf = {
    enable = true;
    enableZshIntegration = true;
  };

  programs.zsh = {
    enable = true;
    enableCompletion = true;
    initContent = ''
      bindkey '\e.' insert-last-word
      if java_home=$(cs java-home --jvm 21 2>/dev/null); then
        export JAVA_HOME="$java_home"
      fi
    '';
    shellAliases = {
      fmt-nix = "nix run nixpkgs#nixfmt-tree";
    };
    plugins = [
      {
        name = "fzf-tab";
        src = pkgs.fetchFromGitHub {
          owner = "Aloxaf";
          repo = "fzf-tab";
          rev = "v1.3.0";
          sha256 = "8atbysoOyCBW2OYKmdc91x9V/Mk3eyg3hvzvhJpQ32w=";
        };
      }
    ];
  };

  programs.git = {
    enable = true;
    settings = {
      core = {
        editor = "vim";
        pager = "delta";
      };
      user = {
        email = "${userOptions.gitEmail}";
        name = "${userOptions.gitName}";
      };
      pull.rebase = true;
      merge.conflictstyle = "zdiff3";
    };
  };

  services.gpg-agent = {
    enable = true;
  };

  programs.tmux = {
    enable = true;
    extraConfig = ''
      set -g default-command "${pkgs.zsh}/bin/zsh"
    '';
  };

  programs.starship = {
    enable = true;
    enableZshIntegration = true;
  };
}