diff options
| author | caley <195605706+cqley@users.noreply.github.com> | 2026-07-30 03:05:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-30 03:05:42 +0200 |
| commit | b70fd4e682c0a6ff019d20436605b655cabae0f8 (patch) | |
| tree | 607c8ea53fa9791da07dc16d65f36ef4bb6da440 /nixos/hosts/bin/components | |
| parent | 56d0768c371b2b2bd543670b26f9d987b59e50b6 (diff) | |
Update music.nix
Diffstat (limited to 'nixos/hosts/bin/components')
| -rw-r--r-- | nixos/hosts/bin/components/music.nix | 33 |
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"; + }; } |
