summaryrefslogtreecommitdiffstats
path: root/common/commandline/htop.nix
blob: 91299a362768e8cb591758a4fe92fd8cb89a3566 (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
inputs:

{ config, ... }:

{
  home-manager.sharedModules = [ { xdg.configFile."htop/htoprc".force = true; } ];

  home-manager.users.minijackson =
    { config, ... }:
    {
      programs.htop = {
        enable = true;

        settings = {
          color_scheme = 5;

          fields = with config.lib.htop.fields; [
            PID
            USER
            PRIORITY
            NICE
            STATE
            IO_PRIORITY
            IO_READ_RATE
            IO_WRITE_RATE
            PERCENT_CPU
            PERCENT_MEM
            TIME
            COMM
          ];

          hide_threads = true;
          hide_kernel_threads = true;
          hide_userland_threads = true;
          show_thread_names = true;
          shadow_other_users = true;

          highlight_base_name = true;

          # On NixOS? NO.
          show_program_path = false;

          tree_view = true;

          left_meters = [
            "LeftCPUs"
            "Memory"
            "Swap"
            "Zram"
            "Blank"
            "Battery"
          ];
          left_meter_modes = with config.lib.htop.modes; [
            Bar
            Bar
            Bar
            Bar
            Text
            Bar
          ];

          right_meters = [
            "RightCPUs"
            "Blank"
            "Tasks"
            "LoadAverage"
            "Uptime"
            "Systemd"
          ];
          right_meter_modes = with config.lib.htop.modes; [
            Bar
            Text
            Text
            Text
            Text
            Text
          ];
          # TODO: this doesn't keep the order:
          # https://github.com/nix-community/home-manager/issues/2060
          /*
            } // (with config.lib.htop; leftMeters {
            LeftCPUs2 = modes.Bar;
            Memory = modes.Bar;
            Swap = modes.Bar;
            Blank = modes.Text;
            Battery = modes.Bar;
            }) // (with config.lib.htop; rightMeters {
            RightCPUs2 = modes.Bar;
            Blank = modes.Text;
            Tasks = modes.Text;
            LoadAverage = modes.Text;
            Uptime = modes.Text;
            });
          */
        };
      };
    };

  home-manager.users.root =
    { ... }:
    {
      programs.htop = {
        enable = true;
        settings = config.home-manager.users.minijackson.programs.htop.settings // {
          shadowOtherUsers = false;
        };
      };
    };
}