nixos/home/headless/home.nix

32 lines
636 B
Nix
Raw Normal View History

2025-01-13 11:52:09 +08:00
{
pkgs,
lib,
config,
...
}:
with lib;
let
2024-04-01 08:26:47 +08:00
cfg = config.passthrough.headless;
2025-01-13 11:52:09 +08:00
in
mkIf (cfg.enable != null) {
2024-04-01 08:26:47 +08:00
wayland.windowManager.sway.config = {
output = {
${cfg.enable}.pos = "0 0";
HEADLESS-1 = cfg.output;
};
startup = [ { command = "swaymsg create_output && swaymsg output HEADLESS-1 disable"; } ];
};
2025-01-13 11:52:09 +08:00
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
'')
];
2024-04-01 08:26:47 +08:00
}