hosts/ni/setups/music: init module

This commit is contained in:
Gabriel Arazas 2023-12-13 10:42:43 +08:00
parent 8e42fa92d0
commit c6cd57d5bc
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
4 changed files with 32 additions and 19 deletions

View File

@ -30,6 +30,7 @@
networking.enable = true;
networking.setup = "networkmanager";
networking.wireguard.enable = true;
setups.music.enable = true;
};
disko.devices = import ./disko.nix {
@ -47,24 +48,6 @@
"time.facebook.com"
];
# My portable music streaming server.
services.gonic = {
enable = true;
settings = {
listen-addr = "127.0.0.1:4747";
cache-path = "/var/cache/gonic";
music-path = [
"/srv/music"
];
podcast-path = "/var/cache/gonic/podcasts";
jukebox-enabled = true;
scan-interval = 1;
scan-at-start-enabled = true;
};
};
sops.secrets = lib.getSecrets ./secrets/secrets.yaml {
"ssh-key" = { };
};

View File

@ -4,5 +4,6 @@
./hardware/qol.nix
./networking/setup.nix
./networking/wireguard.nix
./setups/music.nix
];
}

View File

@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
let
hostCfg = config.hosts.ni;
cfg = hostCfg.setups.music;
in
{
options.hosts.ni.setups.music.enable = lib.mkEnableOption "music streaming and organizing setup";
config = lib.mkIf cfg.enable {
# My portable music streaming server.
services.gonic = {
enable = true;
settings = {
listen-addr = "localhost:4747";
cache-path = "/var/cache/gonic";
music-path = [
"/srv/music"
];
podcast-path = "/var/cache/gonic/podcasts";
jukebox-enabled = true;
scan-interval = 1;
scan-at-start-enabled = true;
};
};
};
}

View File

@ -5,7 +5,7 @@ let
cfg = userCfg.music;
ytdlpAudio = pkgs.writeScriptBin "yt-dlp-audio" ''
${pkgs.yt-dlp}/bin/yt-dlp --config-location "${../config/yt-dlp-audio.conf}" $@
${pkgs.yt-dlp}/bin/yt-dlp --config-location "${../../config/yt-dlp-audio.conf}" $@
'';
musicDir = config.xdg.userDirs.music;