Refactor Nix package definition and enhance README for lidarr-mb-gap

- Updated `flake.nix` to import the new Nix package definition from `nix/package.nix`, streamlining the build process for the lidarr-mb-gap application.
- Enhanced the README.md to include new features such as NixOS module support for automated deployment, detailed deployment instructions, and configuration options for SSH and output directories.
- Added sections for troubleshooting output file issues and clarified the structure of the project, including new files for deployment and web serving.
This commit is contained in:
Danilo Reyes
2025-11-11 11:11:47 -06:00
parent e6f96107aa
commit a6d2e7f7df
5 changed files with 216 additions and 21 deletions

View File

@@ -13,6 +13,8 @@ A tool to identify missing albums on MusicBrainz from Deezer releases for artist
- 🎨 **Interactive HTML Report**: Filter by type (add/update) and by artist
- 🐍 **Python-based**: Clean, functional codebase with proper logging
- ❄️ **Nix Support**: Fully packaged with Nix flake for reproducible builds
- 🚀 **NixOS Module**: Automated deployment with systemd service and timer
- 🌐 **Web Serving**: Ready for deployment with Caddy or any web server
## Requirements
@@ -58,6 +60,7 @@ LIDARR_API_KEY=your-api-key-here
# Optional
SAMBL_URL=https://sambl.lioncat6.com
MAX_ARTISTS=5 # Limit number of artists processed (0 = no limit)
OUTPUT_DIR=. # Directory where output files will be written (default: current directory)
```
### Getting Your Lidarr API Key
@@ -82,7 +85,7 @@ The script will:
1. Fetch all artists from Lidarr with `monitorNewItems` set to "new" or "all"
2. For each artist, query SAMBL to find missing albums on MusicBrainz
3. Generate submission links (a-tisket and Harmony)
4. Create two output files:
4. Create two output files in the directory specified by `OUTPUT_DIR` (or current directory):
- `missing_albums.json` - Machine-readable JSON report
- `missing_albums.html` - Interactive HTML report with filters
@@ -110,7 +113,13 @@ Interactive HTML report with:
│ ├── main.py # Main application logic
│ ├── html_report.py # HTML report generation
│ └── pyproject.toml # Python package configuration
├── nix/
│ └── package.nix # Shared Nix package definition
├── nixos/
│ ├── lidarr-mb-gap.nix # NixOS module for automated deployment
│ └── DEPLOYMENT.md # Detailed deployment guide
├── flake.nix # Nix flake definition
├── Caddyfile # Caddy configuration for serving reports
├── .env # Environment variables (create this)
└── README.md
```
@@ -136,6 +145,40 @@ The application uses Python's logging module with systemd-friendly output:
Perfect for running as a systemd service.
## Deployment
### NixOS Automated Deployment
This project includes a NixOS module for automated deployment with:
- Systemd service for report generation
- Systemd timer for periodic execution (configurable)
- Optional automatic rsync sync to VPS
- SSH key management for secure VPS access
- Caddy configuration for serving the HTML report
See [nixos/DEPLOYMENT.md](nixos/DEPLOYMENT.md) for detailed deployment instructions.
### Quick Start with NixOS
```nix
# In your NixOS configuration
services.lidarr-mb-gap = {
enable = true;
package = lidarr-mb-gap.packages.${system}.lidarr-mb-gap; # From flake
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";
};
```
For complete setup instructions, including SSH key configuration and Caddy setup, see the [deployment guide](nixos/DEPLOYMENT.md).
## Example Output
```
@@ -166,6 +209,11 @@ Perfect for running as a systemd service.
- Make sure you're running from the project root
- If using Nix, ensure the flake is properly built
### Output files not appearing
- Check that `OUTPUT_DIR` environment variable points to a writable directory
- Ensure the directory exists and has proper permissions
- Check logs for any permission errors
## Contributing
1. Format code with `black src/`