nixos/yabar: fix module & test (#46954)

The `pkgs.yabar` package is relatively old (2016-04) and contains
several issues fixed on master. `yabar-unstable` containsa recent master
build with several fixes and a lot of new features (I use
`yabar-unstable` for some time now and had no issues with it).

In the upstream bugtracker some bugs could be fixed on ArchLinux by
simply installing `yabar-git` (an AUR package which builds a recent
master).

To stabilize the module, the option `programs.yabar.package` now
defaults to `pkgs.yabar-unstable` and yields a warning with several
linked issues that are known on `pkgs.yabar`.

The test has been refactored as well to ensure that `yabar` actually
starts (and avoid non-deterministic random success) and takes a
screenshot of a very minimalistic configuration on IceWM.

Fixes #46899
This commit is contained in:
Maximilian Bosch 2018-09-20 12:47:46 +02:00 committed by xeji
parent c6d0260239
commit 8b58a7187c
2 changed files with 27 additions and 6 deletions

View file

@ -44,10 +44,23 @@ in
enable = mkEnableOption "yabar";
package = mkOption {
default = pkgs.yabar;
example = literalExample "pkgs.yabar-unstable";
default = pkgs.yabar-unstable;
example = literalExample "pkgs.yabar";
type = types.package;
# `yabar-stable` segfaults under certain conditions.
apply = x: if x == pkgs.yabar-unstable then x else flip warn x ''
It's not recommended to use `yabar' with `programs.yabar', the (old) stable release
tends to segfault under certain circumstances:
* https://github.com/geommer/yabar/issues/86
* https://github.com/geommer/yabar/issues/68
* https://github.com/geommer/yabar/issues/143
Most of them don't occur on master anymore, until a new release is published, it's recommended
to use `yabar-unstable'.
'';
description = ''
The package which contains the `yabar` binary.

View file

@ -8,18 +8,26 @@ with lib;
maintainers = [ ma27 ];
};
nodes.yabar = {
machine = {
imports = [ ./common/x11.nix ./common/user-account.nix ];
services.xserver.displayManager.auto.user = "bob";
programs.yabar.enable = true;
programs.yabar.bars = {
top.indicators.date.exec = "YABAR_DATE";
};
};
testScript = ''
$yabar->start;
$yabar->waitForX;
$machine->start;
$machine->waitForX;
$yabar->waitForUnit("yabar.service", "bob");
# confirm proper startup
$machine->waitForUnit("yabar.service", "bob");
$machine->sleep(10);
$machine->waitForUnit("yabar.service", "bob");
$machine->screenshot("top_bar");
'';
})