mcp-nixos: 1.0.3 -> 2.1.0

https://github.com/utensils/mcp-nixos/compare/v1.0.3..v2.1.0
This commit is contained in:
Amadej Kastelic
2026-01-13 14:15:15 +01:00
parent df8f03a5c7
commit 577c915bd0
2 changed files with 8 additions and 51 deletions
+8 -19
View File
@@ -6,21 +6,16 @@
python3Packages.buildPythonApplication rec {
pname = "mcp-nixos";
version = "1.0.3";
version = "2.1.0";
pyproject = true;
src = fetchFromGitHub {
owner = "utensils";
repo = "mcp-nixos";
tag = "v${version}";
hash = "sha256-UCsJ8eDuHL14u2GFIYEY/drtZ6jht5zN/G/6QNlEy2g=";
hash = "sha256-rnpIDY/sy/uV+1dsW+MrFwAFE/RHg5K/6aa5k7Yt1Dc=";
};
patches = [
# This patch mocks nix channel listing network calls in tests
./tests-mock-nix-channels.patch
];
build-system = [ python3Packages.hatchling ];
dependencies = with python3Packages; [
@@ -30,8 +25,6 @@ python3Packages.buildPythonApplication rec {
requests
];
pythonRelaxDeps = [ "fastmcp" ];
nativeCheckInputs = with python3Packages; [
anthropic
pytestCheckHook
@@ -39,18 +32,14 @@ python3Packages.buildPythonApplication rec {
python-dotenv
];
disabledTestMarks = [
# Require network access
"integration"
disabledTestPaths = [
# Requires network access
"tests/test_integration.py"
];
disabledTestPaths = [
# Require network access
"tests/test_nixhub.py"
"tests/test_mcp_behavior.py"
"tests/test_options.py"
# Requires configured channels
"tests/test_channels.py"
disabledTests = [
# Requires network access
"test_valid_channel"
];
pythonImportsCheck = [ "mcp_nixos" ];
@@ -1,32 +0,0 @@
diff --git a/tests/conftest.py b/tests/conftest.py
index baae124..2b4bf01 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,27 @@
"""Minimal test configuration for refactored MCP-NixOS."""
+import pytest
+@pytest.fixture(autouse=True)
+def mock_get_channels(monkeypatch):
+ """Mock get_channels function to return fixed channels for all tests."""
+ def mock_channels():
+ return {
+ "unstable": "latest-43-nixos-unstable",
+ "25.05": "latest-43-nixos-25.05",
+ "25.11": "latest-43-nixos-25.11",
+ "24.11": "latest-43-nixos-24.11",
+ "stable": "latest-43-nixos-25.05",
+ "beta": "latest-43-nixos-25.05"
+ }
+
+ # Patch the function in the server module
+ monkeypatch.setattr('mcp_nixos.server.get_channels', mock_channels)
+
+ # Also patch any imported references in test modules
+ monkeypatch.setattr('tests.test_server.get_channels', mock_channels)
+
+
def pytest_addoption(parser):
"""Add test filtering options."""
parser.addoption("--unit", action="store_true", help="Run unit tests only")