nixos-config/home/x/i3bar.nix

143 lines
3.3 KiB
Nix
Raw Normal View History

2022-04-10 11:54:58 +02:00
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
2022-01-11 16:08:21 +01:00
lists
mkIf
mkOption
optional
types
2022-04-10 11:54:58 +02:00
;
2022-01-11 16:08:21 +01:00
2021-04-19 14:58:52 +02:00
isEnabled = config.my.home.x.enable;
2021-04-22 02:33:39 +02:00
i3BarTheme = config.my.theme.i3BarTheme;
cfg = config.my.home.x.i3bar;
2022-04-10 11:54:58 +02:00
in {
2022-01-11 16:08:21 +01:00
options.my.home.x.i3bar = {
temperature.chip = mkOption {
type = types.str;
example = "coretemp-isa-*";
default = "";
};
temperature.inputs = mkOption {
type = types.listOf types.str;
example = ["Core 0" "Core 1" "Core 2" "Core 3"];
default = "";
};
networking.throughput_interfaces = mkOption {
type = types.listOf types.str;
2022-04-10 11:54:58 +02:00
example = ["wlp1s0"];
default = [];
};
};
2021-04-19 22:54:20 +02:00
2022-01-11 16:08:21 +01:00
config = mkIf isEnabled {
home.packages = builtins.attrValues {
2022-04-10 11:54:58 +02:00
inherit
(pkgs)
# FIXME: is this useful?
2022-04-10 11:54:58 +02:00
2022-01-11 16:08:21 +01:00
font-awesome
2022-04-10 11:54:58 +02:00
;
2022-01-11 16:08:21 +01:00
};
2021-04-19 14:58:52 +02:00
programs.i3status-rust = {
enable = true;
bars = {
top = {
2021-04-19 22:54:20 +02:00
icons = "awesome5";
2021-04-22 02:33:39 +02:00
theme = i3BarTheme.theme.name;
settings = i3BarTheme;
2021-04-19 22:54:20 +02:00
2022-04-10 11:54:58 +02:00
blocks =
[
{
block = "pomodoro";
length = 50;
2022-04-10 11:54:58 +02:00
break_length = 10;
notifier = "i3nag";
}
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
}
{
block = "memory";
display_type = "memory";
format_mem = "{mem_used;G}/{mem_total;G}";
warning_mem = 70.0;
critical_mem = 90.0;
# don't show swap
clickable = false;
}
{
block = "cpu";
interval = 1;
format = "{barchart}";
}
{
block = "temperature";
collapsed = false;
interval = 10;
format = "{max}";
chip = cfg.temperature.chip;
inputs = cfg.temperature.inputs;
}
]
++ (
lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0)
(map
(interface: {
block = "net";
device = interface;
interval = 1;
hide_inactive = true;
})
2022-04-10 11:54:58 +02:00
cfg.networking.throughput_interfaces)
)
++ [
{
block = "networkmanager";
primary_only = true;
}
{
block = "sound";
driver = "pulseaudio";
}
]
++ (
optional config.my.home.laptop.enable
{
block = "battery";
}
)
++ [
# {
# block = "notify";
# }
{
block = "time";
interval = 5;
format = "%a %d/%m %T";
locale = "fr_FR";
timezone = "Europe/Paris";
}
];
2021-04-19 14:58:52 +02:00
};
};
};
};
}