forked from pub-solar/os
Add wayvnc option for sway
This change allows you to start wayvnc anytime your sway session starts. For hosts where you want to enable this, you'll need to generate the certificate and keys, see: https://github.com/any1/wayvnc#encryption--authentication You can then add these to your secrets via agenix, and load them as `vnc-key.pem` and `vnc-cert.pem` into `/run/secrets`. Enable the wayvnc server via the option `pub-solar.sway.vnc.enable`. At the time of writing, `tigervnc` appears to be a good vnc client to use. ```
This commit is contained in:
parent
895cdc30b9
commit
06ca86f9c9
|
@ -47,3 +47,9 @@ mode "$mode_system" {
|
|||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
set $mode_vncclient In VNCClient mode. Press $mod+Num_Lock to return.
|
||||
bindsym $mod+Num_Lock mode "$mode_vncclient"
|
||||
mode "$mode_vncclient" {
|
||||
bindsym $mod+Num_Lock mode "default"
|
||||
}
|
||||
|
|
8
modules/sway/config/wayvnc/config.nix
Normal file
8
modules/sway/config/wayvnc/config.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ psCfg, pkgs }: "
|
||||
address=0.0.0.0
|
||||
enable_auth=true
|
||||
username=${psCfg.user.name}
|
||||
password=${psCfg.user.password}
|
||||
private_key_file=/run/secrets/vnc-key.pem
|
||||
certificate_file=/run/secrets/vnc-cert.pem
|
||||
"
|
|
@ -7,11 +7,13 @@ in
|
|||
{
|
||||
options.pub-solar.sway = {
|
||||
enable = mkEnableOption "Life in boxes";
|
||||
};
|
||||
options.pub-solar.sway.v4l2loopback.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "WebCam streaming tool";
|
||||
vnc.enable = mkEnableOption "Enable vnc service";
|
||||
|
||||
v4l2loopback.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "WebCam streaming tool";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
@ -76,6 +78,8 @@ in
|
|||
systemd.user.services.waybar = import ./waybar.service.nix pkgs;
|
||||
systemd.user.targets.sway-session = import ./sway-session.target.nix pkgs;
|
||||
|
||||
systemd.user.services.wayvnc = mkIf cfg.vnc.enable (import ./wayvnc.service.nix pkgs);
|
||||
|
||||
xdg.configFile."sway/config".source = ./config/config;
|
||||
xdg.configFile."sway/config.d/colorscheme.conf".source = ./config/config.d/colorscheme.conf;
|
||||
xdg.configFile."sway/config.d/theme.conf".source = ./config/config.d/theme.conf;
|
||||
|
@ -83,6 +87,7 @@ in
|
|||
xdg.configFile."sway/config.d/custom-keybindings.conf".source = ./config/config.d/custom-keybindings.conf;
|
||||
xdg.configFile."sway/config.d/applications.conf".source = ./config/config.d/applications.conf;
|
||||
xdg.configFile."sway/config.d/systemd.conf".source = ./config/config.d/systemd.conf;
|
||||
xdg.configFile."wayvnc/config".text = import ./config/wayvnc/config.nix { inherit psCfg; inherit pkgs; };
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
19
modules/sway/wayvnc.service.nix
Normal file
19
modules/sway/wayvnc.service.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
pkgs:
|
||||
{
|
||||
Unit = {
|
||||
Description = "A VNC server for wlroots based Wayland compositors ";
|
||||
Documentation = "https://github.com/any1/wayvnc";
|
||||
BindsTo = [ "sway-session.target" ];
|
||||
After = [ "graphical-session-pre.target" "network-online.target" ];
|
||||
Wants = [ "graphical-session-pre.target" "network-online.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.wayvnc}/bin/wayvnc";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "sway-session.target" ];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue