Add scripts to run headless Wayland sessions
This commit is contained in:
parent
1605e312d0
commit
8e3f467b3a
3 changed files with 59 additions and 0 deletions
36
package/wayland-headless/package.nix
Normal file
36
package/wayland-headless/package.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ ... }: { stdenvNoCC, lib, shellcheck-minimal, runtimeShell, cage }:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "wayland-headless";
|
||||
|
||||
nativeInstallCheckInputs = [ shellcheck-minimal ];
|
||||
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
doInstallCheck = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
|
||||
substitute ${./wl-run.sh} "$out/bin/wl-run" \
|
||||
--subst-var-by runtimeShell ${lib.escapeShellArg runtimeShell} \
|
||||
--subst-var-by cage ${lib.escapeShellArg cage}
|
||||
|
||||
substitute ${./xvfb-run.sh} "$out/bin/xvfb-run" \
|
||||
--subst-var-by runtimeShell ${lib.escapeShellArg runtimeShell} \
|
||||
--subst-var out
|
||||
|
||||
chmod +x "$out/bin/"{wl-run,xvfb-run}
|
||||
'';
|
||||
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
shellcheck "$out/bin/"{wl-run,xvfb-run}
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
meta = {
|
||||
inherit (cage.meta) platforms;
|
||||
};
|
||||
}
|
11
package/wayland-headless/wl-run.sh
Normal file
11
package/wayland-headless/wl-run.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!@runtimeShell@
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
WLR_BACKENDS=headless \
|
||||
WLR_LIBINPUT_NO_DEVICES=1 \
|
||||
WLR_RENDERER=pixman \
|
||||
XDG_RUNTIME_DIR="$(mktemp -d)" \
|
||||
exec '@cage@/bin/cage' -- "$@"
|
12
package/wayland-headless/xvfb-run.sh
Normal file
12
package/wayland-headless/xvfb-run.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!@runtimeShell@
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# Discard all options
|
||||
while [[ "$1" =~ ^- ]]; do
|
||||
shift
|
||||
done
|
||||
|
||||
exec '@out@/bin/wl-run' "$@"
|
Loading…
Reference in a new issue