Closed Slime90 closed 2 years ago
Well you can't use TOML syntax in a Nix file.
Once you convert the line to valid Nix, you get a config file that looks like this:
[[block]]
block = "focused_window"
max_width = 50
show_marks = "visible"
[[block]]
block = "weather"
format = "{weather} ({location}) {temp}, {wind} m/s {direction}"
[block.service]
api_key = "XXX"
city_id = "5398563"
name = "openweathermap"
units = "metric"
Which I suppose should be equivalent to the TOML shown here.
What would the valid Nix expression be then for the weather block.service? Its not immediately clear to me, perhaps it would be of value to include it in the block example literalExpression?
There's no magic here: service
should be a TOML table (set of key/value pairs), and the Nix equivalent of that is an attribute set, which you clearly know how to write since there are already two of them in the snippet you posted. The error message even tells you how to fix it.
What would the valid Nix expression be then for the weather block.service? Its not immediately clear to me, perhaps it would be of value to include it in the block example literalExpression?
Agree with @ncfavier, the weather block.service
syntax you want should be equivalent to mappings
in the literalExpression here:
{
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" = "";
};
}
Thanks all, I got this working yesterday with similar syntax, I will have to do some more learning on how these mappings work. Closing.
Is there an existing issue for this?
Issue description
I am unable to configure the Weather block using the i3status-rust.nix module, as the service line has formatting that results in nix failing to properly evaluate and generate the TOML. Formatting for this (required) line taken directly from the blocks.md documentation file in the i3status-rs repo.
Maintainer CC
@ncfavier @sephii @rycee @happysalada @workflow @ivan
System information