Skip to content

Commit

Permalink
Merge pull request #272501 from ppom0/rustdesk-module
Browse files Browse the repository at this point in the history
rustdesk-server: init module
  • Loading branch information
mkg20001 authored Jan 23, 2024
2 parents 97f2b81 + 65544c6 commit 96d1602
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2405.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m

- [TuxClocker](https://github.com/Lurkki14/tuxclocker), a hardware control and monitoring program. Available as [programs.tuxclocker](#opt-programs.tuxclocker.enable).

- [RustDesk](https://rustdesk.com), a full-featured open source remote control alternative for self-hosting and security with minimal configuration. Alternative to TeamViewer.

## Backward Incompatibilities {#sec-release-24.05-incompatibilities}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@
./services/monitoring/riemann-dash.nix
./services/monitoring/riemann-tools.nix
./services/monitoring/riemann.nix
./services/monitoring/rustdesk-server.nix
./services/monitoring/scollector.nix
./services/monitoring/smartd.nix
./services/monitoring/snmpd.nix
Expand Down
95 changes: 95 additions & 0 deletions nixos/modules/services/monitoring/rustdesk-server.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{ lib, pkgs, config, ... }:
let
TCPPorts = [21115 21116 21117 21118 21119];
UDPPorts = [21116];
in {
options.services.rustdesk-server = with lib; with types; {
enable = mkEnableOption "RustDesk, a remote access and remote control software, allowing maintenance of computers and other devices.";

package = mkPackageOption pkgs "rustdesk-server" {};

openFirewall = mkOption {
type = types.bool;
default = false;
description = ''
Open the connection ports.
TCP (${lib.concatStringsSep ", " (map toString TCPPorts)})
UDP (${lib.concatStringsSep ", " (map toString UDPPorts)})
'';
};

relayIP = mkOption {
type = str;
description = ''
The public facing IP of the RustDesk relay.
'';
};
};

config = let
cfg = config.services.rustdesk-server;
serviceDefaults = {
enable = true;
requiredBy = [ "rustdesk.target" ];
serviceConfig = {
Slice = "system-rustdesk.slice";
User = "rustdesk";
Group = "rustdesk";
Environment = [];
WorkingDirectory = "/var/lib/rustdesk";
StateDirectory = "rustdesk";
StateDirectoryMode = "0750";
LockPersonality = true;
NoNewPrivileges = true;
PrivateDevices = true;
PrivateMounts = true;
PrivateTmp = true;
PrivateUsers = true;
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
ProtectSystem = "strict";
RemoveIPC = true;
RestrictNamespaces = true;
RestrictSUIDSGID = true;
};
};
in lib.mkIf cfg.enable {
users.users.rustdesk = {
description = "System user for RustDesk";
isSystemUser = true;
group = "rustdesk";
};
users.groups.rustdesk = {};

networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall TCPPorts;
networking.firewall.allowedUDPPorts = lib.mkIf cfg.openFirewall UDPPorts;

systemd.slices.system-rustdesk = {
enable = true;
description = "Slice designed to contain RustDesk Signal & RustDesk Relay";
};

systemd.targets.rustdesk = {
enable = true;
description = "Target designed to group RustDesk Signal & RustDesk Relay";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
};

systemd.services.rustdesk-signal = lib.mkMerge [ serviceDefaults {
serviceConfig.ExecStart = "${cfg.package}/bin/hbbs -r ${cfg.relayIP}";
} ];

systemd.services.rustdesk-relay = lib.mkMerge [ serviceDefaults {
serviceConfig.ExecStart = "${cfg.package}/bin/hbbr";
} ];
};

meta.maintainers = with lib.maintainers; [ ppom ];
}
28 changes: 28 additions & 0 deletions pkgs/by-name/ye/yeswiki/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
lib,
stdenv,
fetchurl,
unzip,
}:
let
version = "4.4.2";
in stdenv.mkDerivation {
pname = "yeswiki";
inherit version;

src = fetchurl {
url = "https://repository.yeswiki.net/doryphore/yeswiki-doryphore-${version}.zip";
hash = "sha256-TNiVBragEnLkMTu/Op6sCFsk9wWXUQ2GUPqmWgPV/vk=";
};

nativeBuildInputs = [
unzip
];

installPhase = ''
runHook preInstall
mkdir -p $out/
cp -R . $out/
runHook postInstall
'';
}

0 comments on commit 96d1602

Please sign in to comment.