i3status-rust: satisfy new 0.31 TOML output requirements (#3938)

This commit is contained in:
amesgen 2023-05-01 23:46:41 +02:00 committed by GitHub
parent 3144311f31
commit 0e4c33d760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 11 deletions

View File

@ -6,7 +6,18 @@ let
cfg = config.programs.i3status-rust;
settingsFormat = pkgs.formats.toml { };
settingsFormat = pkgs.formats.toml { } // {
# Since 0.31, the "block" key has to be first in the TOML output.
generate = name: value:
pkgs.runCommand name {
nativeBuildInputs = [ pkgs.jq pkgs.remarshal ];
value = builtins.toJSON value;
passAsFile = [ "value" ];
} ''
jq '.block |= map({block: .block} + del(.block))' "$valuePath" \
| json2toml --preserve-key-order > "$out"
'';
};
in {
meta.maintainers = with lib.maintainers; [ farlion thiagokokada ];

View File

@ -105,12 +105,12 @@
${
pkgs.writeText "i3status-rust-expected-config" ''
[[block]]
alert = 10.0
block = "disk_space"
alert = 10
info_type = "available"
interval = 60
path = "/"
warning = 20.0
warning = 20
[[block]]
block = "memory"

View File

@ -12,12 +12,12 @@
${
pkgs.writeText "i3status-rust-expected-config" ''
[[block]]
alert = 10.0
block = "disk_space"
alert = 10
info_type = "available"
interval = 60
path = "/"
warning = 20.0
warning = 20
[[block]]
block = "memory"

View File

@ -115,12 +115,12 @@
${
pkgs.writeText "i3status-rust-expected-config" ''
[[block]]
alert = 10.0
block = "disk_space"
alert = 10
info_type = "available"
interval = 60
path = "/"
warning = 20.0
warning = 20
[[block]]
block = "memory"

View File

@ -54,11 +54,11 @@
${
pkgs.writeText "i3status-rust-expected-config" ''
[[block]]
alert = 10.0
block = "disk_space"
alert = 10
info_type = "available"
interval = 60
warning = 20.0
warning = 20
[[block]]
block = "memory"

View File

@ -14,12 +14,12 @@
icons = "none"
theme = "plain"
[[block]]
alert = 10.0
block = "disk_space"
alert = 10
info_type = "available"
interval = 60
path = "/"
warning = 20.0
warning = 20
[[block]]
block = "memory"