diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..368c372 --- /dev/null +++ b/default.nix @@ -0,0 +1,43 @@ +{ + lib, + python3, + audiobook-dl-src, +}: + +python3.pkgs.buildPythonApplication rec { + pname = "audiobook-dl"; + version = "unstable-2024-10-24"; + pyproject = true; + + src = audiobook-dl-src; + + build-system = [ + python3.pkgs.setuptools + python3.pkgs.setuptools-scm + ]; + + dependencies = with python3.pkgs; [ + appdirs + attrs + cssselect + importlib-resources + lxml + m3u8 + mutagen + pillow + pycountry + pycryptodome + requests + rich + tomli + urllib3 + ]; + + meta = { + description = "Audiobook CLI downloader"; + homepage = "https://github.com/jo1gi/audiobook-dl"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ ]; + mainProgram = "audiobook-dl"; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ed36ced --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1729665710, + "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1bf708c --- /dev/null +++ b/flake.nix @@ -0,0 +1,59 @@ +{ + description = "audiobook-dl flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages.audiobook-dl = pkgs.callPackage ./default.nix { audiobook-dl-src = ./.; }; + packages.default = self.packages.${system}.audiobook-dl; + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + ffmpeg + (python312.withPackages ( + ps: with ps; [ + mutagen + requests + rich + lxml + cssselect + pillow + m3u8 + pycryptodome + importlib-resources + appdirs + tomli + attrs + pycountry + urllib3 + + # Test + pytest + mypy + types-requests + types-setuptools + + # Build + build + setuptools + twine + ] + )) + ]; + }; + } + ); +}