diff --git a/nixos/EXAMPLE_CONFIG.nix b/nixos/EXAMPLE_CONFIG.nix new file mode 100644 index 0000000..c1b1f0a --- /dev/null +++ b/nixos/EXAMPLE_CONFIG.nix @@ -0,0 +1,145 @@ +# ============================================================================ +# Example NixOS Configuration for lidarr-mb-gap +# ============================================================================ +# +# Choose one of the examples below based on your setup: +# - Example 1: Using flake input (recommended) +# - Example 2: Using source path directly +# - Example 3: Minimal configuration +# +# ============================================================================ + +# ============================================================================ +# EXAMPLE 1: Using Flake Input (Recommended) +# ============================================================================ +# +# First, add to your flake.nix inputs: +# inputs.lidarr-mb-gap.url = "path:/path/to/lidarr-musicbrainz"; +# # or +# inputs.lidarr-mb-gap.url = "github:yourusername/lidarr-musicbrainz"; +# +# Then in your NixOS configuration: + +{ config, pkgs, inputs, ... }: + +{ + imports = [ + inputs.lidarr-mb-gap.nixosModules.lidarr-mb-gap + ]; + + services.lidarr-mb-gap = { + enable = true; + + # Reference the package from the flake + package = inputs.lidarr-mb-gap.packages.${pkgs.system}.lidarr-mb-gap; + + # Report settings + reportDir = "/var/lib/lidarr-mb-gap/reports"; + envFile = "/var/lib/lidarr-mb-gap/.env"; + runInterval = "daily"; # Options: "daily", "hourly", "*-*-* 02:00:00" + + # Optional: Auto-sync to VPS + syncToVPS = true; + vpsHost = "user@vps"; # Your SSH host alias or "user@vps.example.com" + vpsPath = "/var/www/html"; + + # SSH configuration for VPS sync + sshKeyFile = "/var/lib/lidarr-mb-gap/.ssh/id_ed25519"; + sshKnownHosts = { + vps = { + hostNames = [ "vps" "vps.example.com" "1.2.3.4" ]; # All possible hostnames/IPs + # Get this with: ssh-keyscan -t ed25519 vps.example.com + publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..."; + }; + }; + }; +} + +# ============================================================================ +# EXAMPLE 2: Using Source Path (Non-Flake) +# ============================================================================ +# +# If you're not using flakes, import the module directly: + +{ config, pkgs, ... }: + +{ + imports = [ + /path/to/lidarr-musicbrainz/nixos/lidarr-mb-gap.nix + ]; + + services.lidarr-mb-gap = { + enable = true; + + # Build from source + src = /path/to/lidarr-musicbrainz/src; + + # Report settings + reportDir = "/var/lib/lidarr-mb-gap/reports"; + envFile = "/var/lib/lidarr-mb-gap/.env"; + runInterval = "daily"; + + # Optional: Auto-sync to VPS + syncToVPS = true; + vpsHost = "user@vps"; + vpsPath = "/var/www/html"; + sshKeyFile = "/var/lib/lidarr-mb-gap/.ssh/id_ed25519"; + sshKnownHosts = { + vps = { + hostNames = [ "vps" "vps.example.com" ]; + publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..."; + }; + }; + }; +} + +# ============================================================================ +# EXAMPLE 3: Minimal Configuration (No VPS Sync) +# ============================================================================ + +{ config, pkgs, inputs, ... }: + +{ + imports = [ + inputs.lidarr-mb-gap.nixosModules.lidarr-mb-gap + ]; + + services.lidarr-mb-gap = { + enable = true; + package = inputs.lidarr-mb-gap.packages.${pkgs.system}.lidarr-mb-gap; + # All other options use defaults + }; +} + +# ============================================================================ +# SETUP STEPS AFTER ADDING CONFIGURATION +# ============================================================================ +# +# 1. Create the .env file: +# sudo mkdir -p /var/lib/lidarr-mb-gap +# sudo nano /var/lib/lidarr-mb-gap/.env +# +# Add: +# LIDARR_URL=http://your-lidarr-instance:8686 +# LIDARR_API_KEY=your-api-key-here +# SAMBL_URL=https://sambl.lioncat6.com +# MAX_ARTISTS=0 +# +# 2. Set permissions: +# sudo chown -R lidarr-mb-gap:lidarr-mb-gap /var/lib/lidarr-mb-gap +# sudo chmod 600 /var/lib/lidarr-mb-gap/.env +# +# 3. If using VPS sync, set up SSH keys: +# sudo -u lidarr-mb-gap ssh-keygen -t ed25519 -f /var/lib/lidarr-mb-gap/.ssh/id_ed25519 -N "" +# sudo -u lidarr-mb-gap cat /var/lib/lidarr-mb-gap/.ssh/id_ed25519.pub | ssh user@vps "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys" +# ssh-keyscan -t ed25519 vps.example.com # Use output in sshKnownHosts +# +# 4. Rebuild: +# sudo nixos-rebuild switch +# +# 5. Test: +# sudo systemctl start lidarr-mb-gap +# sudo journalctl -u lidarr-mb-gap -f +# +# ============================================================================ +