1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-14 13:01:09 +01:00

wayvnc: init (#7123)

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2025-05-25 01:38:54 +02:00 committed by GitHub
parent 8fc1e46ab6
commit cf9ff6d993
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 150 additions and 0 deletions

View file

@ -0,0 +1,10 @@
{ pkgs, ... }:
{
time = "2025-05-24T18:18:40+00:00";
condition = pkgs.stdenv.hostPlatform.isLinux;
message = ''
A new module is available: `services.wayvnc`
wayvnc is a VNC server for wlroots based Wayland compositors.
'';
}

View file

@ -470,6 +470,7 @@ let
./services/vdirsyncer.nix
./services/volnoti.nix
./services/way-displays.nix
./services/wayvnc.nix
./services/window-managers/awesome.nix
./services/window-managers/bspwm/default.nix
./services/window-managers/fluxbox.nix

View file

@ -0,0 +1,95 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
getExe
literalExpression
mkEnableOption
mkIf
mkOption
mkPackageOption
types
;
cfg = config.services.wayvnc;
format = pkgs.formats.keyValue { };
in
{
meta.maintainers = with lib.maintainers; [ Scrumplex ];
options.services.wayvnc = {
enable = mkEnableOption "wayvnc VNC server";
package = mkPackageOption pkgs "wayvnc" { };
autoStart = mkEnableOption "autostarting of wayvnc";
systemdTarget = mkOption {
type = types.str;
default = config.wayland.systemd.target;
defaultText = literalExpression "config.wayland.systemd.target";
description = ''
Systemd target to bind to.
'';
};
settings = mkOption {
type = types.submodule {
freeformType = format.type;
options = {
address = mkOption {
description = ''
The address to which the server shall bind, e.g. 0.0.0.0 or
localhost.
'';
type = types.str;
example = "0.0.0.0";
};
port = mkOption {
description = ''
The port to which the server shall bind.
'';
type = types.port;
example = 5901;
};
};
};
description = ''
See CONFIGURATION section in {manpage}`wayvnc(1)`.
'';
default = { };
example = {
address = "0.0.0.0";
port = 5901;
};
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.wayvnc" pkgs lib.platforms.linux)
];
systemd.user.services."wayvnc" = {
Unit = {
Description = "wayvnc VNC server";
Documentation = [ "man:wayvnc(1)" ];
After = [ cfg.systemdTarget ];
PartOf = [ cfg.systemdTarget ];
};
Service.ExecStart = [ (getExe cfg.package) ];
Install.WantedBy = lib.mkIf cfg.autoStart [ cfg.systemdTarget ];
};
# For manpage and wayvncctl
home.packages = [ cfg.package ];
xdg.configFile."wayvnc/config".source = format.generate "wayvnc.conf" cfg.settings;
};
}

View file

@ -496,6 +496,7 @@ import nmtSrc {
./modules/services/udiskie
./modules/services/volnoti
./modules/services/way-displays
./modules/services/wayvnc
./modules/services/window-managers/bspwm
./modules/services/window-managers/herbstluftwm
./modules/services/window-managers/hyprland

View file

@ -0,0 +1,3 @@
{
wayvnc-simple = ./simple.nix;
}

View file

@ -0,0 +1,3 @@
address=0.0.0.0
port=5901
username=foobar

View file

@ -0,0 +1,26 @@
{ config, ... }:
{
services.wayvnc = {
enable = true;
package = config.lib.test.mkStubPackage { };
autoStart = true;
settings = {
address = "0.0.0.0";
port = 5901;
username = "foobar";
};
};
nmt.script = ''
assertFileExists home-files/.config/systemd/user/wayvnc.service
assertFileContent \
$(normalizeStorePaths home-files/.config/systemd/user/wayvnc.service) \
${./simple.service}
assertFileExists home-files/.config/wayvnc/config
assertFileContent home-files/.config/wayvnc/config ${./simple-config}
'';
}

View file

@ -0,0 +1,11 @@
[Install]
WantedBy=graphical-session.target
[Service]
ExecStart=/nix/store/00000000000000000000000000000000-dummy/bin/dummy
[Unit]
After=graphical-session.target
Description=wayvnc VNC server
Documentation=man:wayvnc(1)
PartOf=graphical-session.target