Add Navidrome and system services modules

Configure Navidrome settings (MusicFolder, Port 4533, Address 0.0.0.0),
open firewall and create tmpfiles entry for the music directory.

Enable system services: weekly fstrim, zram swap (zstd), Avahi mDNS,
psd,
fwupd, earlyoom and plocate
This commit is contained in:
Melvin Ragusa
2026-02-02 11:22:56 +01:00
parent 9b2e4c23d3
commit bc9ee212ac
7 changed files with 169 additions and 35 deletions

View File

@@ -17,6 +17,9 @@
./modules/theming.nix # Fonts, themes, cursors
./modules/virtualization.nix # QEMU, KVM, virt-manager
./modules/power.nix # Power management, CPU governors
./modules/shell.nix # Fish shell configuration
./modules/services.nix # System services (fstrim, zram, avahi, psd)
./modules/navidrome.nix # Music streaming server
];
# ═══════════════════════════════════════════════════════════════
@@ -102,13 +105,13 @@
# - gamemode (gaming.nix)
# - corectrl (gpu-amd.nix)
];
shell = pkgs.zsh;
shell = pkgs.fish; # Fish shell (migrated from Arch)
};
# ═══════════════════════════════════════════════════════════════
# PROGRAMS
# ═══════════════════════════════════════════════════════════════
programs.zsh.enable = true;
programs.zsh.enable = true; # Keep zsh available as fallback
programs.yazi.enable = true;
programs.firefox.enable = true;
programs.niri.enable = true;

View File

@@ -16,6 +16,10 @@
# Music
# ─────────────────────────────────────────────────────────────
amberol # Simple music player for local files
feishin # Navidrome/Jellyfin client
picard # MusicBrainz Picard - music tagger
beets # Music library manager
cava # Audio visualizer
# Feishin available via Flatpak for Navidrome/Jellyfin
# ─────────────────────────────────────────────────────────────
@@ -23,6 +27,8 @@
# ─────────────────────────────────────────────────────────────
vesktop # Discord client (Wayland-native, with Vencord)
thunderbird # Email client
signal-desktop # Encrypted messaging
telegram-desktop # Telegram client
# ─────────────────────────────────────────────────────────────
# Office & Productivity
@@ -69,6 +75,9 @@
gnome-calculator # Calculator
gnome-clocks # World clocks, alarms, timers
baobab # Disk usage analyzer
localsend # AirDrop-like file sharing (cross-platform)
meld # Visual diff and merge tool
rclone # Cloud storage sync (Google Drive, Dropbox, etc.)
];
# GNOME Keyring for secrets storage

View File

@@ -94,6 +94,14 @@
wtype # Wayland keyboard automation
wlr-randr # Display configuration
wayland-utils # Debug utilities
# ─────────────────────────────────────────────────────────────
# Additional desktop utilities (migrated from Arch)
# ─────────────────────────────────────────────────────────────
cliphist # Clipboard history for Wayland
wlsunset # Blue light filter / night mode
brightnessctl # Brightness control (even for desktop monitors via DDC)
wlogout # Logout menu / session manager
];
# Environment variables for Wayland compatibility

View File

@@ -75,37 +75,22 @@
httpie # Better curl
curlie # Curl wrapper with httpie-like syntax
# Additional CLI tools (migrated from Arch)
tealdeer # tldr - simplified man pages
duf # Better df (disk usage)
sd # Better sed (find & replace)
pv # Pipe viewer (progress bar for pipes)
parallel # GNU parallel (run commands in parallel)
inxi # System information tool
glances # System monitor (htop alternative)
grc # Generic colorizer for CLI output
# ─────────────────────────────────────────────────────────────
# Database Tools
# ─────────────────────────────────────────────────────────────
dbeaver-bin # Universal database tool (GUI)
];
# Better shell experience for development
programs.zsh = {
# Already enabled in base config
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
ll = "eza -la --icons --git";
ls = "eza --icons";
cat = "bat";
find = "fd";
grep = "rg";
# Docker shortcuts
dc = "docker-compose";
dps = "docker ps";
# Git shortcuts
gs = "git status";
gd = "git diff";
gl = "git log --oneline -20";
# NixOS shortcuts
rebuild = "sudo nixos-rebuild switch --flake .";
update = "nix flake update";
};
};
# Note: Shell aliases are now managed in shell.nix (Fish shell)
# Zsh is kept as a fallback shell but Fish is the primary
}

54
modules/navidrome.nix Normal file
View File

@@ -0,0 +1,54 @@
# modules/navidrome.nix
# Self-hosted music streaming server
{ config, pkgs, lib, ... }:
{
# ═══════════════════════════════════════════════════════════════
# NAVIDROME MUSIC SERVER
# ═══════════════════════════════════════════════════════════════
services.navidrome = {
enable = true;
settings = {
# Music library location
MusicFolder = "/home/pinj/Music";
# Server settings
Address = "0.0.0.0";
Port = 4533;
# UI settings
UIWelcomeMessage = "Welcome to Navidrome!";
# Enable transcoding (requires ffmpeg)
EnableTranscodingConfig = true;
# Scan settings
ScanSchedule = "@every 1h"; # Rescan library every hour
# Last.fm scrobbling (configure in UI after setup)
LastFM.Enabled = true;
# Enable sharing features
EnableSharing = true;
# Enable covers from external sources
CoverArtPriority = "cover.*, folder.*, front.*, embedded, external";
# Session timeout (24 hours)
SessionTimeout = "24h";
# Enable Prometheus metrics (optional)
# Prometheus.Enabled = true;
};
};
# Open firewall for Navidrome
# Remove or comment out if you only access locally
networking.firewall.allowedTCPPorts = [ 4533 ];
# Ensure music directory exists and has correct permissions
systemd.tmpfiles.rules = [
"d /home/pinj/Music 0755 pinj users -"
];
}

81
modules/services.nix Normal file
View File

@@ -0,0 +1,81 @@
# modules/services.nix
# System services: SSD maintenance, swap, mDNS, profile sync
{ config, pkgs, lib, ... }:
{
# ═══════════════════════════════════════════════════════════════
# SSD MAINTENANCE
# ═══════════════════════════════════════════════════════════════
# Weekly TRIM for SSDs (improves longevity and performance)
services.fstrim = {
enable = true;
interval = "weekly";
};
# ═══════════════════════════════════════════════════════════════
# ZRAM SWAP
# ═══════════════════════════════════════════════════════════════
# Compressed swap in RAM - better than no swap, faster than disk
zramSwap = {
enable = true;
algorithm = "zstd"; # Best compression ratio
memoryPercent = 50; # Use up to 50% of RAM for compressed swap
};
# ═══════════════════════════════════════════════════════════════
# MDNS / AVAHI
# ═══════════════════════════════════════════════════════════════
# mDNS for local network discovery (.local domains)
services.avahi = {
enable = true;
nssmdns4 = true; # Enable .local resolution
openFirewall = true; # Allow mDNS through firewall
publish = {
enable = true;
addresses = true;
workstation = true;
};
};
# ═══════════════════════════════════════════════════════════════
# PROFILE SYNC DAEMON
# ═══════════════════════════════════════════════════════════════
# Sync browser profiles to RAM for faster performance
# Works with Firefox/Zen Browser profiles
services.psd = {
enable = true;
};
# User needs to configure ~/.config/psd/psd.conf after first run
# Default will auto-detect Firefox profiles
# ═══════════════════════════════════════════════════════════════
# ADDITIONAL SYSTEM OPTIMIZATIONS
# ═══════════════════════════════════════════════════════════════
# Enable firmware updates
services.fwupd.enable = true;
# Thermald for Intel CPUs (AMD uses different thermal management)
# Uncomment if on Intel:
# services.thermald.enable = true;
# Early OOM killer - prevents system freeze on memory exhaustion
services.earlyoom = {
enable = true;
freeMemThreshold = 5; # Start killing at 5% free memory
freeSwapThreshold = 10; # Also consider swap
enableNotifications = true;
};
# ═══════════════════════════════════════════════════════════════
# LOCATE DATABASE
# ═══════════════════════════════════════════════════════════════
# Fast file search with plocate
services.locate = {
enable = true;
package = pkgs.plocate;
interval = "daily";
};
}

View File

@@ -13,12 +13,6 @@
qemu = {
package = pkgs.qemu_kvm;
# Enable UEFI support for VMs
ovmf = {
enable = true;
packages = [ pkgs.OVMFFull.fd ];
};
# Enable TPM emulation for Windows 11
swtpm.enable = true;