From 677838392fb8309c75a6dbeb03599c179e70a14c Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 21 Jan 2024 17:46:28 -0500 Subject: [PATCH] working flake build --- flake.lock | 27 +++++++++++++++++++++ flake.nix | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 3 +++ setup.py | 9 +++++++ 4 files changed, 100 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 requirements.txt create mode 100644 setup.py diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c4ba385 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1705677747, + "narHash": "sha256-eyM3okYtMgYDgmYukoUzrmuoY4xl4FUujnsv/P6I/zI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bbe7d8f876fbbe7c959c90ba2ae2852220573261", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6f3863f --- /dev/null +++ b/flake.nix @@ -0,0 +1,61 @@ +{ + description = "DLSite download organizer"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs }: let + pkgs = import nixpkgs { + system = "x86_64-linux"; + }; + in { + packages.x86_64-linux = with pkgs.python3Packages; rec { + lxml5 = buildPythonPackage rec { + pname = "lxml"; + version = "5.0.1"; + format = "setuptools"; + src = pkgs.fetchFromGitHub { + owner = pname; + repo = pname; + rev = "refs/tags/lxml-${version}"; + hash = "sha256-RAh93UJiBcRxXSARJvD3o91i+MdelwlaCEK2aVu0joc="; + }; + nativeBuildInputs = with pkgs; [ libxml2.dev libxslt.dev cython_3 ]; + buildInputs = with pkgs; [ libxml2 libxslt zlib ]; + + # tests are meant to be ran "in-place" in the same directory as src + doCheck = false; + + pythonImportsCheck = [ "lxml" "lxml.etree" ]; + }; + + dlsite-async = buildPythonPackage rec { + pname = "dlsite_async"; + version = "0.3.0"; + src = fetchPypi { + inherit pname version; + sha256 = "sha256-cUhH7eNIoQUKt0nUl+wSGFGbZpKmtwPWyVR2PTJI1co="; + }; + pyproject = true; + nativeBuildInputs = [ pkgs.pdm ]; + propagatedBuildInputs = [ + lxml5 + aiohttp + beautifulsoup4 + pdm-backend + ]; + }; + + dlibrary = buildPythonApplication { + pname = "dlibrary"; + version = "0.1"; + propagatedBuildInputs = [ + pymupdf + requests + dlsite-async + ]; + src = ./.; + }; + }; + defaultPackage.x86_64-linux = self.packages.x86_64-linux.dlibrary; + }; +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..534d29c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +requests +PyMuPDF +dlsite-async diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..05267ef --- /dev/null +++ b/setup.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +from setuptools import setup, find_packages + +setup(name='dlibrary', + version='0.1', + packages=find_packages(), + scripts=["dlibrary.py"], + )