feat(headless): add headless module

This commit is contained in:
514fpv 2024-04-01 08:26:47 +08:00
parent f297ae1611
commit 376934f9f2
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw
2 changed files with 75 additions and 0 deletions

24
home/headless/home.nix Normal file
View file

@ -0,0 +1,24 @@
{ pkgs
, lib
, config
, ... }: with lib; let
cfg = config.passthrough.headless;
in mkIf (cfg.enable != null) {
wayland.windowManager.sway.config = {
output = {
${cfg.enable}.pos = "0 0";
HEADLESS-1 = cfg.output;
};
startup = [ { command = "swaymsg create_output && swaymsg output HEADLESS-1 disable"; } ];
};
home.packages = [ (pkgs.writeShellScriptBin "headless" ''
swaymsg output HEADLESS-1 enable
${pkgs.wayvnc}/bin/wayvnc \
--output=HEADLESS-1 \
${cfg.extraArgs} \
${cfg.host} ${toString cfg.port}
swaymsg output HEADLESS-1 disable
'') ];
}