parent
9d53afb709
commit
f4b5ae026c
5 changed files with 82 additions and 99 deletions
|
|
@ -1,84 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
|
||||
expected = pkgs.writeText "expected-json" ''
|
||||
[
|
||||
{
|
||||
"height": 26,
|
||||
"layer": "top",
|
||||
"modules-center": [
|
||||
"sway/window"
|
||||
],
|
||||
"modules-left": [
|
||||
"sway/workspaces",
|
||||
"sway/mode"
|
||||
],
|
||||
"modules-right": [
|
||||
"idle_inhibitor",
|
||||
"pulseaudio",
|
||||
"network",
|
||||
"cpu",
|
||||
"memory",
|
||||
"backlight",
|
||||
"tray",
|
||||
"clock"
|
||||
],
|
||||
"output": [
|
||||
"DP-1",
|
||||
"eDP-1",
|
||||
"HEADLESS-1"
|
||||
],
|
||||
"position": "top",
|
||||
"sway/workspaces": {
|
||||
"all-outputs": true
|
||||
}
|
||||
}
|
||||
]
|
||||
'';
|
||||
in {
|
||||
config = {
|
||||
programs.waybar = {
|
||||
inherit package;
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
settings = [{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 26;
|
||||
output = [ "DP-1" "eDP-1" "HEADLESS-1" ];
|
||||
modules-left = [ "sway/workspaces" "sway/mode" ];
|
||||
modules-center = [ "sway/window" ];
|
||||
modules-right = [
|
||||
"idle_inhibitor"
|
||||
"pulseaudio"
|
||||
"network"
|
||||
"cpu"
|
||||
"memory"
|
||||
"backlight"
|
||||
"tray"
|
||||
"clock"
|
||||
];
|
||||
|
||||
modules = { "sway/workspaces".all-outputs = true; };
|
||||
}];
|
||||
};
|
||||
|
||||
# Remove when https://github.com/nix-community/home-manager/issues/1686 is
|
||||
# fixed.
|
||||
test.asserts.warnings.enable = false;
|
||||
|
||||
nmt.description = ''
|
||||
Test for the broken configuration
|
||||
https://github.com/nix-community/home-manager/pull/1329#issuecomment-653253069
|
||||
'';
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/waybar/style.css
|
||||
assertFileContent \
|
||||
home-files/.config/waybar/config \
|
||||
${expected}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -3,6 +3,5 @@
|
|||
./systemd-with-graphical-session-target.nix;
|
||||
waybar-styling = ./styling.nix;
|
||||
waybar-settings-complex = ./settings-complex.nix;
|
||||
# Broken configuration from https://github.com/nix-community/home-manager/pull/1329#issuecomment-653253069
|
||||
waybar-broken-settings = ./broken-settings.nix;
|
||||
waybar-warnings = ./warnings-tests.nix;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,6 @@ in {
|
|||
}];
|
||||
};
|
||||
|
||||
# Remove when https://github.com/nix-community/home-manager/issues/1686 is
|
||||
# fixed.
|
||||
test.asserts.warnings.enable = false;
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/waybar/style.css
|
||||
assertFileContent \
|
||||
|
|
|
|||
64
tests/modules/programs/waybar/warnings-tests.nix
Normal file
64
tests/modules/programs/waybar/warnings-tests.nix
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
|
||||
in {
|
||||
config = {
|
||||
programs.waybar = {
|
||||
inherit package;
|
||||
enable = true;
|
||||
settings = [{
|
||||
modules-left = [ "custom/my-module" ];
|
||||
modules-center =
|
||||
[ "this_module_is_not_a_valid_default_module_nor_custom_module" ];
|
||||
modules-right = [
|
||||
"battery#bat1" # CSS identifier is allowed
|
||||
"custom/this_custom_module_doesn't_have_a_definition_in_modules"
|
||||
];
|
||||
|
||||
modules = {
|
||||
"custom/this_module_is_not_referenced" = { };
|
||||
"battery#bat1" = { };
|
||||
"custom/my-module" = { };
|
||||
};
|
||||
}];
|
||||
};
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"The module 'this_module_is_not_a_valid_default_module_nor_custom_module' defined in 'programs.waybar.settings.[].modules-center' is neither a default module or a custom module declared in 'programs.waybar.settings.[].modules'"
|
||||
|
||||
"The module 'custom/this_custom_module_doesn't_have_a_definition_in_modules' defined in 'programs.waybar.settings.[].modules-right' is neither a default module or a custom module declared in 'programs.waybar.settings.[].modules'"
|
||||
|
||||
"The module 'custom/this_module_is_not_referenced' defined in 'programs.waybar.settings.[].modules' is not referenced in either `modules-left`, `modules-center` or `modules-right` of Waybar's options"
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/waybar/style.css
|
||||
assertFileContent \
|
||||
home-files/.config/waybar/config \
|
||||
${
|
||||
pkgs.writeText "expected-json" ''
|
||||
[
|
||||
{
|
||||
"battery#bat1": {},
|
||||
"custom/my-module": {},
|
||||
"custom/this_module_is_not_referenced": {},
|
||||
"modules-center": [
|
||||
"this_module_is_not_a_valid_default_module_nor_custom_module"
|
||||
],
|
||||
"modules-left": [
|
||||
"custom/my-module"
|
||||
],
|
||||
"modules-right": [
|
||||
"battery#bat1",
|
||||
"custom/this_custom_module_doesn't_have_a_definition_in_modules"
|
||||
]
|
||||
}
|
||||
]
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue