From 8b58a7187c9f3c8f1997f328c27c536effccdac3 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 20 Sep 2018 12:47:46 +0200 Subject: [PATCH] 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 --- nixos/modules/programs/yabar.nix | 17 +++++++++++++++-- nixos/tests/yabar.nix | 16 ++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/nixos/modules/programs/yabar.nix b/nixos/modules/programs/yabar.nix index a01083c3ace9..db085211366e 100644 --- a/nixos/modules/programs/yabar.nix +++ b/nixos/modules/programs/yabar.nix @@ -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. diff --git a/nixos/tests/yabar.nix b/nixos/tests/yabar.nix index 06fe5bc2b278..bbc0cf4c7dd7 100644 --- a/nixos/tests/yabar.nix +++ b/nixos/tests/yabar.nix @@ -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"); ''; })