summaryrefslogtreecommitdiffstats
path: root/common/commandline.nix
blob: 0563b0b2d522331b6591a087a4988d07d3b9f907 (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
inputs: {
  config,
  pkgs,
  lib,
  ...
}:
with inputs.self.lib.theme; let
  dominantEscapeCode = fgEscapeCode config.theme.colors.dominant;
  bgDominantEscapeCode = bgEscapeCode config.theme.colors.dominant;
  backgroundEscapeCode = 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)
  ];

  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 = {
      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 = {
    programs.bash.enable = true;

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

    programs.pazi.enable = true;

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

    home.sessionVariables = {
      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;
  };
}