home-manager/tests/modules/services/window-managers/sway/sway-null-package.nix
Nicolas Berbiche d62bdaf938
sway: fix error with null package and swaybar
When setting `...sway.package = null`, the default bar configuration
would throw an error trying to use the bar from the null package.

Logic is added to use the bar from `pkgs.sway` instead of `cfg.package`
if it is null.

Fixes #1714
2021-01-11 12:26:18 -05:00

46 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
dummy-package = pkgs.runCommandLocal "dummy-package" { } "mkdir $out";
in {
config = {
# Enables the default bar configuration
home.stateVersion = "20.09";
wayland.windowManager.sway = {
enable = true;
package = null;
config.menu = "${pkgs.dmenu}/bin/dmenu_run";
};
nixpkgs.overlays = [
(self: super: {
dmenu = dummy-package // { outPath = "@dmenu@"; };
rxvt-unicode-unwrapped = dummy-package // {
outPath = "@rxvt-unicode-unwrapped@";
};
i3status = dummy-package // { outPath = "@i3status@"; };
sway = dummy-package // { outPath = "@sway@"; };
xwayland = dummy-package // { outPath = "@xwayland@"; };
})
];
assertions = [{
assertion =
!elem config.wayland.windowManager.sway.config.bars [ [ { } ] [ ] ];
message =
"The default Sway bars configuration should be set for this test (sway-null-package) to work.";
}];
nmt.script = ''
assertFileExists home-files/.config/sway/config
assertFileContent home-files/.config/sway/config \
${./sway-null-package.conf}
'';
};
}