blob: a521c337daaeb6e3141c6f9ac99ea02bc32707eb (
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
|
# Cross-platform graphical process and system monitor
{
config,
lib,
pkgs,
...
}:
let
cfg = config.system.btop;
icons = config.desktop.icons.apps;
in
{
imports = [ ./assertions.nix ];
options.system.btop = {
enable = lib.mkEnableOption "Enables btop.";
nvidia = lib.mkOption {
type = lib.types.submodule {
options = {
enable = lib.mkEnableOption "Build btop with NVIDIA GPU monitoring support (CUDA).";
};
};
default = { };
description = "NVIDIA GPU monitoring configuration.";
};
amd = lib.mkOption {
type = lib.types.submodule {
options = {
enable = lib.mkEnableOption "Build btop with AMD GPU monitoring support (ROCm).";
};
};
default = { };
description = "AMD GPU monitoring configuration.";
};
package = lib.mkOption {
type = lib.types.package;
readOnly = true;
default = pkgs.btop.override {
cudaSupport = cfg.nvidia.enable;
rocmSupport = cfg.amd.enable;
};
description = "The btop package to use.";
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
programs.btop = {
enable = true;
package = cfg.package;
};
})
(lib.mkIf (cfg.enable && config.terminal.kitty.enable) {
xdg.desktopEntries."btop" = {
name = "btop++";
exec = "${lib.getExe config.terminal.kitty.package} --class btop -e ${lib.getExe cfg.package}";
icon = icons.btop;
categories = [
"System"
"Monitor"
"ConsoleOnly"
];
comment = "Cross-platform graphical process and system monitor";
terminal = false;
type = "Application";
};
})
];
}
|