Skip to content

Commit

Permalink
polybar: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
rycee committed Mar 4, 2020
1 parent a6657d6 commit f3fbb50
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import nmt {
./modules/programs/firefox
./modules/programs/getmail
./modules/programs/rofi
./modules/services/polybar
./modules/services/sxhkd
./modules/services/window-managers/i3
./modules/systemd
Expand Down
21 changes: 21 additions & 0 deletions tests/modules/services/polybar/basic-configuration.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[bar/top]
height=3%
modules-center=date
monitor=${env:MONITOR:eDP1}
radius=0
width=100%

[module/date]
date=%d.%m.%y
internal=5
label=%time% %date%
time=%H:%M
type=internal/date

[module/date]
type = internal/date
interval = 5
date = "%d.%m.%y"
time = %H:%M
format-prefix-foreground = ${colors.foreground-alt}
label = %time% %date%
48 changes: 48 additions & 0 deletions tests/modules/services/polybar/basic-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 = ''
local 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}
'';
};
}
1 change: 1 addition & 0 deletions tests/modules/services/polybar/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ polybar-basic-configuration = ./basic-configuration.nix; }

0 comments on commit f3fbb50

Please sign in to comment.