102 lines
2.5 KiB
Nix
102 lines
2.5 KiB
Nix
{
|
|
description = "ZUGFeRD REST API Service";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
pythonPackages = pkgs.python311Packages;
|
|
|
|
# factur-x package - not available in nixpkgs, so we package it inline
|
|
factur-x = pythonPackages.buildPythonPackage rec {
|
|
pname = "factur_x";
|
|
version = "3.8";
|
|
format = "pyproject";
|
|
|
|
src = pythonPackages.fetchPypi {
|
|
inherit pname version;
|
|
hash = "sha256-/pNY5w09pxcGAFFh3USTkLlkGr+JOTUqhglYzNMByks=";
|
|
};
|
|
|
|
nativeBuildInputs = with pythonPackages; [
|
|
hatchling
|
|
hatch-requirements-txt
|
|
];
|
|
|
|
dependencies = with pythonPackages; [pypdf lxml];
|
|
|
|
pythonRelaxDeps = true;
|
|
|
|
meta = {
|
|
description = "Python library to generate and read Factur-X invoices";
|
|
license = pkgs.lib.licenses.mit;
|
|
};
|
|
};
|
|
|
|
zugferd-service = pythonPackages.buildPythonApplication {
|
|
pname = "zugferd-service";
|
|
version = "1.0.0";
|
|
pyproject = true;
|
|
src = ./.;
|
|
|
|
pythonRelaxDeps = true;
|
|
|
|
build-system = [pythonPackages.hatchling];
|
|
|
|
dependencies = with pythonPackages; [
|
|
fastapi
|
|
uvicorn
|
|
pydantic
|
|
python-multipart
|
|
factur-x
|
|
pypdf
|
|
lxml
|
|
];
|
|
|
|
nativeCheckInputs = with pythonPackages; [
|
|
pytestCheckHook
|
|
pytest-asyncio
|
|
httpx
|
|
];
|
|
|
|
passthru = {mainProgram = "zugferd-service";};
|
|
|
|
meta = {
|
|
description = "REST API for ZUGFeRD invoice extraction";
|
|
license = pkgs.lib.licenses.mit;
|
|
};
|
|
};
|
|
in {
|
|
packages.default = zugferd-service;
|
|
packages.zugferd-service = zugferd-service;
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
packages = [
|
|
(pkgs.python311.withPackages (ps:
|
|
with ps; [
|
|
fastapi
|
|
uvicorn
|
|
pydantic
|
|
python-multipart
|
|
pypdf
|
|
lxml
|
|
pytest
|
|
pytest-asyncio
|
|
httpx
|
|
factur-x
|
|
# factur-x - install via pip if not available
|
|
]))
|
|
pkgs.python311Packages.pip
|
|
];
|
|
};
|
|
});
|
|
}
|