summaryrefslogtreecommitdiffstats
path: root/common/commandline.nix
blob: ba537ff0ff315b7107e13e9fca741d68251e7226 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
inputs: {
  config,
  pkgs,
  lib,
  ...
}:
let
  inherit (inputs.self.lib) theme;
  dominantEscapeCode = theme.fgEscapeCode config.theme.colors.dominant;
  bgDominantEscapeCode = theme.bgEscapeCode config.theme.colors.dominant;
  backgroundEscapeCode = theme.fgEscapeCode config.theme.colors.background;
in {
  imports = [
    (import ./commandline/dircolors.nix inputs)
    (import ./commandline/git.nix inputs)
    (import ./commandline/htop.nix inputs)
    (import ./commandline/starship.nix inputs)
    (import ./commandline/tmux.nix inputs)
    (import ./commandline/zsh.nix inputs)
  ];

  environment.systemPackages = with pkgs; [
    dnsutils
    dogdns
    dua
    elinks
    fd
    file
    gnupg
    hddtemp
    jaq
    jq
    lm_sensors
    lsof
    moreutils
    ncdu
    nethogs
    nix-prefetch-scripts
    progress
    psmisc
    ripgrep
    shellcheck
    shfmt
    smartmontools
    tmux
    tree
    vim
    wget
    wipe

    unstable.alejandra
    unstable.nixfmt-rfc-style
  ];

  console = {
    # packages = with pkgs; [terminus_font];
    # font = "ter-d22n";
    # colors = [
    #   "282a2e"
    #   "a54242"
    #   "8c9440"
    #   "de935f"
    #   "5f819d"
    #   "85678f"
    #   "5e8d87"
    #   "707880"
    #   "373b41"
    #   "cc6666"
    #   "b5bd68"
    #   "f0c674"
    #   "81a2be"
    #   "b294bb"
    #   "8abeb7"
    #   "c5c8c6"
    # ];
    keyMap = "fr";
  };

  environment.shellAliases = {
    e = "\${EDITOR}";
    o = "xdg-open";
    cpr = "${pkgs.rsync}/bin/rsync -ah --inplace --info=progress2";
  };

  programs.bash.enableCompletion = true;

  programs.less = {
    envVariables = {
      # -W: hilite-unread
      # -z-4: scrolling set to screen height - 4
      # -R: display color and link escape sequences
      # -J: display status column at left edge of screen
      # -F: quit if one screen
      LESS = "-W -z-4 -R -J -F";
      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}"

    Defaults:root,%wheel env_keep+=SSH_AUTH_SOCK
  '';

  programs.command-not-found.enable = false;
  programs.nix-index = {
    enable = true;
    enableBashIntegration = true;
    enableZshIntegration = true;
  };

  home-manager.users.minijackson = {
    programs.bash.enable = true;

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

    programs.pazi.enable = true;

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

    home.sessionVariables = {
      CLICOLOR = "1";
      EXA_COLORS = let
        spec = set:
          lib.concatStringsSep ":"
          (lib.mapAttrsToList
            (key: value: "${key}=${value}")
            set);
      in
        spec {
        };
    };
  };

  home-manager.users.root = {...}: {
    programs.bash.enable = true;
    programs.pazi = lib.mkDefault config.home-manager.users.minijackson.programs.pazi;
    programs.bat = lib.mkDefault config.home-manager.users.minijackson.programs.bat;
  };
}