2023-11-28 11:46:47 +00:00
# Soulseek daemon (p2p file sharing with an emphasis on Music)
# docs: <https://github.com/slskd/slskd/blob/master/docs/config.md>
#
# config precedence (higher precedence overrules lower precedence):
# - Default Values < Environment Variables < YAML Configuraiton File < Command Line Arguments
2024-03-26 11:04:21 +00:00
#
# debugging:
# - soulseek is just *flaky*. if you see e.g. DNS errors, even though you can't replicate them via `dig` or `getent ahostsv4`, just give it 10 minutes to work out:
# - "Soulseek.AddressException: Failed to resolve address 'vps.slsknet.org': Resource temporarily unavailable"
2023-11-28 11:46:47 +00:00
{ config , lib , . . . }:
{
sane . persist . sys . byStore . plaintext = [
2024-03-26 10:14:51 +00:00
{ user = " s l s k d " ; group = " m e d i a " ; path = " / v a r / l i b / s l s k d " ; method = " b i n d " ; }
2023-11-28 11:46:47 +00:00
] ;
sops . secrets . " s l s k d _ e n v " = {
owner = config . users . users . slskd . name ;
mode = " 0 4 0 0 " ;
} ;
users . users . slskd . extraGroups = [ " m e d i a " ] ;
2024-03-26 10:14:51 +00:00
sane . ports . ports . " 5 0 3 0 0 " = {
2023-11-28 11:46:47 +00:00
protocol = [ " t c p " ] ;
# not visible to WAN: i run this in a separate netns
visibleTo . ovpn = true ;
description = " c o l i n - s o u l s e e k " ;
} ;
sane . dns . zones . " u n i n s a n e . o r g " . inet . CNAME . " s o u l s e e k " = " n a t i v e " ;
2023-11-28 13:57:52 +00:00
services . nginx . virtualHosts . " s o u l s e e k . u n i n s a n e . o r g " = {
2023-11-28 11:46:47 +00:00
forceSSL = true ;
enableACME = true ;
locations . " / " = {
2024-03-26 10:14:51 +00:00
proxyPass = " h t t p : / / 1 0 . 0 . 1 . 6 : 5 0 3 0 " ;
2023-11-28 11:46:47 +00:00
proxyWebsockets = true ;
} ;
} ;
services . slskd . enable = true ;
2024-03-26 10:14:51 +00:00
services . slskd . domain = null ; # i'll manage nginx for it
services . slskd . group = " m e d i a " ;
2023-11-28 11:46:47 +00:00
# env file, for auth (SLSKD_SLSK_PASSWORD, SLSKD_SLSK_USERNAME)
services . slskd . environmentFile = config . sops . secrets . slskd_env . path ;
services . slskd . settings = {
soulseek . diagnostic_level = " D e b u g " ; # one of "None"|"Warning"|"Info"|"Debug"
shares . directories = [
# folders to share
# syntax: <https://github.com/slskd/slskd/blob/master/docs/config.md#directories>
# [Alias]/path/on/disk
# NOTE: Music library is quick to scan; videos take a solid 10min to scan.
# TODO: re-enable the other libraries
2024-03-05 18:44:30 +00:00
# "[Audioooks]/var/media/Books/Audiobooks"
# "[Books]/var/media/Books/Books"
# "[Manga]/var/media/Books/Visual"
# "[games]/var/media/games"
" [ M u s i c ] / v a r / m e d i a / M u s i c "
# "[Film]/var/media/Videos/Film"
# "[Shows]/var/media/Videos/Shows"
2023-11-28 11:46:47 +00:00
] ;
# directories.downloads = "..." # TODO
# directories.incomplete = "..." # TODO
# what unit is this? kbps??
global . upload . speed_limit = 32000 ;
web . logging = true ;
2023-12-18 18:09:58 +00:00
# debug = true;
2023-11-28 11:46:47 +00:00
flags . no_logo = true ; # don't show logo at start
# flags.volatile = true; # store searches and active transfers in RAM (completed transfers still go to disk). rec for btrfs/zfs
} ;
systemd . services . slskd = {
serviceConfig = {
# run this behind the OVPN static VPN
NetworkNamespacePath = " / r u n / n e t n s / o v p n s " ;
2023-12-23 10:23:17 +00:00
Restart = lib . mkForce " a l w a y s " ; # exits "success" when it fails to connect to soulseek server
2023-12-23 05:39:22 +00:00
RestartSec = " 6 0 s " ;
2023-11-28 11:46:47 +00:00
} ;
} ;
}