67 lines
1.4 KiB
Nix
67 lines
1.4 KiB
Nix
|
{
|
||
|
pkgs,
|
||
|
config,
|
||
|
lib,
|
||
|
...
|
||
|
}:
|
||
|
with lib;
|
||
|
let
|
||
|
cfg = config.eboskma.services.wayvnc;
|
||
|
|
||
|
wayvncArgs = builtins.concatStringsSep " " (
|
||
|
(lib.optional cfg.gpuAcceleration "--gpu") ++ [ cfg.listenAddress ]
|
||
|
);
|
||
|
in
|
||
|
{
|
||
|
options.eboskma.services.wayvnc = {
|
||
|
enable = mkEnableOption "wayvnc";
|
||
|
listenAddress = mkOption {
|
||
|
description = "Bind wayvnc to this address";
|
||
|
type = types.str;
|
||
|
default = "0.0.0.0";
|
||
|
};
|
||
|
gpuAcceleration = mkEnableOption "GPU Accelerated encoding";
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
|
||
|
# [Unit]
|
||
|
# Description=A VNC server for wlroots based Wayland compositors
|
||
|
# Requires=sway.service
|
||
|
# After=sway.service
|
||
|
|
||
|
# [Service]
|
||
|
# Type=simple
|
||
|
# ExecStart=/usr/bin/wayvnc
|
||
|
# Restart=on-failure
|
||
|
# RestartSec=1
|
||
|
# TimeoutStopSec=10
|
||
|
|
||
|
# [Install]
|
||
|
# WantedBy=multi-user.target
|
||
|
|
||
|
systemd.user = {
|
||
|
services = {
|
||
|
wayvnc = {
|
||
|
Unit = {
|
||
|
Description = "A VNC server for wlroots based Wayland compositors";
|
||
|
Requires = [ "sway-session.target" ];
|
||
|
After = [ "sway-session.target" ];
|
||
|
};
|
||
|
|
||
|
Service = {
|
||
|
ExecStart = "${pkgs.wayvnc}/bin/wayvnc ${wayvncArgs}";
|
||
|
Restart = "on-failure";
|
||
|
RestartSec = 1;
|
||
|
TimeoutStopSec = 10;
|
||
|
};
|
||
|
|
||
|
Install = {
|
||
|
WantedBy = [ "multi-user.target" ];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|