This commit is contained in:
2025-01-06 18:37:24 +08:00
parent 08fe454c5c
commit 5182d22428
8 changed files with 45 additions and 44 deletions

View File

@@ -23,4 +23,17 @@
version = "3.1.2"; version = "3.1.2";
hash = "sha256-f2cu+itsoNs03paOW1dmsUsbPa3iEtL4oIPGAKETRc4="; hash = "sha256-f2cu+itsoNs03paOW1dmsUsbPa3iEtL4oIPGAKETRc4=";
}; };
vtst =
{
patch = pkgs.fetchzip
{
url = "http://theory.cm.utexas.edu/code/vtstcode-204.tgz";
sha256 = "00qpqiabl568fwqjnmwqwr0jwg7s56xd9lv9lw8q4qxqy19cpg62";
};
script = pkgs.fetchzip
{
url = "http://theory.cm.utexas.edu/code/vtstscripts.tgz";
sha256 = "18gsw2850ig1mg4spp39i0ygfcwx0lqnamysn5whiax22m8d5z67";
};
};
} }

View File

@@ -12,7 +12,7 @@ inputs:
{ {
_packages = _packages =
( (
[ localPackages.vasp.intel localPackages.vasp.vtstscripts localPackages.vaspkit wannier90 ] [ localPackages.vasp.intel localPackages.vasp.vtst localPackages.vaspkit wannier90 ]
++ (inputs.lib.optional ++ (inputs.lib.optional
(let inherit (inputs.config.nixos.system.nixpkgs) cuda; in cuda.enable && cuda.capabilities != null) (let inherit (inputs.config.nixos.system.nixpkgs) cuda; in cuda.enable && cuda.capabilities != null)
localPackages.vasp.nvidia) localPackages.vasp.nvidia)

View File

@@ -40,12 +40,14 @@ inputs: rec
nvidia = inputs.pkgs.callPackage ./vasp/nvidia nvidia = inputs.pkgs.callPackage ./vasp/nvidia
{ {
inherit (nvhpcPackages) stdenv hdf5; inherit (nvhpcPackages) stdenv hdf5;
inherit vtst src; inherit src;
vtst = inputs.topInputs.self.src.vtst.patch;
wannier90 = inputs.pkgs.wannier90.overrideAttrs { buildFlags = [ "dynlib" ]; }; wannier90 = inputs.pkgs.wannier90.overrideAttrs { buildFlags = [ "dynlib" ]; };
}; };
intel = inputs.pkgs.callPackage ./vasp/intel intel = inputs.pkgs.callPackage ./vasp/intel
{ {
inherit vtst src; inherit src;
vtst = inputs.topInputs.self.src.vtst.patch;
inherit (inputs.pkgs.intelPackages_2023) stdenv; inherit (inputs.pkgs.intelPackages_2023) stdenv;
mpi = inputs.pkgs.openmpi.override mpi = inputs.pkgs.openmpi.override
{ {
@@ -62,8 +64,7 @@ inputs: rec
}; };
wannier90 = inputs.pkgs.wannier90.overrideAttrs { buildFlags = [ "dynlib" ]; }; wannier90 = inputs.pkgs.wannier90.overrideAttrs { buildFlags = [ "dynlib" ]; };
}; };
vtst = (inputs.pkgs.callPackage ./vasp/vtst.nix {}); vtst = inputs.pkgs.callPackage ./vasp/vtst.nix { src = inputs.topInputs.self.src.vtst.script; };
vtstscripts = inputs.pkgs.callPackage ./vasp/vtstscripts.nix {};
}; };
mumax = inputs.pkgs.callPackage ./mumax.nix { src = inputs.topInputs.mumax; }; mumax = inputs.pkgs.callPackage ./mumax.nix { src = inputs.topInputs.mumax; };
biu = inputs.pkgs.callPackage ./biu biu = inputs.pkgs.callPackage ./biu

View File

@@ -65,9 +65,9 @@ let
export PATH=${compilerDir}/bin:${mpiDir}/bin''${PATH:+:$PATH} export PATH=${compilerDir}/bin:${mpiDir}/bin''${PATH:+:$PATH}
# NVPL need this to load libgomp.so (actually libnvomp.so) from nvhpc instead of from gcc # NVPL need this to load libgomp.so (actually libnvomp.so) from nvhpc instead of from gcc
# https://docs.nvidia.com/nvpl/ # https://docs.nvidia.com/nvpl/
export LD_LIBRARY_PATH=${compilerDir}/lib:''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH=${compilerDir}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
# allow access to libcuda.so # allow access to libcuda.so
export LD_LIBRARY_PATH=/run/opengl-driver/lib:''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH=/run/opengl-driver/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
exec "$@" exec "$@"
''; '';
wrapper = (wrapCCWith wrapper = (wrapCCWith

View File

@@ -6,13 +6,13 @@ let vasp = stdenv.mkDerivation
{ {
name = "vasp-intel"; name = "vasp-intel";
inherit src; inherit src;
# patches = [ ../vtst.patch ]; patches = [ ../vtst.patch ];
configurePhase = configurePhase =
'' ''
cp ${./makefile.include} makefile.include cp ${./makefile.include} makefile.include
chmod +w makefile.include chmod +w makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F cp ${../constr_cell_relax.F} src/constr_cell_relax.F
# cp -r ${vtst}/* src cp -r ${vtst}/vtstcode6.4/* src
chmod -R +w src chmod -R +w src
''; '';
buildInputs = [ hdf5 wannier90 mkl ]; buildInputs = [ hdf5 wannier90 mkl ];

View File

@@ -6,13 +6,13 @@ let vasp = stdenv.mkDerivation
{ {
name = "vasp-nvidia"; name = "vasp-nvidia";
inherit src; inherit src;
# patches = [ ../vtst.patch ]; patches = [ ../vtst.patch ];
configurePhase = configurePhase =
'' ''
cp ${./makefile.include} makefile.include cp ${./makefile.include} makefile.include
chmod +w makefile.include chmod +w makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F cp ${../constr_cell_relax.F} src/constr_cell_relax.F
# cp -r ${vtst}/* src cp -r ${vtst}/vtstcode6.4/* src
chmod -R +w src chmod -R +w src
''; '';
buildInputs = [ hdf5 wannier90 mkl ]; buildInputs = [ hdf5 wannier90 mkl ];
@@ -38,6 +38,6 @@ let vasp = stdenv.mkDerivation
}; };
in writeShellScriptBin "vasp-nvidia" in writeShellScriptBin "vasp-nvidia"
'' ''
export PATH=${vasp}/bin:''${PATH:+:$PATH} export PATH=${vasp}/bin''${PATH:+:$PATH}
exec ${stdenv.cc.cc.runEnv} "$@" exec ${stdenv.cc.cc.runEnv} "$@"
'' ''

View File

@@ -1,8 +1,19 @@
{ fetchzip, lib }: { src, stdenv, autoPatchelfHook, perl, writeScriptBin }:
let let vtst = stdenv.mkDerivation
src = fetchzip {
{ name = "vtst";
url = "http://theory.cm.utexas.edu/code/vtstcode-199.tgz"; inherit src;
sha256 = "06c9f14a90ka3p396q6spr25xwkih4n01nm1qjj9fnvqzxlp9k9y"; buildInputs = [ autoPatchelfHook perl ];
}; installPhase =
in "${src}/vtstcode6.4" ''
mkdir -p $out/lib/vtst
cp -r * $out/lib/vtst
patchShebangs $out/lib/vtst
'';
};
in writeScriptBin "vtst"
''
export PERL5LIB=${vtst}/lib/vtst''${PERL5LIB:+:$PERL5LIB}
export PATH=${vtst}/lib/vtst''${PATH:+:$PATH}
exec "$@"
''

View File

@@ -1,24 +0,0 @@
{ fetchzip, stdenv, autoPatchelfHook, perl, writeScriptBin }:
let vtstscript-unwrapped = stdenv.mkDerivation
{
name = "vtstscript-unwrapped";
src = fetchzip
{
url = "http://theory.cm.utexas.edu/code/vtstscripts.tgz";
sha256 = "04476wgxvja15jijh9dxbzwy4mdrdqnd93s66jsm26rf73caj7lr";
};
buildInputs = [ autoPatchelfHook perl ];
installPhase =
''
mkdir -p $out/lib/vtstscripts
cp -r * $out/lib/vtstscripts
patchShebangs $out/lib/vtstscripts
'';
};
in writeScriptBin "vtstscripts"
''
# add vtstscript-unwrapped in PERL5LIB
export PERL5LIB=${vtstscript-unwrapped}/lib/vtstscripts''${PERL5LIB:+:$PERL5LIB}
export PATH=${vtstscript-unwrapped}/lib/vtstscripts''${PATH:+:$PATH}
exec "$@"
''