summaryrefslogtreecommitdiff
path: root/users/seth/programs/bash.nix
blob: 692ec58552321089f559a93751abd1afc04d9740 (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
{ config, lib, ... }:
let
  cfg = config.seth.programs.bash;
in
{
  options.seth.programs.bash = {
    enable = lib.mkEnableOption "Bash configuration" // {
      default = config.seth.enable;
      defaultText = lib.literalExpression "config.seth.enable";
    };
  };

  config = lib.mkIf cfg.enable (
    lib.mkMerge [
      {
        programs.bash = {
          enable = true;

          historyFile = "${config.xdg.stateHome}/bash/history";
          historyFileSize = 1000;
          historySize = 100;

          shellOptions = [
            "cdspell"
            "checkjobs"
            "checkwinsize"
            "dirspell"
            "globstar"
            "histappend"
            "no_empty_cmd_completion"
          ];
        };
      }

      # TODO: find out if i need this anymore with standalone HM
      (lib.mkIf config.seth.standalone.enable {
        programs.bash = {

          bashrcExtra = ''
            nixfile=${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.sh
            [ -e "$nixfile" ] && source "$nixfile"
          '';
        };
      })
    ]
  );
}