nichts/modules/programs/tui/btop.mod.nix

41 lines
882 B
Nix
Raw Normal View History

2024-05-22 14:29:45 +02:00
{
config,
lib,
2024-11-01 20:54:33 +01:00
pkgs,
2024-05-22 14:29:45 +02:00
...
2024-11-01 20:54:33 +01:00
}: let
inherit (lib.options) mkEnableOption;
inherit (lib.modules) mkIf;
cfg = config.modules.programs.btop;
2024-11-01 20:54:33 +01:00
btop-settings = pkgs.writeTextDir "btop/btop.conf" ''
truecolor = True
vim_keys = True
rounded_corners = True
update_ms = 100
graph_symbol = "braille"
cpu_single_graph = True
clock_format = "%X"
use_fstab = True
io_mode = True
net_sync = True
net_iface = "enp4s0"
log_level = "ERROR"
'';
btop-wrapped = pkgs.symlinkJoin {
name = "btop-wrapped";
paths = [pkgs.btop];
nativeBuildInputs = [pkgs.makeWrapper];
2024-11-01 20:54:33 +01:00
postBuild = ''
wrapProgram $out/bin/btop --set XDG_CONFIG_HOME "${btop-settings}"
'';
};
2024-04-10 17:39:26 +02:00
in {
options.modules.programs.btop.enable = mkEnableOption "btop";
config = mkIf cfg.enable {
2024-11-01 20:54:33 +01:00
environment.systemPackages = [btop-wrapped];
};
2024-04-10 17:39:26 +02:00
}