about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authormdarocha <git@mdarocha.pl>2023-06-20 17:23:01 +0200
committerSandro Jäckel <sandro.jaeckel@gmail.com>2023-06-21 14:30:52 +0200
commit355a2731b821f4694784137fc2fdd465aeba4c18 (patch)
tree2baf0241fd72d2b918c62303e5169f8d456826a3 /pkgs/development
parent2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5 (diff)
python310Packages.clr-loader: init at 0.2.5
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/python-modules/clr-loader/default.nix79
-rw-r--r--pkgs/development/python-modules/clr-loader/deps.nix11
2 files changed, 90 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/clr-loader/default.nix b/pkgs/development/python-modules/clr-loader/default.nix
new file mode 100644
index 0000000000000..2c74dc30d1c57
--- /dev/null
+++ b/pkgs/development/python-modules/clr-loader/default.nix
@@ -0,0 +1,79 @@
+{ lib
+, fetchPypi
+, buildPythonPackage
+, pytestCheckHook
+, dotnetCorePackages
+, setuptools
+, buildDotnetModule
+, cffi
+}:
+
+let
+  pname = "clr_loader";
+  version = "0.2.5";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "sha256-gu1ftlRynRT9iCludLtrhOss+5dv9LfUnU5En9eKIms=";
+  };
+
+  # This buildDotnetModule is used only to get nuget sources, the actual
+  # build is done in `buildPythonPackage` below.
+  dotnet-build = buildDotnetModule {
+    inherit pname version src;
+    projectFile = [ "netfx_loader/ClrLoader.csproj" "example/example.csproj" ];
+    nugetDeps = ./deps.nix;
+  };
+in
+buildPythonPackage {
+  inherit pname version src;
+
+  format = "pyproject";
+
+  postPatch = ''
+    substituteInPlace pyproject.toml \
+      --replace 'dynamic = ["version"]' 'version = "${version}"'
+  '';
+
+  nativeBuildInputs = [
+    setuptools
+    dotnetCorePackages.sdk_6_0
+  ];
+
+  propagatedBuildInputs = [
+    cffi
+  ];
+
+  nativeCheckInputs = [
+    pytestCheckHook
+  ];
+
+  disabledTests = [
+    # TODO: mono does not work due to https://github.com/NixOS/nixpkgs/issues/7307
+    "test_mono"
+    "test_mono_debug"
+    "test_mono_signal_chaining"
+    "test_mono_set_dir"
+  ];
+
+  # Perform dotnet restore based on the nuget-source
+  preConfigure = ''
+    dotnet restore "netfx_loader/ClrLoader.csproj" \
+      -p:ContinuousIntegrationBuild=true \
+      -p:Deterministic=true \
+      --source "${dotnet-build.nuget-source}"
+
+    dotnet restore "example/example.csproj" \
+      -p:ContinuousIntegrationBuild=true \
+      -p:Deterministic=true \
+      --source "${dotnet-build.nuget-source}"
+  '';
+
+  passthru.fetch-deps = dotnet-build.fetch-deps;
+
+  meta = with lib; {
+    description = "Generic pure Python loader for .NET runtimes";
+    homepage = "https://pythonnet.github.io/clr-loader/";
+    license = licenses.mit;
+    maintainers = with maintainers; [ mdarocha ];
+  };
+}
diff --git a/pkgs/development/python-modules/clr-loader/deps.nix b/pkgs/development/python-modules/clr-loader/deps.nix
new file mode 100644
index 0000000000000..df303afaa791f
--- /dev/null
+++ b/pkgs/development/python-modules/clr-loader/deps.nix
@@ -0,0 +1,11 @@
+# This file was automatically generated by passthru.fetch-deps.
+# Please dont edit it manually, your changes might get overwritten!
+
+{ fetchNuGet }: [
+  (fetchNuGet { pname = "Microsoft.NETCore.Platforms"; version = "1.1.0"; sha256 = "08vh1r12g6ykjygq5d3vq09zylgb84l63k49jc4v8faw9g93iqqm"; })
+  (fetchNuGet { pname = "Microsoft.NETFramework.ReferenceAssemblies"; version = "1.0.0"; sha256 = "0na724xhvqm63vq9y18fl9jw9q2v99bdwr353378s5fsi11qzxp9"; })
+  (fetchNuGet { pname = "Microsoft.NETFramework.ReferenceAssemblies.net461"; version = "1.0.0"; sha256 = "00vkn4c6i0rn1l9pv912y0wgb9h6ks76qah8hvk441nari8fqbm1"; })
+  (fetchNuGet { pname = "Microsoft.NETFramework.ReferenceAssemblies.net47"; version = "1.0.0"; sha256 = "00v56phfn01ahf4fq7zanz6hjyzpp00hkkk4a190l0dywrv387i6"; })
+  (fetchNuGet { pname = "NETStandard.Library"; version = "2.0.3"; sha256 = "1fn9fxppfcg4jgypp2pmrpr6awl3qz1xmnri0cygpkwvyx27df1y"; })
+  (fetchNuGet { pname = "NXPorts"; version = "1.0.0"; sha256 = "02zva596c3vsnlhi1b1391vbfl8a6142dvm61r8j1c70b07916lj"; })
+]