mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
nixos/tests/sx: init
This commit is contained in:
parent
b6144020d1
commit
2c43dd5d82
@ -925,6 +925,7 @@ in {
|
||||
swayfx = handleTest ./swayfx.nix {};
|
||||
switchTest = handleTest ./switch-test.nix { ng = false; };
|
||||
switchTestNg = handleTest ./switch-test.nix { ng = true; };
|
||||
sx = handleTest ./sx.nix {};
|
||||
sympa = handleTest ./sympa.nix {};
|
||||
syncthing = handleTest ./syncthing.nix {};
|
||||
syncthing-no-settings = handleTest ./syncthing-no-settings.nix {};
|
||||
|
63
nixos/tests/sx.nix
Normal file
63
nixos/tests/sx.nix
Normal file
@ -0,0 +1,63 @@
|
||||
import ./make-test-python.nix (
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
name = "sx";
|
||||
meta.maintainers = with lib.maintainers; [
|
||||
figsoda
|
||||
thiagokokada
|
||||
];
|
||||
|
||||
nodes.machine =
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ ./common/user-account.nix ];
|
||||
|
||||
environment.systemPackages = with pkgs; [ icewm ];
|
||||
|
||||
services.getty.autologinUser = "alice";
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
displayManager.sx.enable = true;
|
||||
};
|
||||
|
||||
# Create sxrc file on login and start sx
|
||||
programs.bash.loginShellInit =
|
||||
# bash
|
||||
''
|
||||
mkdir -p "$HOME/.config/sx"
|
||||
echo 'exec icewm' > "$HOME/.config/sx/sxrc"
|
||||
chmod +x "$HOME/.config/sx/sxrc"
|
||||
|
||||
sx
|
||||
'';
|
||||
};
|
||||
|
||||
testScript =
|
||||
{ nodes, ... }:
|
||||
let
|
||||
user = nodes.machine.users.users.alice;
|
||||
in
|
||||
# python
|
||||
''
|
||||
start_all()
|
||||
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
|
||||
xauthority = "${user.home}/.local/share/sx/xauthority"
|
||||
machine.wait_for_file(xauthority)
|
||||
machine.succeed(f"xauth merge {xauthority}")
|
||||
|
||||
def icewm_is_visible(_last_try: bool) -> bool:
|
||||
# sx will set DISPLAY as the TTY number we started, in this case
|
||||
# TTY1:
|
||||
# https://github.com/Earnestly/sx/blob/master/sx#L41.
|
||||
# We can't use `machine.wait_for_window` here since we are running
|
||||
# X as alice and not root.
|
||||
return "IceWM" in machine.succeed("DISPLAY=:1 xwininfo -root -tree")
|
||||
|
||||
# Adding a retry logic to increase reliability
|
||||
retry(icewm_is_visible)
|
||||
'';
|
||||
}
|
||||
)
|
@ -5,6 +5,7 @@
|
||||
makeDesktopItem,
|
||||
patsh,
|
||||
xorg,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
@ -40,7 +41,12 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
}/share/applications/sx.desktop
|
||||
'';
|
||||
|
||||
passthru.providedSessions = [ "sx" ];
|
||||
passthru = {
|
||||
providedSessions = [ "sx" ];
|
||||
tests = {
|
||||
inherit (nixosTests) sx;
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Simple alternative to both xinit and startx for starting a Xorg server";
|
||||
|
Loading…
Reference in New Issue
Block a user