* Revert "i3status-rust: satisfy new 0.31 TOML output requirements (#3938)"
This reverts commit 0e4c33d760
.
* i3status-rust: assertion for unsupported versions
This commit is contained in:
parent
990b82ecd3
commit
6fc82e5697
|
@ -6,18 +6,7 @@ let
|
|||
|
||||
cfg = config.programs.i3status-rust;
|
||||
|
||||
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"
|
||||
'';
|
||||
};
|
||||
settingsFormat = pkgs.formats.toml { };
|
||||
|
||||
in {
|
||||
meta.maintainers = with lib.maintainers; [ farlion thiagokokada ];
|
||||
|
@ -248,6 +237,12 @@ in {
|
|||
assertions = [
|
||||
(hm.assertions.assertPlatform "programs.i3status-rust" pkgs
|
||||
platforms.linux)
|
||||
{
|
||||
assertion = lib.versionOlder cfg.package.version "0.31.0"
|
||||
|| lib.versionAtLeast cfg.package.version "0.31.2";
|
||||
message =
|
||||
"Only i3status-rust <0.31.0 or ≥0.31.2 is supported due to a config format incompatibility.";
|
||||
}
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
i3status-rust-with-extra-settings = ./with-extra-settings.nix;
|
||||
i3status-rust-with-multiple-bars = ./with-multiple-bars.nix;
|
||||
i3status-rust-with-version-02xx = ./with-version-02xx.nix;
|
||||
i3status-rust-with-version-0311 = ./with-version-0311.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
|
||||
warning = 20.0
|
||||
|
||||
[[block]]
|
||||
block = "memory"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
config = {
|
||||
programs.i3status-rust = { enable = true; };
|
||||
|
||||
test.stubs.i3status-rust = { version = "0.30.0"; };
|
||||
test.stubs.i3status-rust = { version = "0.31.2"; };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/i3status-rust/config-default.toml
|
||||
|
@ -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
|
||||
warning = 20.0
|
||||
|
||||
[[block]]
|
||||
block = "memory"
|
||||
|
|
|
@ -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
|
||||
warning = 20.0
|
||||
|
||||
[[block]]
|
||||
block = "memory"
|
||||
|
|
|
@ -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
|
||||
warning = 20.0
|
||||
|
||||
[[block]]
|
||||
block = "memory"
|
||||
|
|
|
@ -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
|
||||
warning = 20.0
|
||||
|
||||
[[block]]
|
||||
block = "memory"
|
||||
|
|
13
tests/modules/programs/i3status-rust/with-version-0311.nix
Normal file
13
tests/modules/programs/i3status-rust/with-version-0311.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.i3status-rust = { enable = true; };
|
||||
|
||||
test.stubs.i3status-rust = { version = "0.31.1"; };
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
"Only i3status-rust <0.31.0 or ≥0.31.2 is supported due to a config format incompatibility."
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue