summaryrefslogtreecommitdiffstats
path: root/common/commandline.nix
blob: 36fae26a467910cbacd08518a9a30b4c2ccb0942 (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
{ config, pkgs, lib, ... }:

with import ../lib/theme.nix { inherit lib; };
let
  dominantEscapeCode = fgEscapeCode config.theme.colors.dominant;
  bgDominantEscapeCode = bgEscapeCode config.theme.colors.dominant;
  backgroundEscapeCode = fgEscapeCode config.theme.colors.background;
in
{
  imports = [
    ./commandline/dircolors.nix
    ./commandline/git.nix
    ./commandline/htop.nix
    ./commandline/tmux.nix
    ./commandline/zsh.nix
  ];

  environment.shellAliases = {
    ll = "ls -l";
    e = "\${EDITOR}";
    cpr = "${pkgs.rsync}/bin/rsync -ah --inplace --info=progress2";
  };

  programs.bash = {
    enableCompletion = true;
    interactiveShellInit = ''
      eval "$(${pkgs.starship}/bin/starship init bash)"

      PATH="${pkgs.pazi}/bin:$PATH"
      eval "$(pazi init bash)"
    '';
  };

  programs.less = {
    envVariables = {
      LESS = "-W -z-4 -R -J";
      LESS_TERMCAP_mb = dominantEscapeCode;
      LESS_TERMCAP_md = dominantEscapeCode;
      LESS_TERMCAP_so =
        bgDominantEscapeCode + backgroundEscapeCode + "$(tput bold)";
    };
  };

  security.sudo.extraConfig =
  let
    lectureFile = builtins.toFile "sudoers.lecture" ''
    
         ${dominantEscapeCode}"Bee" careful    __
           ${dominantEscapeCode}with sudo!    // \
                         \\_/ //
       '''-.._.-'''-.._.. -(||)(')
                         ''''

    '';
  in
    ''
    Defaults lecture = always
    Defaults lecture_file = "${lectureFile}"
    '';

    home-manager.users.minijackson = { ... }:
    {
      # TODO
      xdg.configFile."starship.toml".text = ''
        [directory]
        fish_style_pwd_dir_length = 2
        style = "bold blue"

        [git_branch]
        symbol = "branch "

        [git_status]
        ahead = "^"
        behind = "v"
        deleted = "x"

        [jobs]
        symbol = "+ "

        [package]
        symbol = "version "
        style = "bold green"
        disabled = true

        [rust]
        symbol = "rust "
        style = "bold dimmed yellow"

        [nix_shell]
        style = "bold blue"

        [character]
        symbol = ">"
      '';

      programs.bat = {
        enable = true;
        config = {
          theme = "TwoDark";
        };
      };
    };

    home-manager.users.root = { ... }:
    {
      programs.bat = config.home-manager.users.minijackson.programs.bat;
    };
}