summaryrefslogtreecommitdiff
path: root/home-manager/htop.nix
blob: 36ccbac1596f047fd4bb931c372999b32cf62780 (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
{ config, lib, ... }: let
	cfg = config.programs.htop;
in {
	options.programs.htop = {
		_configure = lib.mkEnableOption "apply sensible defaults to htop";
	};

	config = lib.mkIf cfg._configure {
		programs.htop.enable = lib.mkDefault true;
		programs.htop.settings = {
			fields = with config.lib.htop.fields; [
				PID
				USER
				124  # EXE
				PERCENT_CPU
				PERCENT_MEM
				STARTTIME
				ELAPSED  # time elapsed since process start
				IO_READ_RATE
				RBYTES  # num read bytes
				IO_WRITE_RATE
				WBYTES  # num written bytes
				TIME
				STIME  # sys time
				CSTIME  # child sys time
				NICE
				STATE
				PRIORITY
				125  # CWD
			];
		} // (with config.lib.htop; leftMeters [
			(bar "AllCPUs2")
			(bar "CPU")
			(bar "Memory")
			(bar "DiskIO")
			(bar "NetworkIO")
		]) // (with config.lib.htop; rightMeters [
			(text "Hostname")
			(text "Clock")
			(text "Uptime")
			(text "Battery")
			(text "LoadAverage")
			(text "Tasks")
		]);
	};
}