aboutsummaryrefslogtreecommitdiff
path: root/home-manager/tests/modules/programs/waybar/broken-settings.nix
blob: 68f0b90bfca312f86e653736e684df8bf4f1636b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ 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; };
      }];
    };

    nmt.description = ''
      Test for the broken configuration
      https://github.com/rycee/home-manager/pull/1329#issuecomment-653253069
    '';
    nmt.script = ''
      assertPathNotExists home-files/.config/waybar/style.css
      assertFileContent \
        home-files/.config/waybar/config \
        ${expected}
    '';
  };
}