feat: add different rustdesks for configs
This commit is contained in:
38
hosts/nb/modules/desktop/rustdesk-epicenter.nix
Normal file
38
hosts/nb/modules/desktop/rustdesk-epicenter.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
wrapperScript = pkgs.writeShellScriptBin "rustdesk-wrapper" ''
|
||||
CONFIG_FILE="$HOME/.config/rustdesk/RustDesk2.toml"
|
||||
CONFIG_DIR="$(dirname "$CONFIG_FILE")"
|
||||
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
${pkgs.rustdesk-flutter}/bin/rustdesk &
|
||||
RUSTDESK_PID=$!
|
||||
sleep 3
|
||||
kill $RUSTDESK_PID 2>/dev/null || true
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
sed -i "s|^rendezvous_server = .*|rendezvous_server = 'tools.epicenter.works:21116'|" "$CONFIG_FILE"
|
||||
sed -i "s|^custom-rendezvous-server = .*|custom-rendezvous-server = 'tools.epicenter.works'|" "$CONFIG_FILE"
|
||||
sed -i "/^key\s*=.*/d" "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
# Launch RustDesk
|
||||
exec ${pkgs.rustdesk-flutter}/bin/rustdesk "$@"
|
||||
'';
|
||||
|
||||
rustdeskEpicenterDesktopItem = pkgs.makeDesktopItem {
|
||||
name = "rustdesk-epicenter";
|
||||
desktopName = "RustDesk Epicenter";
|
||||
exec = "${wrapperScript}/bin/rustdesk-wrapper";
|
||||
icon = "rustdesk"; # Using the standard rustdesk icon
|
||||
categories = [ "Network" "RemoteAccess" ];
|
||||
comment = "Remote desktop software configured for Epicenter";
|
||||
};
|
||||
in {
|
||||
environment.systemPackages = [
|
||||
rustdeskEpicenterDesktopItem
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user