Add example NixOS configuration for lidarr-mb-gap

- Introduced a new configuration file `EXAMPLE_CONFIG.nix` with three examples for setting up the lidarr-mb-gap service on NixOS.
- Included detailed instructions for using flake inputs, direct source paths, and a minimal configuration without VPS sync.
- Provided setup steps for creating environment files, setting permissions, and testing the service after configuration.
This commit is contained in:
Danilo Reyes
2025-11-11 11:34:49 -06:00
parent a3b7bfa0df
commit 35e6c7e330

145
nixos/EXAMPLE_CONFIG.nix Normal file
View File

@@ -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
#
# ============================================================================