home-manager/tests/modules/programs/waybar/settings-complex.nix
Robert Helgesson 9d53afb709
tests: add support for asserting warnings
This adds a "test.asserts" module that currently just provides a
convenient way to assert on the content of warnings. By default all
tests will assert that no warnings are given.
2020-12-30 17:25:48 +01:00

65 lines
1.6 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
in {
config = {
programs.waybar = {
inherit package;
enable = true;
settings = [{
layer = "top";
position = "top";
height = 30;
output = [ "DP-1" ];
modules-left = [ "sway/workspaces" "sway/mode" "custom/my-module" ];
modules-center = [ "sway/window" ];
modules-right = [
"idle_inhibitor"
"pulseaudio"
"network"
"cpu"
"memory"
"backlight"
"tray"
"battery#bat1"
"battery#bat2"
"clock"
];
modules = {
"sway/workspaces" = {
disable-scroll = true;
all-outputs = true;
};
"sway/mode" = { tooltip = false; };
"sway/window" = { max-length = 120; };
"idle_inhibitor" = { format = "{icon}"; };
"custom/my-module" = {
format = "hello from {}";
exec = let
dummyScript =
pkgs.writeShellScriptBin "dummy" "echo within waybar" // {
outPath = "@dummy@";
};
in "${dummyScript}/bin/dummy";
};
};
}];
};
# 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 \
home-files/.config/waybar/config \
${./settings-complex-expected.json}
'';
};
}