Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
94 lines
2.5 KiB
Nix
94 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 = "wheel";
|
|
|
|
src = pythonPackages.fetchPypi {
|
|
inherit pname version format;
|
|
hash = "sha256-alctEgMZw79S2UStnt/bYTigE6h9wqCVpm7i1qc5efs=";
|
|
};
|
|
|
|
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 - install via pip if not available
|
|
]))
|
|
pkgs.python311Packages.pip
|
|
];
|
|
};
|
|
});
|
|
}
|