diff --git a/registry/glitchdoescode/.images/avatar.png b/registry/glitchdoescode/.images/avatar.png new file mode 100644 index 00000000..6ef32a5c Binary files /dev/null and b/registry/glitchdoescode/.images/avatar.png differ diff --git a/registry/glitchdoescode/README.md b/registry/glitchdoescode/README.md new file mode 100644 index 00000000..6020a7fe --- /dev/null +++ b/registry/glitchdoescode/README.md @@ -0,0 +1,11 @@ +--- +display_name: "glitchdoescode" +bio: "Open source enthusiast and code contributor" +avatar_url: "./.images/avatar.png" +github: "glitchdoescode" +status: "community" +--- + +# glitchdoescode + +Open source enthusiast and code contributor, passionate about making development tools more accessible and efficient. diff --git a/registry/glitchdoescode/modules/parsec/README.md b/registry/glitchdoescode/modules/parsec/README.md new file mode 100644 index 00000000..80f2ebd0 --- /dev/null +++ b/registry/glitchdoescode/modules/parsec/README.md @@ -0,0 +1,174 @@ +--- +display_name: Parsec +description: Low-latency remote desktop streaming for gaming and creative work +icon: ../../../../.icons/desktop.svg +maintainer_github: glitchdoescode +verified: false +tags: [remote-desktop, streaming, gaming, creative, low-latency] +--- + +# Parsec + +Automatically install and configure [Parsec](https://parsec.app/) for low-latency remote desktop access in your Coder workspace. Parsec provides near-zero latency streaming with up to 4K resolution at 60 FPS, making it ideal for gaming, video editing, and other graphics-intensive applications. + +## Features + +- **Ultra-low latency**: Near-zero latency for responsive remote desktop access +- **High performance**: Up to 4K resolution at 60 FPS with hardware acceleration +- **Cross-platform**: Connect from any device to your Linux workspace +- **Secure**: Peer-to-peer connections with enterprise-grade security +- **Optimized**: Built specifically for gaming and creative workflows + +## Basic Usage + +```tf +module "parsec" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/glitchdoescode/parsec/coder" + version = "1.0.0" + agent_id = coder_agent.example.id +} +``` + +## Advanced Configuration + +### Specify Installation Method + +```tf +module "parsec" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/glitchdoescode/parsec/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + installation_method = "deb" # Options: "auto", "deb", "appimage" +} +``` + +### Disable Hardware Acceleration + +```tf +module "parsec" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/glitchdoescode/parsec/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + enable_hardware_acceleration = false +} +``` + +### Complete Example with Grouping + +```tf +module "parsec" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/glitchdoescode/parsec/coder" + version = "1.0.0" + agent_id = coder_agent.example.id + + # UI positioning + order = 1 + group = "Remote Access" + + # Performance settings + enable_hardware_acceleration = true + installation_method = "auto" +} +``` + +## Installation Methods + +The module supports multiple installation methods: + +- **`auto`** (default): Automatically detects your Linux distribution and chooses the best method +- **`deb`**: Uses the official DEB package for Ubuntu/Debian systems +- **`appimage`**: Uses the universal AppImage for maximum compatibility + +## System Requirements + +### Minimum Requirements + +- Linux distribution (Ubuntu, Debian, Arch, Fedora, etc.) +- X11 or Wayland display server +- Audio system (PulseAudio or ALSA) +- Network connection + +### Recommended for Best Performance + +- Dedicated GPU (NVIDIA, AMD, or Intel) +- Hardware acceleration drivers installed +- Fast internet connection (minimum 5 Mbps) + +## Supported Distributions + +- ✅ Ubuntu 18.04+ (LTS recommended) +- ✅ Debian 10+ +- ✅ Arch Linux +- ✅ Fedora 32+ +- ✅ CentOS 8+ +- ✅ Manjaro +- ✅ Pop!\_OS +- ✅ Most other Linux distributions via AppImage + +## Getting Started + +1. **Install the module** in your Coder template +2. **Start your workspace** - Parsec will install automatically +3. **Launch Parsec** from your applications menu or run `parsec` in terminal +4. **Create a Parsec account** at [parsec.app](https://parsec.app) +5. **Connect** from any device using the Parsec client + +## Hardware Acceleration + +When enabled (default), the module installs appropriate drivers for: + +- **Intel**: VA-API drivers for Intel integrated graphics +- **NVIDIA**: VDPAU drivers for NVIDIA GPUs +- **AMD**: Mesa drivers for AMD GPUs + +## Security + +Parsec uses: + +- **Peer-to-peer connections** - Traffic never goes through Parsec servers +- **AES-256 encryption** - All data is encrypted in transit +- **Host control** - You control exactly what guests can access + +## Troubleshooting + +### Audio Issues + +If you don't hear audio, ensure your audio system is properly configured: + +```bash +# Check audio system +pulseaudio --check -v + +# Restart PulseAudio if needed +pulseaudio -k && pulseaudio --start +``` + +### Graphics Issues + +For optimal performance, ensure graphics drivers are installed: + +```bash +# Check for graphics acceleration +vainfo # For VA-API +vdpauinfo # For VDPAU +``` + +### Connection Issues + +- Ensure your firewall allows Parsec connections +- Check your network connection speed +- Verify Parsec service is running: `systemctl --user status parsec` + +## Variables + +| Variable | Type | Default | Description | +| ------------------------------ | ------ | -------- | ------------------------------------------------------- | +| `agent_id` | string | - | **Required.** The ID of a Coder agent | +| `installation_method` | string | `"auto"` | Installation method: `"auto"`, `"deb"`, or `"appimage"` | +| `enable_hardware_acceleration` | bool | `true` | Enable hardware acceleration for optimal performance | +| `order` | number | `null` | Position in the Coder dashboard | +| `group` | string | `null` | Group name for organization | diff --git a/registry/glitchdoescode/modules/parsec/main.test.ts b/registry/glitchdoescode/modules/parsec/main.test.ts new file mode 100644 index 00000000..427477d9 --- /dev/null +++ b/registry/glitchdoescode/modules/parsec/main.test.ts @@ -0,0 +1,71 @@ +import { describe, expect, it } from "bun:test"; +import { + runTerraformApply, + runTerraformInit, + testRequiredVariables, +} from "~test"; + +describe("parsec", async () => { + await runTerraformInit(import.meta.dir); + + testRequiredVariables(import.meta.dir, { + agent_id: "foo", + }); + + it("accepts valid installation methods", async () => { + await runTerraformApply(import.meta.dir, { + agent_id: "foo", + installation_method: "auto", + }); + + await runTerraformApply(import.meta.dir, { + agent_id: "foo", + installation_method: "deb", + }); + + await runTerraformApply(import.meta.dir, { + agent_id: "foo", + installation_method: "appimage", + }); + }); + + it("rejects invalid installation methods", () => { + const t = async () => { + await runTerraformApply(import.meta.dir, { + agent_id: "foo", + installation_method: "invalid", + }); + }; + expect(t).toThrow("Installation method must be one of: auto, deb, appimage"); + }); + + it("accepts hardware acceleration settings", async () => { + await runTerraformApply(import.meta.dir, { + agent_id: "foo", + enable_hardware_acceleration: true, + }); + + await runTerraformApply(import.meta.dir, { + agent_id: "foo", + enable_hardware_acceleration: false, + }); + }); + + it("sets default values correctly", async () => { + const state = await runTerraformApply(import.meta.dir, { + agent_id: "foo", + }); + + // Check that default values are applied + expect(state.outputs.parsec_info.value.installation_method).toBe("auto"); + expect(state.outputs.parsec_info.value.hardware_acceleration).toBe(true); + }); + + it("configures UI positioning", async () => { + await runTerraformApply(import.meta.dir, { + agent_id: "foo", + order: 1, + group: "Remote Access", + }); + }); +}); \ No newline at end of file diff --git a/registry/glitchdoescode/modules/parsec/main.tf b/registry/glitchdoescode/modules/parsec/main.tf new file mode 100644 index 00000000..72a6d867 --- /dev/null +++ b/registry/glitchdoescode/modules/parsec/main.tf @@ -0,0 +1,80 @@ +terraform { + required_version = ">= 1.0" + + required_providers { + coder = { + source = "coder/coder" + version = ">= 2.5" + } + } +} + +variable "agent_id" { + type = string + description = "The ID of a Coder agent." +} + +variable "installation_method" { + type = string + description = "Installation method for Parsec: 'auto' (detect), 'deb' (Ubuntu/Debian), or 'appimage' (universal)" + default = "auto" + validation { + condition = contains(["auto", "deb", "appimage"], var.installation_method) + error_message = "Installation method must be one of: auto, deb, appimage" + } +} + +variable "enable_hardware_acceleration" { + type = bool + description = "Enable hardware acceleration for optimal performance" + default = true +} + +variable "order" { + type = number + description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)." + default = null +} + +variable "group" { + type = string + description = "The name of a group that this app belongs to." + default = null +} + +data "coder_workspace" "me" {} +data "coder_workspace_owner" "me" {} + +resource "coder_script" "parsec" { + agent_id = var.agent_id + display_name = "Parsec" + icon = "/icon/desktop.svg" + script = templatefile("${path.module}/run.sh", { + INSTALLATION_METHOD = var.installation_method, + ENABLE_HARDWARE_ACCELERATION = var.enable_hardware_acceleration ? "true" : "false" + }) + run_on_start = true + run_on_stop = false +} + +resource "coder_app" "parsec" { + agent_id = var.agent_id + slug = "parsec" + display_name = "Parsec" + icon = "/icon/desktop.svg" + external = true + order = var.order + group = var.group + + # Parsec uses a custom protocol, so we'll launch the installed app + url = "parsec://" +} + +output "parsec_info" { + value = { + installation_method = var.installation_method + hardware_acceleration = var.enable_hardware_acceleration + status = "Parsec installation completed" + } + description = "Information about the Parsec installation" +} diff --git a/registry/glitchdoescode/modules/parsec/run.sh b/registry/glitchdoescode/modules/parsec/run.sh new file mode 100755 index 00000000..b61887b0 --- /dev/null +++ b/registry/glitchdoescode/modules/parsec/run.sh @@ -0,0 +1,292 @@ +#!/usr/bin/env bash + +# Exit on error, undefined variables, and pipe failures +set -euo pipefail + +# Convert templated variables to shell variables +INSTALLATION_METHOD=${INSTALLATION_METHOD} +ENABLE_HARDWARE_ACCELERATION=${ENABLE_HARDWARE_ACCELERATION} + +# Colors for output +BOLD='\033[0;1m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' # No Color + +# Logging functions +log_info() { + printf "$${GREEN}[INFO]$${NC} %s\n" "$1" +} + +log_warn() { + printf "$${YELLOW}[WARN]$${NC} %s\n" "$1" +} + +log_error() { + printf "$${RED}[ERROR]$${NC} %s\n" "$1" +} + +# Check if running as root +if [[ $EUID -eq 0 ]]; then + log_error "This script should not be run as root for security reasons" + exit 1 +fi + +# Check if Parsec is already installed +if command -v parsec &> /dev/null; then + log_info "Parsec is already installed, skipping installation" + exit 0 +fi + +printf "$${BOLD}🎮 Installing Parsec for Low-Latency Remote Desktop Access...$${NC}\n\n" + +# Function to detect the Linux distribution +detect_distro() { + if [[ -f /etc/os-release ]]; then + source /etc/os-release + echo "$ID" + elif [[ -f /etc/redhat-release ]]; then + echo "rhel" + elif [[ -f /etc/debian_version ]]; then + echo "debian" + else + echo "unknown" + fi +} + +# Function to install system dependencies +install_dependencies() { + local distro=$1 + + case $distro in + ubuntu|debian|kali) + log_info "Installing dependencies for Ubuntu/Debian..." + if ! command -v sudo &> /dev/null; then + log_error "sudo is required but not installed" + exit 1 + fi + + # Update package lists + sudo apt-get update -qq + + # Install basic dependencies + sudo apt-get install -y curl wget ca-certificates + + # Install multimedia dependencies + if [[ "$ENABLE_HARDWARE_ACCELERATION" == "true" ]]; then + log_info "Installing hardware acceleration dependencies..." + sudo apt-get install -y \ + libva2 \ + libva-drm2 \ + libva-x11-2 \ + libvdpau1 \ + mesa-va-drivers \ + mesa-vdpau-drivers \ + intel-media-va-driver-non-free 2>/dev/null || \ + sudo apt-get install -y intel-media-va-driver || true + fi + + # Install audio dependencies + sudo apt-get install -y \ + pulseaudio \ + pulseaudio-utils \ + alsa-utils \ + libasound2-dev || true + ;; + arch|manjaro) + log_info "Installing dependencies for Arch Linux..." + if command -v pacman &> /dev/null; then + sudo pacman -Syu --noconfirm + sudo pacman -S --noconfirm curl wget ca-certificates + + if [[ "$ENABLE_HARDWARE_ACCELERATION" == "true" ]]; then + log_info "Installing hardware acceleration dependencies..." + sudo pacman -S --noconfirm \ + libva \ + libva-mesa-driver \ + libvdpau \ + mesa-vdpau \ + intel-media-driver || true + fi + + # Install audio dependencies + sudo pacman -S --noconfirm \ + pulseaudio \ + pulseaudio-alsa \ + alsa-utils || true + fi + ;; + fedora|rhel|centos) + log_info "Installing dependencies for Red Hat/Fedora..." + if command -v dnf &> /dev/null; then + sudo dnf update -y + sudo dnf install -y curl wget ca-certificates + + if [[ "$ENABLE_HARDWARE_ACCELERATION" == "true" ]]; then + log_info "Installing hardware acceleration dependencies..." + sudo dnf install -y \ + libva \ + libva-utils \ + libvdpau \ + mesa-va-drivers \ + mesa-vdpau-drivers || true + fi + + # Install audio dependencies + sudo dnf install -y \ + pulseaudio \ + pulseaudio-utils \ + alsa-utils || true + fi + ;; + *) + log_warn "Unknown distribution: $distro. Attempting generic installation..." + ;; + esac +} + +# Function to install Parsec via DEB package +install_parsec_deb() { + log_info "Installing Parsec via DEB package..." + + local temp_dir=$(mktemp -d) + local deb_file="$temp_dir/parsec-linux.deb" + + # Download the DEB package + log_info "Downloading Parsec DEB package..." + if ! curl -L "https://builds.parsec.app/package/parsec-linux.deb" -o "$deb_file"; then + log_error "Failed to download Parsec DEB package" + rm -rf "$temp_dir" + return 1 + fi + + # Install the DEB package + log_info "Installing Parsec DEB package..." + if ! sudo dpkg -i "$deb_file"; then + log_info "Fixing broken dependencies..." + sudo apt-get install -f -y + sudo dpkg -i "$deb_file" + fi + + # Clean up + rm -rf "$temp_dir" + + return 0 +} + +# Function to install Parsec via AppImage +install_parsec_appimage() { + log_info "Installing Parsec via AppImage..." + + local app_dir="$HOME/.local/share/parsec" + local app_file="$app_dir/Parsec.AppImage" + + # Create application directory + mkdir -p "$app_dir" + + # Download the AppImage + log_info "Downloading Parsec AppImage..." + if ! curl -L "https://builds.parsec.app/package/parsec-linux.AppImage" -o "$app_file"; then + log_error "Failed to download Parsec AppImage" + return 1 + fi + + # Make it executable + chmod +x "$app_file" + + # Create a wrapper script in PATH + local bin_dir="$HOME/.local/bin" + mkdir -p "$bin_dir" + + cat > "$bin_dir/parsec" << 'EOF' +#!/usr/bin/env bash +exec "$HOME/.local/share/parsec/Parsec.AppImage" "$@" +EOF + + chmod +x "$bin_dir/parsec" + + # Add to PATH if not already there + if [[ ":$PATH:" != *":$bin_dir:"* ]]; then + echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc" + echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.profile" + fi + + return 0 +} + +# Function to install Parsec via AUR (Arch Linux) +install_parsec_aur() { + log_info "Installing Parsec via AUR..." + + # Check if an AUR helper is available + if command -v yay &> /dev/null; then + yay -S --noconfirm parsec-bin + elif command -v paru &> /dev/null; then + paru -S --noconfirm parsec-bin + else + log_warn "No AUR helper found. Falling back to AppImage installation..." + install_parsec_appimage + fi +} + +# Main installation logic +main() { + local distro=$(detect_distro) + log_info "Detected distribution: $distro" + + # Install system dependencies + install_dependencies "$distro" + + # Determine installation method + local method="$INSTALLATION_METHOD" + if [[ "$method" == "auto" ]]; then + case $distro in + ubuntu|debian|kali) + method="deb" + ;; + arch|manjaro) + method="aur" + ;; + *) + method="appimage" + ;; + esac + fi + + log_info "Using installation method: $method" + + # Install Parsec + case $method in + deb) + install_parsec_deb + ;; + appimage) + install_parsec_appimage + ;; + aur) + install_parsec_aur + ;; + *) + log_error "Unknown installation method: $method" + exit 1 + ;; + esac + + # Verify installation + if command -v parsec &> /dev/null; then + log_info "✅ Parsec installed successfully!" + log_info "🎯 You can now use Parsec for low-latency remote desktop access" + log_info "🔧 To get started, run 'parsec' or look for Parsec in your applications menu" + + if [[ "$ENABLE_HARDWARE_ACCELERATION" == "true" ]]; then + log_info "🚀 Hardware acceleration is enabled for optimal performance" + fi + else + log_error "❌ Parsec installation verification failed" + exit 1 + fi +} + +# Run main function +main "$@"