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;
|
2021-07-23 19:18:07 +02:00
|
|
|
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 = {
|
2021-07-23 19:18:07 +02:00
|
|
|
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 = "";
|
|
|
|
};
|
2021-08-10 02:48:21 +02:00
|
|
|
|
|
|
|
networking.throughput_interfaces = mkOption {
|
|
|
|
type = types.listOf types.str;
|
2022-04-10 11:54:58 +02:00
|
|
|
example = ["wlp1s0"];
|
|
|
|
default = [];
|
2021-08-10 02:48:21 +02:00
|
|
|
};
|
2021-07-23 19:18:07 +02:00
|
|
|
};
|
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)
|
2022-02-07 15:00:11 +01:00
|
|
|
# FIXME: is this useful?
|
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";
|
2023-06-01 19:14:17 +02:00
|
|
|
settings.theme = {
|
|
|
|
theme = i3BarTheme.theme.name;
|
|
|
|
overrides = i3BarTheme.theme.overrides;
|
|
|
|
};
|
2021-04-19 22:54:20 +02:00
|
|
|
|
2022-04-10 11:54:58 +02:00
|
|
|
blocks =
|
|
|
|
[
|
|
|
|
{
|
|
|
|
block = "pomodoro";
|
2023-06-01 19:14:17 +02:00
|
|
|
notify_cmd = "i3nag";
|
|
|
|
blocking_cmd = true;
|
2022-04-10 11:54:58 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
block = "disk_space";
|
|
|
|
path = "/";
|
|
|
|
info_type = "available";
|
|
|
|
interval = 60;
|
|
|
|
warning = 20.0;
|
|
|
|
alert = 10.0;
|
2023-06-01 19:14:17 +02:00
|
|
|
alert_unit = "GB";
|
2022-04-10 11:54:58 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
block = "memory";
|
2023-06-01 19:14:17 +02:00
|
|
|
format = " $icon $mem_used.eng(prefix:G)/$mem_total.eng(prefix:G) ";
|
2022-04-10 11:54:58 +02:00
|
|
|
warning_mem = 70.0;
|
|
|
|
critical_mem = 90.0;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
block = "cpu";
|
|
|
|
interval = 1;
|
2023-06-01 19:14:17 +02:00
|
|
|
format = " $icon $barchart ";
|
2022-04-10 11:54:58 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
block = "temperature";
|
|
|
|
interval = 10;
|
2023-06-01 19:14:17 +02:00
|
|
|
format = " $icon $max ";
|
2022-04-10 11:54:58 +02:00
|
|
|
chip = cfg.temperature.chip;
|
|
|
|
inputs = cfg.temperature.inputs;
|
|
|
|
}
|
2024-02-22 18:36:59 +01:00
|
|
|
{
|
|
|
|
block = "custom";
|
|
|
|
# TODO: get service name programmatically somehow
|
|
|
|
command = let
|
|
|
|
systemctl = lib.getExe' pkgs.systemd "systemctl";
|
|
|
|
in
|
|
|
|
pkgs.writeShellScript "check-restic.sh" ''
|
|
|
|
BACKUP_STATUS=Good
|
|
|
|
if ${systemctl} is-failed --quiet restic-backups-backblaze.service; then
|
|
|
|
BACKUP_STATUS=Critical
|
|
|
|
fi
|
|
|
|
echo "{\"state\": \"$BACKUP_STATUS\", \"text\": \"Backup\"}"
|
|
|
|
'';
|
|
|
|
json = true;
|
|
|
|
interval = 60;
|
|
|
|
}
|
2022-04-10 11:54:58 +02:00
|
|
|
]
|
|
|
|
++ (
|
|
|
|
lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0)
|
|
|
|
(map
|
|
|
|
(interface: {
|
2021-08-10 02:48:21 +02:00
|
|
|
block = "net";
|
|
|
|
device = interface;
|
|
|
|
interval = 1;
|
2023-06-01 19:14:17 +02:00
|
|
|
missing_format = "";
|
2021-08-10 02:48:21 +02:00
|
|
|
})
|
2022-04-10 11:54:58 +02:00
|
|
|
cfg.networking.throughput_interfaces)
|
|
|
|
)
|
|
|
|
++ [
|
|
|
|
{
|
2023-06-01 19:14:17 +02:00
|
|
|
block = "net";
|
2023-09-29 14:09:57 +02:00
|
|
|
format = " $icon {$ip|} {SSID: $ssid|}";
|
2023-06-01 19:14:17 +02:00
|
|
|
theme_overrides = {
|
|
|
|
idle_bg = {link = "good_bg";};
|
|
|
|
idle_fg = {link = "good_fg";};
|
|
|
|
};
|
2022-04-10 11:54:58 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
block = "sound";
|
|
|
|
driver = "pulseaudio";
|
|
|
|
}
|
|
|
|
]
|
|
|
|
++ (
|
|
|
|
optional config.my.home.laptop.enable
|
|
|
|
{
|
|
|
|
block = "battery";
|
2023-06-01 19:14:17 +02:00
|
|
|
format = " $icon $percentage ($power) ";
|
2022-04-10 11:54:58 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
++ [
|
|
|
|
# {
|
|
|
|
# block = "notify";
|
|
|
|
# }
|
|
|
|
{
|
|
|
|
block = "time";
|
|
|
|
interval = 5;
|
2023-06-01 19:14:17 +02:00
|
|
|
format = " $icon $timestamp.datetime(f:'%a %d/%m %T', l:fr_FR) ";
|
2022-04-10 11:54:58 +02:00
|
|
|
timezone = "Europe/Paris";
|
|
|
|
}
|
|
|
|
];
|
2021-04-19 14:58:52 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|