1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-16 08:09:45 +01:00
home-manager/tests/modules/programs/i3status-rust/with-custom.nix
workflow 9e9d8ffc7c
i3status-rust: add module
This adds the i3status-rust[0] module, a replacement for i3status
written in pure Rust.

[0] https://github.com/greshake/i3status-rust
2020-11-05 23:59:47 +01:00

186 lines
4.9 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.i3status-rust = {
enable = true;
bars = {
custom = {
blocks = [
{
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 = "{Mug}GB ({Mup}%)";
format_swap = "{SUp}%";
}
{
block = "cpu";
interval = 1;
format = "{barchart}";
}
{
block = "load";
interval = 1;
format = "{1m} {5m}";
}
{
block = "temperature";
collapsed = true;
interval = 10;
format = "{min}° min, {max}° max, {average}° avg";
chip = "*-isa-*";
}
{
block = "networkmanager";
ap_format = "{ssid} @ {strength}%";
on_click = "kcmshell5 kcm_networkmanagement";
}
{
block = "net";
device = "enp9s0u2u1u2c2";
speed_up = true;
interval = 5;
}
{
block = "speedtest";
bytes = true;
}
{
block = "xrandr";
interval =
6000; # Because running the commands causes screen lag, see https://github.com/greshake/i3status-rust/issues/668
}
{
block = "sound";
format = "{output_name} {volume}%";
on_click = "pavucontrol --tab=3";
mappings = {
"alsa_output.pci-0000_00_1f.3.analog-stereo" = "";
"bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "";
};
}
{
block = "music";
player = "spotify";
buttons = [ "play" "prev" "next" ];
on_collapsed_click = "i3-msg '[class=Spotify] focus'";
}
{
block = "time";
interval = 60;
format = "%a %d.%m %R";
}
{ block = "battery"; }
];
icons = "awesome5";
theme = "gruvbox-dark";
};
};
};
nixpkgs.overlays = [
(self: super: {
i3status-rust = pkgs.writeScriptBin "dummy-i3status-rust" "";
})
];
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-custom.toml
assertFileContent home-files/.config/i3status-rust/config-custom.toml \
${
pkgs.writeText "i3status-rust-expected-config" ''
icons = "awesome5"
theme = "gruvbox-dark"
[[block]]
alert = 10
alias = "/"
block = "disk_space"
info_type = "available"
interval = 60
path = "/"
unit = "GB"
warning = 20
[[block]]
block = "memory"
display_type = "memory"
format_mem = "{Mug}GB ({Mup}%)"
format_swap = "{SUp}%"
[[block]]
block = "cpu"
format = "{barchart}"
interval = 1
[[block]]
block = "load"
format = "{1m} {5m}"
interval = 1
[[block]]
block = "temperature"
chip = "*-isa-*"
collapsed = true
format = "{min}° min, {max}° max, {average}° avg"
interval = 10
[[block]]
ap_format = "{ssid} @ {strength}%"
block = "networkmanager"
on_click = "kcmshell5 kcm_networkmanagement"
[[block]]
block = "net"
device = "enp9s0u2u1u2c2"
interval = 5
speed_up = true
[[block]]
block = "speedtest"
bytes = true
[[block]]
block = "xrandr"
interval = 6000
[[block]]
block = "sound"
format = "{output_name} {volume}%"
on_click = "pavucontrol --tab=3"
[block.mappings]
"alsa_output.pci-0000_00_1f.3.analog-stereo" = ""
"bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = ""
[[block]]
block = "music"
buttons = ["play", "prev", "next"]
on_collapsed_click = "i3-msg '[class=Spotify] focus'"
player = "spotify"
[[block]]
block = "time"
format = "%a %d.%m %R"
interval = 60
[[block]]
block = "battery"
''
}
'';
};
}