summaryrefslogtreecommitdiff
path: root/nixos/hosts/bin
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/hosts/bin')
-rw-r--r--nixos/hosts/bin/components/music.nix33
1 files changed, 31 insertions, 2 deletions
diff --git a/nixos/hosts/bin/components/music.nix b/nixos/hosts/bin/components/music.nix
index 69ca60b..db35a08 100644
--- a/nixos/hosts/bin/components/music.nix
+++ b/nixos/hosts/bin/components/music.nix
@@ -1,12 +1,41 @@
+{ config, pkgs, ... }:
+
{
networking.firewall.allowedTCPPorts = [ 4533 ];
-
+
services.navidrome = {
enable = true;
settings = {
- Address = "0.0.0.0";
+ Address = "5.231.118.254";
Port = 4533;
MusicFolder = "/var/lib/navidrome/music";
};
};
+
+ environment.systemPackages = [
+ pkgs.ffmpeg
+ (pkgs.writeShellScriptBin "music" ''
+ [[ $# -lt 2 ]] && { echo "usage: music [song|playlist] url"; exit 1; }
+ cd /var/lib/navidrome/music || exit 1
+ args=(-x --audio-format mp3 --embed-metadata --embed-thumbnail -o '%(title)s.%(ext)s')
+ [[ $1 == "song" ]] && args+=(--no-playlist)
+ exec ${pkgs.yt-dlp}/bin/yt-dlp "''${args[@]}" "$2"
+ '')
+ ];
+
+ systemd.services.edeltalk = {
+ script = ''
+ cd /var/lib/navidrome/music || exit 1
+ yt-dlp -x --audio-format mp3 --embed-metadata --embed-thumbnail \
+ --playlist-items 1 \
+ -o "%(title)s.%(ext)s" \
+ "https://music.youtube.com/playlist?list=PL_PrOB576HxI0mXdEVlBRpB2zerTAGCss"
+ '';
+ path = [ pkgs.yt-dlp pkgs.ffmpeg ];
+ serviceConfig = {
+ Type = "oneshot";
+ User = "navidrome";
+ };
+ startAt = "*:0/3";
+ };
}