ly: add option to build without x11 support
This commit is contained in:
committed by
Prof. Dr.-Ing. Markus Wamser
parent
166babb622
commit
17260c3126
@@ -12,7 +12,7 @@ let
|
||||
cfg = config.services.displayManager.ly;
|
||||
xEnv = config.systemd.services.display-manager.environment;
|
||||
|
||||
ly = cfg.package;
|
||||
ly = cfg.package.override { x11Support = cfg.x11Support; };
|
||||
|
||||
iniFmt = pkgs.formats.iniWithGlobalSection { };
|
||||
|
||||
@@ -57,6 +57,11 @@ in
|
||||
options = {
|
||||
services.displayManager.ly = {
|
||||
enable = mkEnableOption "ly as the display manager";
|
||||
x11Support = mkOption {
|
||||
description = "Whether to enable support for X11";
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs [ "ly" ] { };
|
||||
|
||||
|
||||
+36
-10
@@ -1,23 +1,35 @@
|
||||
{ ... }:
|
||||
{ lib, ... }:
|
||||
|
||||
let
|
||||
machineBase = {
|
||||
imports = [ ./common/user-account.nix ];
|
||||
services.displayManager.ly = {
|
||||
enable = true;
|
||||
settings = {
|
||||
load = false;
|
||||
save = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
name = "ly";
|
||||
|
||||
nodes.machine =
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ ./common/user-account.nix ];
|
||||
services.displayManager.ly = {
|
||||
enable = true;
|
||||
settings = {
|
||||
load = false;
|
||||
save = false;
|
||||
};
|
||||
};
|
||||
lib.attrsets.recursiveUpdate machineBase {
|
||||
services.displayManager.ly.x11Support = true;
|
||||
services.xserver.enable = true;
|
||||
services.displayManager.defaultSession = "none+icewm";
|
||||
services.xserver.windowManager.icewm.enable = true;
|
||||
};
|
||||
nodes.machineNoX11 =
|
||||
{ ... }:
|
||||
lib.attrsets.recursiveUpdate machineBase {
|
||||
services.displayManager.ly.x11Support = false;
|
||||
services.displayManager.defaultSession = "sway";
|
||||
programs.sway.enable = true;
|
||||
};
|
||||
|
||||
testScript =
|
||||
{ nodes, ... }:
|
||||
@@ -26,6 +38,7 @@
|
||||
in
|
||||
''
|
||||
start_all()
|
||||
|
||||
machine.wait_until_tty_matches("2", "password:")
|
||||
machine.send_key("ctrl-alt-f2")
|
||||
machine.sleep(1)
|
||||
@@ -38,5 +51,18 @@
|
||||
machine.succeed("xauth merge /run/user/${toString user.uid}/lyxauth")
|
||||
machine.wait_for_window("^IceWM ")
|
||||
machine.screenshot("icewm")
|
||||
|
||||
machineNoX11.wait_until_tty_matches("2", "password:")
|
||||
machineNoX11.send_key("ctrl-alt-f2")
|
||||
machineNoX11.sleep(1)
|
||||
machineNoX11.screenshot("ly-no-x11")
|
||||
machineNoX11.send_chars("alice")
|
||||
machineNoX11.send_key("tab")
|
||||
machineNoX11.send_chars("${user.password}")
|
||||
machineNoX11.send_key("ret")
|
||||
machineNoX11.wait_for_file("/run/user/${toString user.uid}/wayland-1")
|
||||
machineNoX11.wait_for_file("/run/user/${toString user.uid}/sway-ipc.*.sock")
|
||||
machineNoX11.sleep(5)
|
||||
machineNoX11.screenshot("sway")
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
zig_0_14,
|
||||
callPackage,
|
||||
nixosTests,
|
||||
x11Support ? true,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
@@ -27,9 +28,8 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
zig_0_14.hook
|
||||
];
|
||||
buildInputs = [
|
||||
libxcb
|
||||
linux-pam
|
||||
];
|
||||
] ++ (lib.optionals x11Support [ libxcb ]);
|
||||
|
||||
postPatch = ''
|
||||
ln -s ${
|
||||
@@ -38,6 +38,9 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
}
|
||||
} $ZIG_GLOBAL_CACHE_DIR/p
|
||||
'';
|
||||
zigBuildFlags = [
|
||||
"-Denable_x11_support=${lib.boolToString x11Support}"
|
||||
];
|
||||
|
||||
passthru.tests = { inherit (nixosTests) ly; };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user