1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-17 03:58:30 +02:00
home-manager/tests/modules/programs/waybar/broken-settings.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

85 lines
1.9 KiB
Nix

{ 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}
'';
};
}