diff --git a/modules/programs/i3status-rust.nix b/modules/programs/i3status-rust.nix index b03636939..1f9c2bb6d 100644 --- a/modules/programs/i3status-rust.nix +++ b/modules/programs/i3status-rust.nix @@ -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 ]; diff --git a/tests/modules/programs/i3status-rust/with-custom.nix b/tests/modules/programs/i3status-rust/with-custom.nix index 46887a58e..564e7eb31 100644 --- a/tests/modules/programs/i3status-rust/with-custom.nix +++ b/tests/modules/programs/i3status-rust/with-custom.nix @@ -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" diff --git a/tests/modules/programs/i3status-rust/with-default.nix b/tests/modules/programs/i3status-rust/with-default.nix index 4d10ceea9..f083358d6 100644 --- a/tests/modules/programs/i3status-rust/with-default.nix +++ b/tests/modules/programs/i3status-rust/with-default.nix @@ -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" diff --git a/tests/modules/programs/i3status-rust/with-extra-settings.nix b/tests/modules/programs/i3status-rust/with-extra-settings.nix index 0d8b4663b..f5f89b1e0 100644 --- a/tests/modules/programs/i3status-rust/with-extra-settings.nix +++ b/tests/modules/programs/i3status-rust/with-extra-settings.nix @@ -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" diff --git a/tests/modules/programs/i3status-rust/with-multiple-bars.nix b/tests/modules/programs/i3status-rust/with-multiple-bars.nix index 2a56d6a9c..93c43c755 100644 --- a/tests/modules/programs/i3status-rust/with-multiple-bars.nix +++ b/tests/modules/programs/i3status-rust/with-multiple-bars.nix @@ -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" diff --git a/tests/modules/programs/i3status-rust/with-version-02xx.nix b/tests/modules/programs/i3status-rust/with-version-02xx.nix index ec8c2f9a9..870519f87 100644 --- a/tests/modules/programs/i3status-rust/with-version-02xx.nix +++ b/tests/modules/programs/i3status-rust/with-version-02xx.nix @@ -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"