feat: add nextcloud-mcp-server with 20 inlined Python deps #1

Merged
luis merged 29 commits from :main into main 2026-05-28 08:55:26 +02:00
Showing only changes of commit d4c0be5034 - Show all commits

View File

@@ -6,19 +6,30 @@
}:
let
# ──────────────────────────────────────────────────────────────
# Inlined packages not yet in nixpkgs (20 total)
# Organized in dependency order: tiers 1 → 4
# ──────────────────────────────────────────────────────────────
# ── OpenTelemetry Python monorepo (api, sdk, proto, exporter-otlp-*) ──
otelPythonSrc = fetchFromGitHub {
owner = "open-telemetry";
repo = "opentelemetry-python";
rev = "v1.39.1";
hash = lib.fakeHash;
};
# ── Tier 1: leaf packages (no deps on other missing packages) ──
# ── OpenTelemetry Contrib monorepo (instrumentation-*, util-http) ──
otelContribSrc = fetchFromGitHub {
owner = "open-telemetry";
repo = "opentelemetry-python-contrib";
rev = "v0.60b1";
hash = lib.fakeHash;
};
# ── Tier 1: leaf packages ──
pythonvcard4 = python3Packages.buildPythonPackage rec {
pname = "pythonvcard4";
version = "0.2.0";
pyproject = true;
build-system = [ python3Packages.setuptools python3Packages.wheel ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = fetchPypi { inherit pname version; hash = "sha256-I2u6J2nkWWRc+ndkB/8HhWrO1FtDcRa/QN2zm7zv220="; };
doCheck = false;
meta = with lib; { description = "vCard parsing library"; homepage = "https://github.com/GNOME/python-vcard4"; license = licenses.gpl3Plus; };
};
@@ -28,7 +39,7 @@ let
version = "0.25.0";
pyproject = true;
build-system = [ python3Packages.setuptools python3Packages.wheel ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = fetchPypi { inherit pname version; hash = "sha256-Xjc7dcMa+zyG8aUvoa1HDJqs4YCC057A0vkY0RzJuig="; };
doCheck = false;
meta = with lib; { description = "Prometheus monitoring system client"; homepage = "https://github.com/prometheus/client_python"; license = licenses.asl20; };
};
@@ -37,8 +48,13 @@ let
pname = "python-json-logger";
version = "4.1.0";
pyproject = true;
build-system = [ python3Packages.setuptools python3Packages.wheel ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
build-system = [ python3Packages.hatchling ];
src = fetchFromGitHub {
owner = "nhairs";
repo = "python-json-logger";
rev = "v${version}";
hash = lib.fakeHash;
};
doCheck = false;
meta = with lib; { description = "JSON formatter for python logging"; homepage = "https://github.com/nhairs/python-json-logger"; license = licenses.bsd2; };
};
@@ -48,7 +64,7 @@ let
version = "8.7.1";
pyproject = true;
build-system = [ python3Packages.setuptools python3Packages.wheel ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = fetchPypi { inherit pname version; hash = "sha256-Sf7xrmRAwYIFL0B8jTSmj3Lvw225ypDcARM5jy/d6Ls="; };
propagatedBuildInputs = with python3Packages; [ zipp ];
doCheck = false;
meta = with lib; { description = "Read metadata from Python packages"; homepage = "https://github.com/python/importlib_metadata"; license = licenses.asl20; };
@@ -59,7 +75,12 @@ let
version = "1.75.0";
pyproject = true;
build-system = [ python3Packages.setuptools python3Packages.wheel ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = fetchFromGitHub {
owner = "googleapis";
repo = "python-api-common-protos";
rev = "v${version}";
hash = lib.fakeHash;
};
propagatedBuildInputs = with python3Packages; [ protobuf ];
doCheck = false;
meta = with lib; { description = "Common protobufs used in Google APIs"; homepage = "https://github.com/googleapis/python-api-common-protos"; license = licenses.asl20; };
@@ -70,7 +91,8 @@ let
version = "1.39.1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelPythonSrc;
sourceRoot = "${src.name}/opentelemetry-api";
propagatedBuildInputs = with python3Packages; [ deprecated importlib-metadata ];
doCheck = false;
meta = with lib; { description = "OpenTelemetry Python API"; homepage = "https://github.com/open-telemetry/opentelemetry-python"; license = licenses.asl20; };
@@ -81,20 +103,27 @@ let
version = "1.39.1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelPythonSrc;
sourceRoot = "${src.name}/opentelemetry-proto";
propagatedBuildInputs = with python3Packages; [ protobuf ];
doCheck = false;
meta = with lib; { description = "OpenTelemetry Python Proto"; homepage = "https://github.com/open-telemetry/opentelemetry-python"; license = licenses.asl20; };
};
# ── Tier 2 (depend on Tier 1) ──
# ── Tier 2 ──
opentelemetry-semantic-conventions = python3Packages.buildPythonPackage rec {
pname = "opentelemetry-semantic-conventions";
version = "0.60b1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = fetchFromGitHub {
owner = "open-telemetry";
repo = "semantic-conventions";
rev = "v${version}";
hash = lib.fakeHash;
};
sourceRoot = "${src.name}/model";
propagatedBuildInputs = [ opentelemetry-api ] ++ (with python3Packages; [ deprecated ]);
doCheck = false;
meta = with lib; { description = "OpenTelemetry Semantic Conventions"; homepage = "https://github.com/open-telemetry/semantic-conventions"; license = licenses.asl20; };
@@ -105,7 +134,8 @@ let
version = "1.39.1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelPythonSrc;
sourceRoot = "${src.name}/opentelemetry-sdk";
propagatedBuildInputs = [ opentelemetry-api opentelemetry-semantic-conventions ] ++ (with python3Packages; [ typing-extensions ]);
doCheck = false;
meta = with lib; { description = "OpenTelemetry Python SDK"; homepage = "https://github.com/open-telemetry/opentelemetry-python"; license = licenses.asl20; };
@@ -116,7 +146,7 @@ let
version = "2.0.1";
pyproject = true;
build-system = [ python3Packages.setuptools python3Packages.wheel ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = fetchPypi { inherit pname version; hash = "sha256-kWbEDm/9TA7eurw1ThoeLP/Bu0c/iAB2lHk3V2hcyMM="; };
propagatedBuildInputs = with python3Packages; [ icalendar ];
doCheck = false;
meta = with lib; { description = "X-WR-TIMEZONE iCalendar property handling"; homepage = "https://github.com/niccokunzmann/x-wr-timezone"; license = licenses.lgpl3Plus; };
@@ -127,7 +157,8 @@ let
version = "0.60b1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelContribSrc;
sourceRoot = "${src.name}/util/opentelemetry-util-http";
doCheck = false;
meta = with lib; { description = "OpenTelemetry HTTP utilities"; homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib"; license = licenses.asl20; };
};
@@ -137,20 +168,22 @@ let
version = "1.39.1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelPythonSrc;
sourceRoot = "${src.name}/exporter/opentelemetry-exporter-otlp-proto-common";
propagatedBuildInputs = [ opentelemetry-proto ];
doCheck = false;
meta = with lib; { description = "OpenTelemetry OTLP exporter proto common"; homepage = "https://github.com/open-telemetry/opentelemetry-python"; license = licenses.asl20; };
};
# ── Tier 3 (depend on Tier 1+2) ──
# ── Tier 3 ──
opentelemetry-instrumentation = python3Packages.buildPythonPackage rec {
pname = "opentelemetry-instrumentation";
version = "0.60b1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelContribSrc;
sourceRoot = "${src.name}/opentelemetry-instrumentation";
propagatedBuildInputs = [ opentelemetry-api opentelemetry-semantic-conventions ] ++ (with python3Packages; [ wrapt packaging ]);
doCheck = false;
meta = with lib; { description = "OpenTelemetry instrumentation base"; homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib"; license = licenses.asl20; };
@@ -161,7 +194,12 @@ let
version = "3.8.2";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = fetchFromGitHub {
owner = "niccokunzmann";
repo = "python-recurring-ical-events";
rev = "v${version}";
hash = lib.fakeHash;
};
propagatedBuildInputs = [ x-wr-timezone ] ++ (with python3Packages; [ icalendar python-dateutil ]);
doCheck = false;
meta = with lib; { description = "Recurring iCalendar event expander"; homepage = "https://github.com/niccokunzmann/python-recurring-ical-events"; license = licenses.lgpl3Plus; };
@@ -172,7 +210,8 @@ let
version = "1.39.1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelPythonSrc;
sourceRoot = "${src.name}/exporter/opentelemetry-exporter-otlp-proto-grpc";
propagatedBuildInputs = [ opentelemetry-api opentelemetry-sdk opentelemetry-proto opentelemetry-exporter-otlp-proto-common googleapis-common-protos ] ++ (with python3Packages; [ grpcio deprecated ]);
doCheck = false;
meta = with lib; { description = "OpenTelemetry OTLP gRPC exporter"; homepage = "https://github.com/open-telemetry/opentelemetry-python"; license = licenses.asl20; };
@@ -183,20 +222,26 @@ let
version = "1.18.0";
pyproject = true;
build-system = [ python3Packages.poetry-core ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = fetchFromGitHub {
owner = "qdrant";
repo = "qdrant-client";
rev = "v${version}";
hash = lib.fakeHash;
};
propagatedBuildInputs = with python3Packages; [ grpcio httpx numpy portalocker protobuf pydantic urllib3 ];
doCheck = false;
meta = with lib; { description = "Qdrant vector search engine client"; homepage = "https://github.com/qdrant/qdrant-client"; license = licenses.asl20; };
};
# ── Tier 4 (depend on Tier 1-3) ──
# ── Tier 4 ──
opentelemetry-instrumentation-asgi = python3Packages.buildPythonPackage rec {
pname = "opentelemetry-instrumentation-asgi";
version = "0.60b1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelContribSrc;
sourceRoot = "${src.name}/instrumentation/opentelemetry-instrumentation-asgi";
propagatedBuildInputs = [ opentelemetry-api opentelemetry-instrumentation opentelemetry-semantic-conventions opentelemetry-util-http ] ++ (with python3Packages; [ asgiref ]);
doCheck = false;
meta = with lib; { description = "OpenTelemetry ASGI instrumentation"; homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib"; license = licenses.asl20; };
@@ -207,7 +252,8 @@ let
version = "0.60b1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelContribSrc;
sourceRoot = "${src.name}/instrumentation/opentelemetry-instrumentation-httpx";
propagatedBuildInputs = [ opentelemetry-api opentelemetry-instrumentation opentelemetry-semantic-conventions opentelemetry-util-http ] ++ (with python3Packages; [ httpx wrapt ]);
doCheck = false;
meta = with lib; { description = "OpenTelemetry HTTPX instrumentation"; homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib"; license = licenses.asl20; };
@@ -218,7 +264,8 @@ let
version = "0.60b1";
pyproject = true;
build-system = [ python3Packages.hatchling ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = otelContribSrc;
sourceRoot = "${src.name}/instrumentation/opentelemetry-instrumentation-logging";
propagatedBuildInputs = [ opentelemetry-api opentelemetry-instrumentation ];
doCheck = false;
meta = with lib; { description = "OpenTelemetry logging instrumentation"; homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib"; license = licenses.asl20; };
@@ -229,7 +276,13 @@ let
version = "1.1.2";
pyproject = true;
build-system = [ python3Packages.poetry-core ];
src = fetchPypi { inherit pname version; hash = lib.fakeHash; };
src = fetchFromGitHub {
owner = "langchain-ai";
repo = "langchain";
rev = "langchain-text-splitters==${version}";
hash = lib.fakeHash;
};
sourceRoot = "${src.name}/libs/text-splitters";
propagatedBuildInputs = with python3Packages; [ langchain-core ];
doCheck = false;
meta = with lib; { description = "LangChain text splitting utilities"; homepage = "https://github.com/langchain-ai/langchain"; license = licenses.mit; };
@@ -250,15 +303,12 @@ python3Packages.buildPythonApplication rec {
build-system = [ python3Packages.hatchling ];
# All dependencies — both from nixpkgs and our inlined packages
dependencies = with python3Packages; [
# ── nixpkgs packages ──
mcp httpx pillow icalendar pydantic click caldav pyjwt
aiosqlite alembic authlib fastembed anthropic boto3 starlette
jinja2 markdownify pymupdf pymupdf4llm openai dynaconf
mistralai sqlalchemy
# ── Inlined packages ──
pythonvcard4 prometheus-client python-json-logger importlib-metadata
googleapis-common-protos opentelemetry-api opentelemetry-proto
opentelemetry-semantic-conventions opentelemetry-sdk
@@ -269,7 +319,6 @@ python3Packages.buildPythonApplication rec {
opentelemetry-instrumentation-logging langchain-text-splitters
];
# Relax strict version pins in pyproject.toml so inlined packages match
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail '"prometheus-client>=0.21.0"' '"prometheus-client"' \
@@ -288,18 +337,6 @@ python3Packages.buildPythonApplication rec {
--replace-fail '"pythonvcard4>=0.2.0"' '"pythonvcard4"'
'';
postInstall = ''
# Ensure the CLI entry point is discoverable
mkdir -p $out/bin
if [ ! -f "$out/bin/nextcloud-mcp-server" ]; then
cat > $out/bin/nextcloud-mcp-server << 'PYEOF'
#!/bin/sh
exec ${python3Packages.python}/bin/python -m nextcloud_mcp_server.cli "$@"
PYEOF
chmod +x $out/bin/nextcloud-mcp-server
fi
'';
doCheck = false;
meta = with lib; {