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:
parent
8fc1e46ab6
commit
cf9ff6d993
8 changed files with 150 additions and 0 deletions
10
modules/misc/news/2025/05/2025-05-24_18-18-40.nix
Normal file
10
modules/misc/news/2025/05/2025-05-24_18-18-40.nix
Normal 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.
|
||||
'';
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
95
modules/services/wayvnc.nix
Normal file
95
modules/services/wayvnc.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
3
tests/modules/services/wayvnc/default.nix
Normal file
3
tests/modules/services/wayvnc/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
wayvnc-simple = ./simple.nix;
|
||||
}
|
||||
3
tests/modules/services/wayvnc/simple-config
Normal file
3
tests/modules/services/wayvnc/simple-config
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
address=0.0.0.0
|
||||
port=5901
|
||||
username=foobar
|
||||
26
tests/modules/services/wayvnc/simple.nix
Normal file
26
tests/modules/services/wayvnc/simple.nix
Normal 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}
|
||||
'';
|
||||
|
||||
}
|
||||
11
tests/modules/services/wayvnc/simple.service
Normal file
11
tests/modules/services/wayvnc/simple.service
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue