diff --git a/flake.lock b/flake.lock index ce542ed2..e20dca5b 100644 --- a/flake.lock +++ b/flake.lock @@ -1282,6 +1282,24 @@ "type": "github" } }, + "pybinding": { + "flake": false, + "locked": { + "lastModified": 1598796477, + "narHash": "sha256-4DtGtQ40TEaM6qSydwsj9gD3JqpaCFpcvWJISwn69Zk=", + "ref": "refs/heads/master", + "rev": "ec1128aaa84a1b43a74fb970479ce4544bd63179", + "revCount": 774, + "submodules": true, + "type": "git", + "url": "https://github.com/dean0x7d/pybinding" + }, + "original": { + "submodules": true, + "type": "git", + "url": "https://github.com/dean0x7d/pybinding" + } + }, "quickshell": { "inputs": { "nixpkgs": [ @@ -1345,6 +1363,7 @@ "plasma-manager": "plasma-manager", "pocketfft": "pocketfft", "py4vasp": "py4vasp", + "pybinding": "pybinding", "rsshub": "rsshub", "rycee": "rycee", "sops-nix": "sops-nix", diff --git a/flake.nix b/flake.nix index c9222999..de88eceb 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,7 @@ phono3py = { url = "github:phonopy/phono3py/v3.15.1"; flake = false; }; sticker = { url = "git+https://git.chn.moe/chn/sticker.git?lfs=1"; flake = false; }; speedtest = { url = "github:librespeed/speedtest"; flake = false; }; + pybinding = { url = "git+https://github.com/dean0x7d/pybinding?submodules=1"; flake = false; }; }; outputs = inputs: let localLib = import ./flake/lib inputs.nixpkgs.lib; in diff --git a/packages/default.nix b/packages/default.nix index 080038a9..25e82436 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -141,6 +141,11 @@ inputs: rec atat = inputs.pkgs.callPackage ./atat.nix { src = inputs.topInputs.self.src.atat; }; atomkit = inputs.pkgs.callPackage ./atomkit.nix { src = inputs.topInputs.self.src.atomkit; }; xinli = inputs.pkgs.callPackage ./xinli { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; }; + pybinding = inputs.pkgs.pkgs-2411.python310Packages.callPackage ./pybinding + { + src = inputs.topInputs.pybinding; + buildProxy = inputs.pkgs.lib.mkBuildproxy ./pybinding/proxy.nix; + }; fromYaml = content: builtins.fromJSON (builtins.readFile (inputs.pkgs.runCommand "toJSON" {} diff --git a/packages/pybinding/default.nix b/packages/pybinding/default.nix new file mode 100644 index 00000000..233a8a81 --- /dev/null +++ b/packages/pybinding/default.nix @@ -0,0 +1,12 @@ +{ src, buildPythonPackage, setuptools, cmake, buildProxy, distutils, numpy, scipy, matplotlib, pytest }: +buildPythonPackage +{ + name = "pybinding"; + inherit src; + pyproject = true; + build-system = [ setuptools cmake distutils ]; + dependencies = [ numpy scipy matplotlib pytest ]; + dontUseCmakeConfigure = true; + preBuild = ''source ${buildProxy}''; + patches = [ ./fix.patch ]; +} diff --git a/packages/pybinding/fix.patch b/packages/pybinding/fix.patch new file mode 100644 index 00000000..08832ab9 --- /dev/null +++ b/packages/pybinding/fix.patch @@ -0,0 +1,24 @@ +diff --git a/cppcore/include/numeric/arrayref.hpp b/cppcore/include/numeric/arrayref.hpp +index e1ef1ba..722ebdc 100644 +--- a/cppcore/include/numeric/arrayref.hpp ++++ b/cppcore/include/numeric/arrayref.hpp +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + + namespace cpb { namespace num { + +diff --git a/cppmodule/deps/pybind11/include/pybind11/attr.h b/cppmodule/deps/pybind11/include/pybind11/attr.h +index 6962d6fc..f8261bc3 100644 +--- a/cppmodule/deps/pybind11/include/pybind11/attr.h ++++ b/cppmodule/deps/pybind11/include/pybind11/attr.h +@@ -11,6 +11,7 @@ + #pragma once + + #include "cast.h" ++#include + + NAMESPACE_BEGIN(PYBIND11_NAMESPACE) + \ No newline at end of file diff --git a/packages/pybinding/proxy.nix b/packages/pybinding/proxy.nix new file mode 100644 index 00000000..3bdc09b3 --- /dev/null +++ b/packages/pybinding/proxy.nix @@ -0,0 +1,130 @@ +{ fetchurl }: +[ + { + url = "https://gitlab.com/libeigen/eigen/-/archive/3.3.3/eigen-3.3.3.tar.gz"; + file = fetchurl + { + url = "https://gitlab.com/libeigen/eigen/-/archive/3.3.3/eigen-3.3.3.tar.gz"; + hash = "sha256-/XJpQ5C9joFYYgVxfSz4I+cY9YS3eaFV23R9HmhIGi4="; + }; + status_code = 200; + headers = + { + "content-type" = "application/octet-stream"; + "content-disposition" = "attachment; filename=eigen-3.3.3.tar.gz"; + }; + } + { + url = "https://raw.githubusercontent.com/mapbox/variant/v1.1.4/include/mapbox/variant.hpp"; + file = fetchurl + { + url = "https://raw.githubusercontent.com/mapbox/variant/v1.1.4/include/mapbox/variant.hpp"; + hash = "sha256-TsAoFQ3nrnXwS8cxg2RLiu6U7CxZGYHmIm7mHemTgSA="; + }; + status_code = 200; + headers = + { + "content-type" = "text/plain; charset=utf-8"; + "content-length" = "31575"; + }; + } + { + url = "https://raw.githubusercontent.com/mapbox/variant/v1.1.4/include/mapbox/recursive_wrapper.hpp"; + file = fetchurl + { + url = "https://raw.githubusercontent.com/mapbox/variant/v1.1.4/include/mapbox/recursive_wrapper.hpp"; + hash = "sha256-Su1xw27Ctf7TM8isDU8SGXiKg9rM9LvxEh8bUiaGnR0="; + }; + status_code = 200; + headers = + { + "content-type" = "text/plain; charset=utf-8"; + "content-length" = "2632"; + }; + } + { + url = "https://raw.githubusercontent.com/mapbox/variant/v1.1.4/include/mapbox/variant_visitor.hpp"; + file = fetchurl + { + url = "https://raw.githubusercontent.com/mapbox/variant/v1.1.4/include/mapbox/variant_visitor.hpp"; + hash = "sha256-JiPsMvUm0V8P/cXxM3BMHrCAk+cU2JGzWAoK5T2e9DI="; + }; + status_code = 200; + headers = + { + "content-type" = "text/plain; charset=utf-8"; + "content-length" = "743"; + }; + } + { + url = "https://github.com/p12tic/libsimdpp/archive//v2.0-rc2.tar.gz"; + file = fetchurl + { + url = "https://github.com/p12tic/libsimdpp/archive//v2.0-rc2.tar.gz"; + hash = "sha256-dLYHn29FfiMm8HGclKiB/XN4Xu71mpKGjGmTWcuXndg="; + }; + status_code = 200; + headers = + { + "content-disposition" = "attachment; filename=libsimdpp-2.0-rc2.tar.gz"; + "content-type" = "application/x-gzip"; + "content-length" = "287439"; + }; + } + { + url = "https://raw.githubusercontent.com/fmtlib/fmt/3.0.2/fmt/format.h"; + file = fetchurl + { + url = "https://raw.githubusercontent.com/fmtlib/fmt/3.0.2/fmt/format.h"; + hash = "sha256-7v0pfyt2c2KDtMhot68W9nt13pN+j2OswuuKeB/ZnBs="; + }; + status_code = 200; + headers = + { + "content-type" = "text/plain; charset=utf-8"; + "content-length" = "119800"; + }; + } + { + url = "https://raw.githubusercontent.com/fmtlib/fmt/3.0.2/fmt/format.cc"; + file = fetchurl + { + url = "https://raw.githubusercontent.com/fmtlib/fmt/3.0.2/fmt/format.cc"; + hash = "sha256-cwjmLJljDJ/iQbF5dD6PHnvUSGYfx1Elfq1kebFVzE0="; + }; + status_code = 200; + headers = + { + "content-type" = "text/plain; charset=utf-8"; + "content-length" = "28777"; + }; + } + { + url = "https://raw.githubusercontent.com/fmtlib/fmt/3.0.2/fmt/ostream.h"; + file = fetchurl + { + url = "https://raw.githubusercontent.com/fmtlib/fmt/3.0.2/fmt/ostream.h"; + hash = "sha256-is8VgEdM7FovPR6X3MuRGoPfd+Gm7vtHT+3r6rZasII="; + }; + status_code = 200; + headers = + { + "content-type" = "text/plain; charset=utf-8"; + "content-length" = "2830"; + }; + } + { + url = "https://raw.githubusercontent.com/fmtlib/fmt/3.0.2/fmt/ostream.cc"; + file = fetchurl + { + url = "https://raw.githubusercontent.com/fmtlib/fmt/3.0.2/fmt/ostream.cc"; + hash = "sha256-NKg67BJHmwd5YAIkOqjNEDjvqSspLFHN2+23W5XImSQ="; + }; + status_code = 200; + headers = + { + "content-type" = "text/plain; charset=utf-8"; + "content-length" = "1073"; + }; + } +]