diff --git a/flake.lock b/flake.lock index 2f9316b0..81d86d4e 100644 --- a/flake.lock +++ b/flake.lock @@ -447,24 +447,6 @@ "inputs": { "systems": "systems_4" }, - "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_5": { - "inputs": { - "systems": "systems_6" - }, "locked": { "lastModified": 1710146030, "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", @@ -777,27 +759,6 @@ "type": "github" } }, - "nix-github-actions_2": { - "inputs": { - "nixpkgs": [ - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1729742964, - "narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "e04df33f62cdcf93d73e9a04142464753a16db67", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -1162,30 +1123,6 @@ "type": "github" } }, - "poetry2nix": { - "inputs": { - "flake-utils": "flake-utils_4", - "nix-github-actions": "nix-github-actions_2", - "nixpkgs": [ - "nixpkgs" - ], - "systems": "systems_5", - "treefmt-nix": "treefmt-nix_4" - }, - "locked": { - "lastModified": 1731205797, - "narHash": "sha256-F7N1mxH1VrkVNHR3JGNMRvp9+98KYO4b832KS8Gl2xI=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "f554d27c1544d9c56e5f1f8e2b8aff399803674e", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": "flake-compat_5", @@ -1286,7 +1223,6 @@ "openxlsx": "openxlsx", "plasma-manager": "plasma-manager", "pocketfft": "pocketfft", - "poetry2nix": "poetry2nix", "py4vasp": "py4vasp", "qchem": "qchem", "rsshub": "rsshub", @@ -1497,35 +1433,6 @@ "type": "github" } }, - "systems_5": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "id": "systems", - "type": "indirect" - } - }, - "systems_6": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "tgbot-cpp": { "flake": false, "locked": { @@ -1605,27 +1512,6 @@ "type": "github" } }, - "treefmt-nix_4": { - "inputs": { - "nixpkgs": [ - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730120726, - "narHash": "sha256-LqHYIxMrl/1p3/kvm2ir925tZ8DkI0KA10djk8wecSk=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "9ef337e492a5555d8e17a51c911ff1f02635be15", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, "ufo": { "flake": false, "locked": { @@ -1678,7 +1564,7 @@ "winapps": { "inputs": { "flake-compat": "flake-compat_6", - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_4", "nixpkgs": [ "nixpkgs" ] diff --git a/flake.nix b/flake.nix index 1f35f064..30a4c0d9 100644 --- a/flake.nix +++ b/flake.nix @@ -29,7 +29,6 @@ gricad = { url = "github:Gricad/nur-packages"; flake = false; }; catppuccin.url = "github:catppuccin/nix"; bscpkgs = { url = "git+https://git.chn.moe/chn/bscpkgs.git"; inputs.nixpkgs.follows = "nixpkgs"; }; - poetry2nix = { url = "github:nix-community/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; winapps = { url = "github:winapps-org/winapps/feat-nix-packaging"; inputs.nixpkgs.follows = "nixpkgs"; }; aagl = { url = "github:ezKEa/aagl-gtk-on-nix/release-24.11"; inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/flake/src.nix b/flake/src.nix index 87fed971..912ba55f 100644 --- a/flake/src.nix +++ b/flake/src.nix @@ -7,4 +7,10 @@ + "/nixos-plasma6-24.11beta709057.0c582677378f-x86_64-linux.iso"; sha256 = "000wmfn6k5awqwsx9qldhdgahv4k09w4yzmvf0djs51qjdpha082"; }; + nglview = pkgs.fetchPypi + { + pname = "nglview"; + version = "3.1.2"; + hash = "sha256-f2cu+itsoNs03paOW1dmsUsbPa3iEtL4oIPGAKETRc4="; + }; } diff --git a/modules/default.nix b/modules/default.nix index 6334f535..2a18c70b 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -24,7 +24,6 @@ inputs: [ topInputs.qchem.overlays.default topInputs.bscpkgs.overlays.default - topInputs.poetry2nix.overlays.default topInputs.aagl.overlays.default (final: prev: { diff --git a/modules/packages/vasp.nix b/modules/packages/vasp.nix index 777e45f5..0d040f60 100644 --- a/modules/packages/vasp.nix +++ b/modules/packages/vasp.nix @@ -8,12 +8,16 @@ inputs: # TODO: add more options to correctly configure VASP config = let inherit (inputs.config.nixos.packages) vasp; in inputs.lib.mkIf (vasp != null) { - nixos.packages.packages._packages = with inputs.pkgs; - ( - [ localPackages.vasp.intel localPackages.vasp.vtstscripts localPackages.py4vasp localPackages.vaspkit wannier90 ] - ++ (inputs.lib.optional - (let inherit (inputs.config.nixos.system.nixpkgs) cuda; in cuda.enable && cuda.capabilities != null) - localPackages.vasp.nvidia) - ); + nixos.packages.packages = with inputs.pkgs; + { + _packages = + ( + [ localPackages.vasp.intel localPackages.vasp.vtstscripts localPackages.vaspkit wannier90 ] + ++ (inputs.lib.optional + (let inherit (inputs.config.nixos.system.nixpkgs) cuda; in cuda.enable && cuda.capabilities != null) + localPackages.vasp.nvidia) + ); + _pythonPackages = [(_: [ localPackages.py4vasp ])]; + }; }; } diff --git a/packages/default.nix b/packages/default.nix index 4e65de55..6d3a9853 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -92,13 +92,14 @@ inputs: rec sockpp = inputs.pkgs.callPackage ./sockpp.nix { src = inputs.topInputs.sockpp; }; git-lfs-transfer = inputs.pkgs.callPackage ./git-lfs-transfer.nix { src = inputs.topInputs.git-lfs-transfer; hash = inputs.topInputs.self.src.git-lfs-transfer; }; - py4vasp = inputs.pkgs.callPackage ./py4vasp { src = inputs.topInputs.py4vasp; }; + py4vasp = inputs.pkgs.python3Packages.callPackage ./py4vasp.nix { src = inputs.topInputs.py4vasp; inherit nglview; }; pocketfft = inputs.pkgs.callPackage ./pocketfft.nix { src = inputs.topInputs.pocketfft; }; spectroscopy = inputs.pkgs.callPackage ./spectroscopy.nix { src = inputs.topInputs.spectroscopy; }; mirism = inputs.pkgs.callPackage ./mirism { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; }; vaspberry = inputs.pkgs.callPackage ./vaspberry.nix { src = inputs.topInputs.vaspberry; }; highfive = inputs.pkgs.callPackage ./highfive.nix { src = inputs.topInputs.highfive; }; stickerpicker = inputs.pkgs.python3Packages.callPackage ./stickerpicker.nix { src = inputs.topInputs.stickerpicker; }; + nglview = inputs.pkgs.python3Packages.callPackage ./nglview.nix { src = inputs.topInputs.self.src.nglview; }; fromYaml = content: builtins.fromJSON (builtins.readFile (inputs.pkgs.runCommand "toJSON" {} diff --git a/packages/nglview.nix b/packages/nglview.nix new file mode 100644 index 00000000..1747b104 --- /dev/null +++ b/packages/nglview.nix @@ -0,0 +1,18 @@ +# from https://github.com/NixOS/nixpkgs/pull/267893 +{ + buildPythonPackage, src, + ipywidgets, jupyter-packaging, jupyterlab-widgets, numpy, setuptools, versioneer, wheel, notebook +}: buildPythonPackage +{ + name = "nglview"; + pyproject = true; + inherit src; + build-system = [ jupyter-packaging setuptools versioneer wheel ]; + dependencies = [ ipywidgets jupyterlab-widgets numpy notebook ]; + postPatch = + '' + substituteInPlace pyproject.toml \ + --replace "jupyter_packaging~=0.7.9" "jupyter_packaging" \ + --replace '"versioneer-518"' "" + ''; +} \ No newline at end of file diff --git a/packages/py4vasp.nix b/packages/py4vasp.nix new file mode 100644 index 00000000..8d26ce51 --- /dev/null +++ b/packages/py4vasp.nix @@ -0,0 +1,11 @@ +{ + src, buildPythonPackage, + poetry-core, numpy, h5py, pandas, ase, plotly, kaleido, ipython, scipy, nglview +}: buildPythonPackage +{ + name = "py4vasp"; + pyproject = true; + inherit src; + build-system = [ poetry-core ]; + dependencies = [ numpy h5py pandas ase plotly kaleido ipython scipy nglview ]; +} diff --git a/packages/py4vasp/default.nix b/packages/py4vasp/default.nix deleted file mode 100644 index 95f7dbab..00000000 --- a/packages/py4vasp/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ src, poetry2nix, runCommand }: -let - package = poetry2nix.mkPoetryApplication - { - projectDir = src; - overrides = poetry2nix.overrides.withDefaults (final: prev: - { numpy = prev.numpy.overridePythonAttrs { patches = prev.patches or [] ++ [ ./numpy.patch ]; }; }); - }; - python = package.python.withPackages (p: [ package p.mdtraj ]); -in runCommand "py4vasp" {} "mkdir -p $out/bin; ln -s ${python}/bin/python $out/bin/py4vasp" diff --git a/packages/py4vasp/numpy.patch b/packages/py4vasp/numpy.patch deleted file mode 100644 index 1d5defd5..00000000 --- a/packages/py4vasp/numpy.patch +++ /dev/null @@ -1,70 +0,0 @@ -From f391623a00aff45f510bf815ddfb1817ae833059 Mon Sep 17 00:00:00 2001 -From: Katie Rust -Date: Mon, 16 Sep 2024 13:04:22 -0500 -Subject: [PATCH] BUG: Stub out `get_build_msvc_version` if - `distutils.msvccompiler` cannot be imported (fixes #27405) - ---- - numpy/distutils/mingw32ccompiler.py | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py -index 39905a784088..2599a9e9a807 100644 ---- a/numpy/distutils/mingw32ccompiler.py -+++ b/numpy/distutils/mingw32ccompiler.py -@@ -24,7 +24,13 @@ - - import distutils.cygwinccompiler - from distutils.unixccompiler import UnixCCompiler --from distutils.msvccompiler import get_build_version as get_build_msvc_version -+ -+try: -+ from distutils.msvccompiler import get_build_version as get_build_msvc_version -+except ImportError: -+ def get_build_msvc_version(): -+ return None -+ - from distutils.errors import UnknownFileError - from numpy.distutils.misc_util import (msvc_runtime_library, - msvc_runtime_version, -diff --git a/numpy/distutils/msvccompiler.py b/numpy/distutils/msvccompiler.py -index 2b93221baa..d1fae7b6ca 100644 ---- a/numpy/distutils/msvccompiler.py -+++ b/numpy/distutils/msvccompiler.py -@@ -1,5 +1,4 @@ - import os --from distutils.msvccompiler import MSVCCompiler as _MSVCCompiler - - from .system_info import platform_bits - -@@ -36,27 +35,12 @@ def _merge(old, new): - return ';'.join([old, new]) - - --class MSVCCompiler(_MSVCCompiler): -+class MSVCCompiler: - def __init__(self, verbose=0, dry_run=0, force=0): -- _MSVCCompiler.__init__(self, verbose, dry_run, force) -+ pass - - def initialize(self): -- # The 'lib' and 'include' variables may be overwritten -- # by MSVCCompiler.initialize, so save them for later merge. -- environ_lib = os.getenv('lib', '') -- environ_include = os.getenv('include', '') -- _MSVCCompiler.initialize(self) -- -- # Merge current and previous values of 'lib' and 'include' -- os.environ['lib'] = _merge(environ_lib, os.environ['lib']) -- os.environ['include'] = _merge(environ_include, os.environ['include']) -- -- # msvc9 building for 32 bits requires SSE2 to work around a -- # compiler bug. -- if platform_bits == 32: -- self.compile_options += ['/arch:SSE2'] -- self.compile_options_debug += ['/arch:SSE2'] -- -+ pass - - def lib_opts_if_msvc(build_cmd): - """ Add flags if we are using MSVC compiler