nixos/packages/nvhpc.nix

45 lines
1.3 KiB
Nix
Raw Normal View History

2024-02-23 18:29:19 +08:00
{
2024-08-14 09:56:00 +08:00
version ? "24.7",
2024-02-23 18:29:19 +08:00
stdenvNoCC, fetchurl, buildFHSEnv,
gfortran, flock
}:
let
versions =
{
2024-08-14 09:56:00 +08:00
"24.7" = "0lzqfpvdjl13vd4hd622jdpgl6zdrg0xs3zskfzvrgf55ym9885z";
"24.1" = "1n0x1x7ywvr3623ylvrjagayn44mbvfas3c3062p7y3asmgjx697";
"23.1" = "1xg933f4n1bw39y1x1vrjrbzpx36sbmjgvi332hfck3dbx0n982m";
};
2024-02-21 13:43:19 +08:00
releaseName = version:
let versions = builtins.splitVersion version;
in "nvhpc_20${builtins.elemAt versions 0}_${builtins.concatStringsSep "" versions}_Linux_x86_64_cuda_multi";
builder = buildFHSEnv
{
name = "builder";
2024-02-23 18:29:19 +08:00
targetPkgs = pkgs: with pkgs; [ coreutils ];
2024-02-21 13:43:19 +08:00
extraBwrapArgs = [ "--bind" "$out" "$out" ];
};
2024-03-16 12:16:23 +08:00
in stdenvNoCC.mkDerivation
2024-02-21 13:43:19 +08:00
{
pname = "nvhpc";
inherit version;
src = fetchurl
2024-02-20 18:22:38 +08:00
{
2024-02-21 13:43:19 +08:00
url = "https://developer.download.nvidia.com/hpc-sdk/${version}/${releaseName version}.tar.gz";
sha256 = versions.${version};
2024-02-20 18:22:38 +08:00
};
2024-02-21 13:43:19 +08:00
dontFixup = true;
dontBuild = true;
2024-02-23 18:29:19 +08:00
buildInputs = [ gfortran flock ];
2024-02-21 13:43:19 +08:00
installPhase =
''
export NVHPC_SILENT=true
export NVHPC_INSTALL_TYPE=single
export NVHPC_INSTALL_DIR=$out/share/nvhpc
# $out should exist before bwrap
mkdir -p $out
${builder}/bin/builder ./install
'';
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" "big-parallel" ];
2024-03-16 12:16:23 +08:00
}