packages.py4vasp: fix

This commit is contained in:
2024-12-15 15:40:19 +08:00
parent ebb7078487
commit e37c316fd8
10 changed files with 49 additions and 205 deletions

116
flake.lock generated
View File

@@ -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"
]

View File

@@ -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"; };

View File

@@ -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=";
};
}

View File

@@ -24,7 +24,6 @@ inputs:
[
topInputs.qchem.overlays.default
topInputs.bscpkgs.overlays.default
topInputs.poetry2nix.overlays.default
topInputs.aagl.overlays.default
(final: prev:
{

View File

@@ -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 ])];
};
};
}

View File

@@ -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" {}

18
packages/nglview.nix Normal file
View File

@@ -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"' ""
'';
}

11
packages/py4vasp.nix Normal file
View File

@@ -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 ];
}

View File

@@ -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"

View File

@@ -1,70 +0,0 @@
From f391623a00aff45f510bf815ddfb1817ae833059 Mon Sep 17 00:00:00 2001
From: Katie Rust <katie@ktpanda.org>
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