summaryrefslogtreecommitdiff
path: root/users/seth/shell/default.nix
blob: b86697c2a1f09962c05a3cf133ac8a445e3d3a34 (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
{
  config,
  lib,
  ...
}: let
  cfg = config.seth.shell;
in {
  options.seth.shell = {
    aliases.enable = lib.mkEnableOption "Shell aliases" // {default = config.seth.enable;};
    variables.enable = lib.mkEnableOption "Shell variables" // {default = config.seth.enable;};
  };

  imports = [
    ./bash.nix
    ./fish.nix
    ./nu.nix
    ./zsh.nix
  ];

  config = {
    home = lib.mkMerge [
      (lib.mkIf cfg.variables.enable {
        sessionVariables = rec {
          EDITOR = "nvim";
          VISUAL = EDITOR;
          CARGO_HOME = "${config.xdg.dataHome}/cargo";
          LESSHISTFILE = "${config.xdg.stateHome}/less/history";
        };
      })

      (lib.mkIf cfg.aliases.enable {
        shellAliases = {
          diff = "diff --color=auto";
          g = "git";
          gs = "g status";
        };
      })
    ];
  };
}