aboutsummaryrefslogtreecommitdiff
path: root/home-manager/tests/modules/services/polybar/basic-configuration.nix
blob: a8886dab6d5c21ffa4695636d6fe5fcb665fd72a (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
{ config, pkgs, ... }:

{
  config = {
    services.polybar = {
      enable = true;
      package = pkgs.writeScriptBin "dummy-polybar" "";
      script = "polybar bar &";
      config = {
        "bar/top" = {
          monitor = "\${env:MONITOR:eDP1}";
          width = "100%";
          height = "3%";
          radius = 0;
          modules-center = "date";
        };
        "module/date" = {
          type = "internal/date";
          internal = 5;
          date = "%d.%m.%y";
          time = "%H:%M";
          label = "%time%  %date%";
        };
      };
      extraConfig = ''
        [module/date]
        type = internal/date
        interval = 5
        date = "%d.%m.%y"
        time = %H:%M
        format-prefix-foreground = ''${colors.foreground-alt}
        label = %time%  %date%
      '';
    };

    nmt.script = ''
      serviceFile=home-files/.config/systemd/user/polybar.service

      assertFileExists $serviceFile
      assertFileRegex $serviceFile 'X-Restart-Triggers=.*polybar\.conf'
      assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start'

      assertFileExists home-files/.config/polybar/config
      assertFileContent home-files/.config/polybar/config \
          ${./basic-configuration.conf}
    '';
  };
}