From 06dcf341605181c8b7889d3bf20d436e0495410d Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Thu, 7 Mar 2024 21:18:14 +0100 Subject: [PATCH] Add default.nix, allow for `nix run`. --- default.nix | 12 ++++++++++++ flake.nix | 1 + hb-downloader => hb-downloader.py | 0 requirements.txt | 1 + setup.py | 11 +++++++++++ 5 files changed, 25 insertions(+) create mode 100644 default.nix rename hb-downloader => hb-downloader.py (100%) create mode 100644 requirements.txt create mode 100644 setup.py diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..38a0925 --- /dev/null +++ b/default.nix @@ -0,0 +1,12 @@ +{ pkgs ? import {} }: + +with pkgs.python3Packages; +buildPythonPackage rec { + name = "hb-downloader"; + src = ./.; + propagatedBuildInputs = [ requests pkgs.aria2 ]; + meta.mainProgram = "hb-downloader"; + postInstall = '' + mv -v $out/bin/hb-downloader.py $out/bin/hb-downloader + ''; +} diff --git a/flake.nix b/flake.nix index d19f1fe..80b5453 100644 --- a/flake.nix +++ b/flake.nix @@ -11,5 +11,6 @@ in { devShells.x86_64-linux.default = ( import ./shell.nix { inherit pkgs; }); + packages.x86_64-linux.default = ( import ./default.nix { inherit pkgs; }); }; } diff --git a/hb-downloader b/hb-downloader.py similarity index 100% rename from hb-downloader rename to hb-downloader.py diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f229360 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +requests diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..52f3b22 --- /dev/null +++ b/setup.py @@ -0,0 +1,11 @@ +from setuptools import setup + +with open('requirements.txt') as f: + install_requires = f.read().splitlines() + +setup( + name = 'hb-downloader', + version = '0.1', + install_requires=install_requires, + scripts=['hb-downloader.py',], +)