diff --git a/home-manager/modules/sway/default.nix b/home-manager/modules/sway/default.nix index 89ad054..427b587 100644 --- a/home-manager/modules/sway/default.nix +++ b/home-manager/modules/sway/default.nix @@ -18,7 +18,6 @@ in { options.eboskma.programs.sway = { enable = mkEnableOption "sway"; - wayvnc = mkEnableOption "wayvnc"; package = mkPackageOption pkgs "sway" { }; lock-wallpaper = mkOption { @@ -368,23 +367,6 @@ in }; systemd.user = { - services = { - wayvnc = mkIf cfg.wayvnc { - Unit = { - Description = "VNC server for wlroots based Wayland compositors"; - After = [ "sway-session.target" ]; - }; - - Service = { - ExecStart = "${pkgs.wayvnc}/bin/wayvnc 0.0.0.0"; - Restart = "always"; - }; - - Install = { - WantedBy = [ "graphical-session.target" ]; - }; - }; - }; targets.tray = { Unit = { Description = "Home Manager System Tray"; diff --git a/home-manager/modules/wayvnc/default.nix b/home-manager/modules/wayvnc/default.nix new file mode 100644 index 0000000..620f851 --- /dev/null +++ b/home-manager/modules/wayvnc/default.nix @@ -0,0 +1,66 @@ +{ + 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" ]; + }; + }; + }; + }; + }; +} diff --git a/users/erwin/home.nix b/users/erwin/home.nix index 8ac5494..40024fb 100644 --- a/users/erwin/home.nix +++ b/users/erwin/home.nix @@ -150,6 +150,12 @@ in copyCommand = "${pkgs.wl-clipboard}/bin/wl-copy"; }; }; + services = { + wayvnc = { + enable = true; + gpuAcceleration = true; + }; + }; }; home = { @@ -178,6 +184,7 @@ in element-desktop fd ffmpeg_5-full + hashcat helvum imagemagick (imv.override { diff --git a/users/erwin/work.nix b/users/erwin/work.nix index a2b1a0e..6ac21ce 100644 --- a/users/erwin/work.nix +++ b/users/erwin/work.nix @@ -122,7 +122,6 @@ in sway = { enable = true; package = pkgs.sway; - wayvnc = true; lock-wallpaper = "${homeCfg.home.homeDirectory}/.wallpapers/river-3840.png"; output = { "DP-1" = { @@ -163,6 +162,9 @@ in }; services = { xbanish.enable = false; + wayvnc = { + enable = true; + }; }; }; programs = {