diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix index 953ab94..822c50a 100644 --- a/hosts/desktop/default.nix +++ b/hosts/desktop/default.nix @@ -137,6 +137,7 @@ obs-studio discord vesktop + (callPackage ../../pkgs/tiddl.nix { }) ]; nix.settings.experimental-features = [ "nix-command" "flakes" ]; diff --git a/pkgs/tiddl.nix b/pkgs/tiddl.nix new file mode 100644 index 0000000..8f80f42 --- /dev/null +++ b/pkgs/tiddl.nix @@ -0,0 +1,50 @@ +# ABOUTME: tiddl, a CLI downloader for Tidal up to HiRes FLAC (24-bit/192 kHz). +# ABOUTME: Not in nixpkgs; pinned to the branch of upstream PR #427. + +{ lib +, python3Packages +, fetchFromGitHub +, ffmpeg +}: + +python3Packages.buildPythonApplication { + pname = "tiddl"; + version = "3.4.4-unstable-pr427"; + pyproject = true; + + # Release 3.4.4 asks Tidal for playback with a single client profile, which + # hands back the Dolby Atmos stream for any track that has one, and the + # default Atmos filter then skips it: whole albums download nothing, and MAX + # never arrives. PR #427 (oskvr37/tiddl) requests stereo through a Hi-Res + # profile instead, from the same login. Back to a release tag once it is + # merged. + src = fetchFromGitHub { + owner = "ssupt"; + repo = "tiddl"; + rev = "a7739f736b9b46f06e33e7b8a4eb350ec840050a"; # feat/single-auth-capability-sessions + hash = "sha256-1wUxVaDv6PH2IZ3W6aezjswI1CosTqmx2xmiUdPKKP0="; + }; + + build-system = with python3Packages; [ setuptools wheel ]; + + dependencies = with python3Packages; [ + aiofiles + aiohttp + m3u8 + mutagen + pydantic + requests + requests-cache + typer + ]; + + # HiRes arrives as DASH segments; tiddl calls ffmpeg to extract the FLAC. + makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}" ]; + + meta = { + description = "Download Tidal tracks up to HiRes FLAC"; + homepage = "https://github.com/oskvr37/tiddl"; + license = lib.licenses.asl20; + mainProgram = "tiddl"; + }; +}