1{ 2 lib, 3 fetchPypi, 4 buildPythonPackage, 5 pytestCheckHook, 6 dotnetCorePackages, 7 setuptools, 8 setuptools-scm, 9 wheel, 10 buildDotnetModule, 11 cffi, 12}: 13 14let 15 pname = "clr-loader"; 16 version = "0.2.6"; 17 src = fetchPypi { 18 pname = "clr_loader"; 19 inherit version; 20 hash = "sha256-AZNIrmtqg8ekBtFFN8J3zs96OlOyY+w0LIHe1YRaZ+4="; 21 }; 22 23 # This buildDotnetModule is used only to get nuget sources, the actual 24 # build is done in `buildPythonPackage` below. 25 dotnet-build = buildDotnetModule { 26 inherit pname version src; 27 projectFile = [ 28 "netfx_loader/ClrLoader.csproj" 29 "example/example.csproj" 30 ]; 31 nugetDeps = ./deps.nix; 32 }; 33in 34buildPythonPackage { 35 inherit pname version src; 36 37 format = "pyproject"; 38 39 nativeBuildInputs = [ 40 setuptools 41 setuptools-scm 42 wheel 43 dotnetCorePackages.sdk_6_0 44 ]; 45 46 propagatedBuildInputs = [ cffi ]; 47 48 nativeCheckInputs = [ pytestCheckHook ]; 49 50 disabledTests = [ 51 # TODO: mono does not work due to https://github.com/NixOS/nixpkgs/issues/7307 52 "test_mono" 53 "test_mono_debug" 54 "test_mono_signal_chaining" 55 "test_mono_set_dir" 56 ]; 57 58 # Perform dotnet restore based on the nuget-source 59 preConfigure = '' 60 dotnet restore "netfx_loader/ClrLoader.csproj" \ 61 -p:ContinuousIntegrationBuild=true \ 62 -p:Deterministic=true \ 63 --source "${dotnet-build.nuget-source}" 64 65 dotnet restore "example/example.csproj" \ 66 -p:ContinuousIntegrationBuild=true \ 67 -p:Deterministic=true \ 68 --source "${dotnet-build.nuget-source}" 69 ''; 70 71 passthru.fetch-deps = dotnet-build.fetch-deps; 72 73 meta = with lib; { 74 description = "Generic pure Python loader for .NET runtimes"; 75 homepage = "https://pythonnet.github.io/clr-loader/"; 76 license = licenses.mit; 77 maintainers = with maintainers; [ mdarocha ]; 78 }; 79}