diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-08-08 16:04:42 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-08-13 06:35:37 +0000 |
commit | 12aaa58dac35800b5b7d77f81cf2a87c21ee55da (patch) | |
tree | be0add9e5c22a85d20b5d78206aa74f956eb2a1b /nixpkgs/pkgs/development/libraries/science | |
parent | 45892a5591202f75a1c2f1ca7c62a92c7566e3c5 (diff) | |
parent | 5a8e9243812ba528000995b294292d3b5e120947 (diff) | |
download | nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.gz nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.bz2 nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.lz nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.xz nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.zst nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.zip |
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts: nixpkgs/pkgs/applications/window-managers/sway/default.nix nixpkgs/pkgs/build-support/go/module.nix nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix nixpkgs/pkgs/development/libraries/mesa/default.nix nixpkgs/pkgs/servers/dict/dictd-db.nix Link: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/391
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/science')
28 files changed, 464 insertions, 455 deletions
diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/cfitsio/default.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/cfitsio/default.nix index 8a6b72f52130..f35ff4c5ce58 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/cfitsio/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/cfitsio/default.nix @@ -1,15 +1,21 @@ -{ stdenv, lib, fetchurl, bzip2, zlib }: - -stdenv.mkDerivation rec { +{ stdenv +, lib +, fetchurl +, bzip2 +, curl +, zlib +}: + +stdenv.mkDerivation (finalAttrs: { pname = "cfitsio"; - version = "4.2.0"; + version = "4.3.0"; src = fetchurl { - url = "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-${version}.tar.gz"; - sha256 = "sha256-66U9Gz9uNFYyuwmnt1LsfO09Y+xRU6hIOA84gMXWGIk="; + url = "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-${finalAttrs.version}.tar.gz"; + hash = "sha256-/a3AHQnPn1QlOALF7IfrEN5RzkEwQRQVrojDCUBiG4s="; }; - buildInputs = [ bzip2 zlib ]; + buildInputs = [ bzip2 curl zlib ]; patches = [ ./darwin-rpath-universal.patch ]; @@ -22,7 +28,7 @@ stdenv.mkDerivation rec { postPatch = '' sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in ''; - meta = with lib; { + meta = { homepage = "https://heasarc.gsfc.nasa.gov/fitsio/"; description = "Library for reading and writing FITS data files"; longDescription = @@ -35,8 +41,8 @@ stdenv.mkDerivation rec { FITS files. ''; changelog = "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/docs/changes.txt"; - license = licenses.mit; - maintainers = with maintainers; [ xbreak hjones2199 ]; - platforms = with platforms; linux ++ darwin; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ xbreak hjones2199 ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; }; -} +}) diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/default.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/default.nix index cf722af9cbe1..7090e15dc3d7 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/default.nix @@ -12,17 +12,18 @@ , libjpeg , gsl , fftw +, gtest }: stdenv.mkDerivation rec { pname = "indilib"; - version = "1.9.8"; + version = "2.0.2"; src = fetchFromGitHub { owner = "indilib"; repo = "indi"; rev = "v${version}"; - sha256 = "sha256-+KFuZgM/Bl6Oezq3WXjWCHefc1wvR3wOKXejmT0pw1U="; + hash = "sha256-GoEvWzGT3Ckv9Syif6Z2kAlnvg/Kt5I8SpGFG9kFTJo="; }; nativeBuildInputs = [ @@ -45,16 +46,24 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" "-DUDEVRULES_INSTALL_DIR=lib/udev/rules.d" + ] ++ lib.optional doCheck [ + "-DINDI_BUILD_UNITTESTS=ON" + "-DINDI_BUILD_INTEGTESTS=ON" ]; + checkInputs = [ gtest ]; + + doCheck = true; + + # Socket address collisions between tests + enableParallelChecking = false; + meta = with lib; { homepage = "https://www.indilib.org/"; description = "Implementation of the INDI protocol for POSIX operating systems"; changelog = "https://github.com/indilib/indi/releases/tag/v${version}"; license = licenses.lgpl2Plus; - maintainers = with maintainers; [ hjones2199 ]; + maintainers = with maintainers; [ hjones2199 sheepforce ]; platforms = platforms.unix; - # error: use of undeclared identifier 'MSG_NOSIGNAL' - broken = stdenv.isDarwin && stdenv.isx86_64; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix index 7144a17c18b4..2423a6e20e34 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix @@ -17,6 +17,7 @@ , libdc1394 , gpsd , ffmpeg +, limesuite , version , src , withFirmware ? false @@ -33,22 +34,22 @@ stdenv.mkDerivation rec { buildInputs = [ indilib libnova curl cfitsio libusb1 zlib boost gsl gpsd libjpeg libgphoto2 libraw libftdi1 libdc1394 ffmpeg fftw + limesuite ] ++ lib.optionals withFirmware [ firmware ]; postPatch = '' - for f in indi-qsi/CMakeLists.txt \ - indi-dsi/CMakeLists.txt \ - indi-armadillo-platypus/CMakeLists.txt \ - indi-orion-ssg3/CMakeLists.txt - do + for f in $(find . -name "CMakeLists.txt"); do substituteInPlace $f \ --replace "/lib/udev/rules.d" "lib/udev/rules.d" \ --replace "/etc/udev/rules.d" "lib/udev/rules.d" \ --replace "/lib/firmware" "lib/firmware" done + substituteInPlace libpktriggercord/CMakeLists.txt \ + --replace "set (PK_DATADIR /usr/share/pktriggercord)" "set (PK_DATADIR $out/share/pkgtriggercord)" + sed '1i#include <ctime>' -i indi-duino/libfirmata/src/firmata.cpp # gcc12 ''; @@ -57,11 +58,8 @@ stdenv.mkDerivation rec { "-DCMAKE_INSTALL_LIBDIR=lib" "-DUDEVRULES_INSTALL_DIR=lib/udev/rules.d" "-DRULES_INSTALL_DIR=lib/udev/rules.d" - # Pentax, Atik, and SX cmakelists are currently broken - "-DWITH_PENTAX=off" - "-DWITH_ATIK=off" - "-DWITH_SX=off" ] ++ lib.optionals (!withFirmware) [ + "-DWITH_ATIK=off" "-DWITH_APOGEE=off" "-DWITH_DSI=off" "-DWITH_QHY=off" @@ -75,7 +73,7 @@ stdenv.mkDerivation rec { description = "Third party drivers for the INDI astronomical software suite"; changelog = "https://github.com/indilib/indi-3rdparty/releases/tag/v${version}"; license = licenses.lgpl2Plus; - maintainers = with maintainers; [ hjones2199 ]; + maintainers = with maintainers; [ hjones2199 sheepforce ]; platforms = platforms.linux; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-firmware.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-firmware.nix index 660433c2dd59..7875051cbf79 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-firmware.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-firmware.nix @@ -19,6 +19,7 @@ , ffmpeg , version , src +, autoPatchelfHook }: stdenv.mkDerivation rec { @@ -26,7 +27,7 @@ stdenv.mkDerivation rec { inherit version src; - nativeBuildInputs = [ cmake ]; + nativeBuildInputs = [ cmake autoPatchelfHook ]; buildInputs = [ indilib libnova curl cfitsio libusb1 zlib boost gsl gpsd @@ -60,7 +61,7 @@ stdenv.mkDerivation rec { description = "Third party firmware for the INDI astronomical software suite"; changelog = "https://github.com/indilib/indi-3rdparty/releases/tag/v${version}"; license = licenses.lgpl2Plus; - maintainers = with maintainers; [ hjones2199 ]; + maintainers = with maintainers; [ hjones2199 sheepforce ]; platforms = platforms.linux; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-full.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-full.nix index fae8b95cb28c..6b110a152ee3 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-full.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/indilib/indi-full.nix @@ -1,30 +1,29 @@ { stdenv, lib, callPackage, fetchFromGitHub, indilib }: let - indi-version = "1.9.8"; + inherit (indilib) version; indi-3rdparty-src = fetchFromGitHub { owner = "indilib"; repo = "indi-3rdparty"; - rev = "v${indi-version}"; - sha256 = "sha256-ZFbMyjMvAWcdsl+1TyX5/v5nY1DqvhZ2ckFBDe8gdQg="; + rev = "v${version}"; + hash = "sha256-xAGSFTOfO9P8JldzY59OnQULzf2Mlx3vWjoP+IDdEFE="; }; indi-firmware = callPackage ./indi-firmware.nix { - version = indi-version; + inherit version; src = indi-3rdparty-src; }; indi-3rdparty = callPackage ./indi-3rdparty.nix { - version = indi-version; + inherit version; src = indi-3rdparty-src; - withFirmware = stdenv.isx86_64; + withFirmware = stdenv.isx86_64 || stdenv.isAarch64; firmware = indi-firmware; }; in callPackage ./indi-with-drivers.nix { pname = "indi-full"; - version = indi-version; + inherit version; extraDrivers = [ indi-3rdparty - ] ++ lib.optionals stdenv.isx86_64 [ - indi-firmware - ]; + ] ++ lib.optional (stdenv.isx86_64 || stdenv.isAarch64) indi-firmware + ; } diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/0001-Fix-pkg-config-paths.patch b/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/0001-Fix-pkg-config-paths.patch new file mode 100644 index 000000000000..c26a2bbc8814 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/0001-Fix-pkg-config-paths.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Benes <nbenes.gh@xandea.de> +Date: Mon, 22 May 2023 09:25:27 +0200 +Subject: [PATCH] Fix pkg-config paths + + +diff --git a/libxisf.pc.in b/libxisf.pc.in +index b0b8b53..944b068 100644 +--- a/libxisf.pc.in ++++ b/libxisf.pc.in +@@ -1,7 +1,7 @@ + prefix="@CMAKE_INSTALL_PREFIX@" + exec_prefix="${prefix}" +-libdir="${exec_prefix}/@CMAKE_INSTALL_LIBDIR@" +-includedir="${prefix}/@CMAKE_INSTALL_INCLUDEDIR@" ++libdir="@CMAKE_INSTALL_FULL_LIBDIR@" ++includedir="@CMAKE_INSTALL_FULL_INCLUDEDIR@" + + Name: @PROJECT_NAME@ + Description: @CMAKE_PROJECT_DESCRIPTION@ +-- +2.38.5 + diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/default.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/default.nix index e7e4bc98b0d8..a1fcd4da7b3d 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/libxisf/default.nix @@ -10,16 +10,20 @@ stdenv.mkDerivation (finalAttrs: { pname = "libxisf"; - version = "0.2.3"; + version = "0.2.8"; src = fetchFromGitea { domain = "gitea.nouspiro.space"; owner = "nou"; repo = "libXISF"; rev = "v${finalAttrs.version}"; - hash = "sha256-u5EYnRO2rUV8ofLL9qfACeVvVbWXEXpkqh2Q4OOxpaQ="; + hash = "sha256-YB97vMz2+cFRYq8x2Su3Eh952U6kGIVLYV7kDEd5S8g="; }; + patches = [ + ./0001-Fix-pkg-config-paths.patch + ]; + nativeBuildInputs = [ cmake pkg-config diff --git a/nixpkgs/pkgs/development/libraries/science/astronomy/wcslib/default.nix b/nixpkgs/pkgs/development/libraries/science/astronomy/wcslib/default.nix index bea05468cedc..7c648ecba754 100644 --- a/nixpkgs/pkgs/development/libraries/science/astronomy/wcslib/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/astronomy/wcslib/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "wcslib"; - version = "7.12"; + version = "8.1"; src = fetchurl { url = "ftp://ftp.atnf.csiro.au/pub/software/wcslib/${pname}-${version}.tar.bz2"; - sha256 = "sha256-nPjeUOEJqX+gRRHUER6NFL0KRAdxMqz3PmzwAp/pa9Q="; + sha256 = "sha256-K/I+b6vRC4rs/6VEMb8lqiJP8BnGCp5naqVlYfm0Ep4="; }; nativeBuildInputs = [ flex ]; diff --git a/nixpkgs/pkgs/development/libraries/science/biology/bpp-core/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/bpp-core/default.nix index 102cae24adb9..953fe50a4b03 100644 --- a/nixpkgs/pkgs/development/libraries/science/biology/bpp-core/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/biology/bpp-core/default.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { doCheck = !stdenv.isDarwin; meta = with lib; { - homepage = "http://biopp.univ-montp2.fr/wiki/index.php/Main_Page"; + homepage = "https://github.com/BioPP/bpp-core"; changelog = "https://github.com/BioPP/bpp-core/blob/master/ChangeLog"; description = "C++ bioinformatics libraries and tools"; maintainers = with maintainers; [ bcdarwin ]; diff --git a/nixpkgs/pkgs/development/libraries/science/biology/bpp-phyl/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/bpp-phyl/default.nix index c11b49aa57eb..0b18dbfcf19a 100644 --- a/nixpkgs/pkgs/development/libraries/science/biology/bpp-phyl/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/biology/bpp-phyl/default.nix @@ -23,6 +23,7 @@ stdenv.mkDerivation rec { doCheck = !stdenv.isDarwin; meta = bpp-core.meta // { + homepage = "https://github.com/BioPP/bpp-phyl"; changelog = "https://github.com/BioPP/bpp-phyl/blob/master/ChangeLog"; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/biology/bpp-popgen/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/bpp-popgen/default.nix index 4b9a62eb762b..2cb89b4bbd38 100644 --- a/nixpkgs/pkgs/development/libraries/science/biology/bpp-popgen/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/biology/bpp-popgen/default.nix @@ -26,6 +26,7 @@ stdenv.mkDerivation rec { doCheck = !stdenv.isDarwin; meta = bpp-core.meta // { + homepage = "https://github.com/BioPP/bpp-popgen"; changelog = "https://github.com/BioPP/bpp-popgen/blob/master/ChangeLog"; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/biology/bpp-seq/default.nix b/nixpkgs/pkgs/development/libraries/science/biology/bpp-seq/default.nix index 7981fb28ac09..2f6fbf9e362c 100644 --- a/nixpkgs/pkgs/development/libraries/science/biology/bpp-seq/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/biology/bpp-seq/default.nix @@ -26,6 +26,7 @@ stdenv.mkDerivation rec { doCheck = !stdenv.isDarwin; meta = bpp-core.meta // { + homepage = "https://github.com/BioPP/bpp-seq"; changelog = "https://github.com/BioPP/bpp-seq/blob/master/ChangeLog"; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/openmm/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/openmm/default.nix index 2ad84249758a..a7c388339de0 100644 --- a/nixpkgs/pkgs/development/libraries/science/chemistry/openmm/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/openmm/default.nix @@ -11,7 +11,8 @@ , enableOpencl ? true , opencl-headers , ocl-icd -, enableCuda ? false +, config +, enableCuda ? config.cudaSupport , cudaPackages , addOpenGLRunpath }: diff --git a/nixpkgs/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix b/nixpkgs/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix index 57139f8bcd00..1f5e4b250a91 100644 --- a/nixpkgs/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/chemistry/simple-dftd3/default.nix @@ -13,13 +13,13 @@ assert !blas.isILP64; stdenv.mkDerivation rec { pname = "simple-dftd3"; - version = "0.7.0"; + version = "1.0.0"; src = fetchFromGitHub { owner = "dftd3"; repo = pname; rev = "v${version}"; - hash = "sha256-5OvmMgjD8ujjKHkuw4NT8hEXKh5YPxuBl/Mu6g2/KIA="; + hash = "sha256-dfXiKKCGJ69aExSKpVC3Bp//COy256R9PDyxCNmDsfo="; }; nativeBuildInputs = [ cmake gfortran ]; diff --git a/nixpkgs/pkgs/development/libraries/science/electronics/coloquinte/default.nix b/nixpkgs/pkgs/development/libraries/science/electronics/coloquinte/default.nix new file mode 100644 index 000000000000..6946080c100e --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/science/electronics/coloquinte/default.nix @@ -0,0 +1,38 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, lemon-graph +, eigen +, boost +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "coloquinte"; + version = "0.3.1"; + + src = fetchFromGitHub { + owner = "coloquinte"; + repo = "PlaceRoute"; + rev = finalAttrs.version; + hash = "sha256-bPDXaNZCNBM0qiu+46cL/zH/41lwqHPqfqTzJaERgVQ="; + }; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + lemon-graph + eigen + boost + ]; + + meta = { + description = "Placement library for electronic circuits"; + homepage = "https://github.com/Coloquinte/PlaceRoute"; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.coloquinte ]; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/science/math/clblast/default.nix b/nixpkgs/pkgs/development/libraries/science/math/clblast/default.nix index 281076caba9f..23d749f1b297 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/clblast/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/clblast/default.nix @@ -9,13 +9,13 @@ stdenv.mkDerivation rec { pname = "clblast"; - version = "1.6.0"; + version = "1.6.1"; src = fetchFromGitHub { owner = "CNugteren"; repo = "CLBlast"; rev = version; - hash = "sha256-eRwSfP6p0+9yql7TiXZsExRMcnnBLXXW2hh1JliYU2I="; + hash = "sha256-1ddjmoLhFoLi/z2cae0HZidUTySsZQDk1T8MVPTbfi4="; }; nativeBuildInputs = [ diff --git a/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix b/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix index cdfa924b2242..e0a6ffd9d547 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/cudnn/generic.nix @@ -94,6 +94,7 @@ in # Without --add-needed autoPatchelf forgets $ORIGIN on cuda>=8.0.5. postFixup = strings.optionalString (strings.versionAtLeast versionTriple "8.0.5") '' patchelf $out/lib/libcudnn.so --add-needed libcudnn_cnn_infer.so + patchelf $out/lib/libcudnn_ops_infer.so --add-needed libcublas.so --add-needed libcublasLt.so ''; passthru = { diff --git a/nixpkgs/pkgs/development/libraries/science/math/dbcsr/default.nix b/nixpkgs/pkgs/development/libraries/science/math/dbcsr/default.nix index 2175d1343856..5a9d3c5066cc 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/dbcsr/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/dbcsr/default.nix @@ -15,13 +15,13 @@ stdenv.mkDerivation rec { pname = "dbcsr"; - version = "2.5.0"; + version = "2.6.0"; src = fetchFromGitHub { owner = "cp2k"; repo = "dbcsr"; rev = "v${version}"; - hash = "sha256-GGClK3heGE3zUM0R+u58vRdAK+xWzaqdCHaMIDerHSI="; + hash = "sha256-+xSxfrzsxBdb424F/3mIETleEPoETxU0LB0OBJrR7gw="; }; postPatch = '' diff --git a/nixpkgs/pkgs/development/libraries/science/math/faiss/default.nix b/nixpkgs/pkgs/development/libraries/science/math/faiss/default.nix index d67f31375e7d..21e6cbf858cd 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/faiss/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/faiss/default.nix @@ -5,7 +5,7 @@ , stdenv , cmake , cudaPackages ? { } -, cudaSupport ? config.cudaSupport or false +, cudaSupport ? config.cudaSupport , nvidia-thrust , useThrustSourceBuild ? true , pythonSupport ? true diff --git a/nixpkgs/pkgs/development/libraries/science/math/lrs/default.nix b/nixpkgs/pkgs/development/libraries/science/math/lrs/default.nix index ae5beb0f09e6..6fa8567355a9 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/lrs/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/lrs/default.nix @@ -1,6 +1,6 @@ -{lib, stdenv, fetchurl, gmp}: +{ lib, stdenv, fetchurl, gmp }: -stdenv.mkDerivation rec { +stdenv.mkDerivation { pname = "lrs"; version = "7.2"; @@ -11,14 +11,15 @@ stdenv.mkDerivation rec { buildInputs = [ gmp ]; - preBuild = '' - export makeFlags="$makeFlags prefix=$out"; - ''; + makeFlags = [ + "prefix=${placeholder "out"}" + "CC:=$(CC)" + ]; meta = { description = "Implementation of the reverse search algorithm for vertex enumeration/convex hull problems"; - license = lib.licenses.gpl2 ; - maintainers = [lib.maintainers.raskin]; + license = lib.licenses.gpl2; + maintainers = [ lib.maintainers.raskin ]; platforms = lib.platforms.linux; homepage = "http://cgm.cs.mcgill.ca/~avis/C/lrs.html"; }; diff --git a/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix b/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix index 49efda96829c..04f263568ce6 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/magma/generic.nix @@ -28,6 +28,7 @@ , ninja , openmp , rocmSupport ? false +, static ? false , stdenv , symlinkJoin }: @@ -85,29 +86,6 @@ let # "75" -> "750" Cf. https://bitbucket.org/icl/magma/src/f4ec79e2c13a2347eff8a77a3be6f83bc2daec20/CMakeLists.txt#lines-273 "${minArch'}0"; - cuda-common-redist = with cudaPackages; [ - libcublas # cublas_v2.h - libcusparse # cusparse.h - ]; - - # Build-time dependencies - cuda-native-redist = symlinkJoin { - name = "cuda-native-redist-${cudaVersion}"; - paths = with cudaPackages; [ - cuda_cudart # cuda_runtime.h - cuda_nvcc - ] ++ lists.optionals (strings.versionOlder cudaVersion "11.8") [ - cuda_nvprof # <cuda_profiler_api.h> - ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [ - cuda_profiler_api # <cuda_profiler_api.h> - ] ++ cuda-common-redist; - }; - - # Run-time dependencies - cuda-redist = symlinkJoin { - name = "cuda-redist-${cudaVersion}"; - paths = cuda-common-redist; - }; in assert (builtins.match "[^[:space:]]*" gpuTargetString) != null; @@ -127,16 +105,22 @@ stdenv.mkDerivation { ninja gfortran ] ++ lists.optionals cudaSupport [ - cuda-native-redist + cudaPackages.cuda_nvcc ]; buildInputs = [ libpthreadstubs lapack blas - ] ++ lists.optionals cudaSupport [ - cuda-redist - ] ++ lists.optionals rocmSupport [ + ] ++ lists.optionals cudaSupport (with cudaPackages; [ + cuda_cudart + libcublas # cublas_v2.h + libcusparse # cusparse.h + ] ++ lists.optionals (strings.versionOlder cudaVersion "11.8") [ + cuda_nvprof # <cuda_profiler_api.h> + ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [ + cuda_profiler_api # <cuda_profiler_api.h> + ]) ++ lists.optionals rocmSupport [ hip hipblas hipsparse @@ -145,6 +129,8 @@ stdenv.mkDerivation { cmakeFlags = [ "-DGPU_TARGET=${gpuTargetString}" + ] ++ lists.optionals static [ + "-DBUILD_SHARED_LIBS=OFF" ] ++ lists.optionals cudaSupport [ "-DCMAKE_CUDA_ARCHITECTURES=${cudaArchitecturesString}" "-DMIN_ARCH=${minArch}" # Disarms magma's asserts diff --git a/nixpkgs/pkgs/development/libraries/science/math/mongoose/default.nix b/nixpkgs/pkgs/development/libraries/science/math/mongoose/default.nix index e48658b19b82..691140dbf847 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/mongoose/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/mongoose/default.nix @@ -1,17 +1,16 @@ { lib , stdenv , fetchFromGitHub -, fetchpatch , cmake , blas }: let - suitesparseVersion = "7.0.1"; + suitesparseVersion = "7.1.0"; in -stdenv.mkDerivation rec { +stdenv.mkDerivation { pname = "mongoose"; - version = "3.0.4"; + version = "3.0.5"; outputs = [ "bin" "out" "dev" ]; @@ -19,7 +18,7 @@ stdenv.mkDerivation rec { owner = "DrTimothyAldenDavis"; repo = "SuiteSparse"; rev = "v${suitesparseVersion}"; - hash = "sha256-EIreweeOx44YDxlnxnJ7l31Ie1jSx6y87VAyEX+4NsQ="; + hash = "sha256-UizybioU1J01PLBpu+PfnSzWScGTvMuJN5j9PjuZRwE="; }; nativeBuildInputs = [ diff --git a/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix b/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix index 06494a1dddcb..6589fc0b9b64 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/petsc/default.nix @@ -18,11 +18,11 @@ assert petsc-withp4est -> p4est.mpiSupport; stdenv.mkDerivation rec { pname = "petsc"; - version = "3.19.1"; + version = "3.19.2"; src = fetchurl { url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${version}.tar.gz"; - sha256 = "sha256-dNtgxTyAtI1cOeB7w5qIPsztiLnySl3hfPb0hakD4SA="; + sha256 = "sha256-EU82P3ebsWg5slwOcPiwrg2UfVDnL3xs3csRsAEHmxY="; }; mpiSupport = !withp4est || p4est.mpiSupport; diff --git a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix index 95eeaeb8abf3..cbc24b154656 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/4.4.nix @@ -1,5 +1,6 @@ { lib, stdenv, fetchurl, gfortran, blas, lapack -, enableCuda ? false, cudatoolkit +, config +, enableCuda ? config.cudaSupport, cudatoolkit }: let diff --git a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix index 51b55592d42e..67dfef186e7d 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -6,7 +6,8 @@ , fixDarwinDylibNames , gmp , mpfr -, enableCuda ? false +, config +, enableCuda ? config.cudaSupport , cudatoolkit }: diff --git a/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix b/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix index 3426b0149ae0..1ac08ce0cd2f 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/tensorflow-lite/default.nix @@ -1,203 +1,104 @@ { stdenv , bash -, abseil-cpp +, buildPackages +, buildBazelPackage , fetchFromGitHub -, fetchFromGitLab -, fetchpatch -, fetchurl -, flatbuffers , lib -, zlib }: let - tflite-eigen = fetchFromGitLab { - owner = "libeigen"; - repo = "eigen"; - rev = "3d9051ea84a5089b277c88dac456b3b1576bfa7f"; - sha256 = "1y3f2jvimb5i904f4n37h23cv2pkdlbz8656s0kga1y7c0p50wif"; - }; - - gemmlowp-src = fetchFromGitHub { - owner = "google"; - repo = "gemmlowp"; - rev = "fda83bdc38b118cc6b56753bd540caa49e570745"; - sha256 = "1sbp8kmr2azwlvfbzryy1frxi99jhsh1nc93bdbxdf8zdgpv0kxl"; - }; - - neon-2-sse-src = fetchFromGitHub { - owner = "intel"; - repo = "ARM_NEON_2_x86_SSE"; - rev = "1200fe90bb174a6224a525ee60148671a786a71f"; - sha256 = "0fhxch711ck809dpq1myxz63jiiwfcnxvj45ww0kg8s0pqpn5kv6"; - }; - - farmhash-src = fetchFromGitHub { - owner = "google"; - repo = "farmhash"; - rev = "816a4ae622e964763ca0862d9dbd19324a1eaf45"; - sha256 = "1mqxsljq476n1hb8ilkrpb39yz3ip2hnc7rhzszz4sri8ma7qzp6"; - }; - - fft2d-src = fetchurl { - url = "http://www.kurims.kyoto-u.ac.jp/~ooura/fft2d.tgz"; - sha256 = "ada7e99087c4ed477bfdf11413f2ba8db8a840ba9bbf8ac94f4f3972e2a7cec9"; - }; - - fp16-src = fetchFromGitHub { - owner = "Maratyszcza"; - repo = "FP16"; - rev = "4dfe081cf6bcd15db339cf2680b9281b8451eeb3"; - sha256 = "06a8dfl3a29r93nxpp6hpywsajz5d555n3sqd3i6krybb6swnvh7"; - }; - - ruy-src = fetchFromGitHub { - owner = "google"; - repo = "ruy"; - rev = "23633b37099b614a2f836ef012cafc8087fdb98c"; - sha256 = "14k9hz6ss8qy8nsajk6lrq25f6qxrldxky31ijw0dpqnfnnswrx4"; - }; - - cpuinfo-src = fetchFromGitHub { - owner = "pytorch"; - repo = "cpuinfo"; - rev = "5916273f79a21551890fd3d56fc5375a78d1598d"; - sha256 = "0q6760xdxsg18acdv8vq3yrq7ksr7wsm8zbyan01zf2khnb6fw4x"; + buildPlatform = stdenv.buildPlatform; + hostPlatform = stdenv.hostPlatform; + pythonEnv = buildPackages.python3.withPackages (ps: [ ps.numpy ]); + bazelDepsSha256ByBuildAndHost = { + x86_64-linux = { + x86_64-linux = "sha256-61qmnAB80syYhURWYJOiOnoGOtNa1pPkxfznrFScPAo="; + aarch64-linux = "sha256-sOIYpp98wJRz3RGvPasyNEJ05W29913Lsm+oi/aq/Ag="; + }; + aarch64-linux = { + aarch64-linux = "sha256-MJU4y9Dt9xJWKgw7iKW+9Ur856rMIHeFD5u05s+Q7rQ="; + }; }; + bazelHostConfigName.aarch64-linux = "elinux_aarch64"; + bazelDepsSha256ByHost = + bazelDepsSha256ByBuildAndHost.${buildPlatform.system} or + (throw "unsupported build system ${buildPlatform.system}"); + bazelDepsSha256 = bazelDepsSha256ByHost.${hostPlatform.system} or + (throw "unsupported host system ${hostPlatform.system} with build system ${buildPlatform.system}"); in -stdenv.mkDerivation rec { - pname = "tensorflow-lite"; - version = "2.5.0"; +buildBazelPackage rec { + name = "tensorflow-lite"; + version = "2.13.0"; src = fetchFromGitHub { owner = "tensorflow"; repo = "tensorflow"; rev = "v${version}"; - sha256 = "1jdw2i1rq06zqd6aabh7bbm0avsg4pygnfmd7gviv0blhih9054l"; + hash = "sha256-Rq5pAVmxlWBVnph20fkAwbfy+iuBNlfFy14poDPd5h0="; }; - patches = [ - # TODO: remove on the next version bump - (fetchpatch { - name = "include-schema-conversion-utils-source.patch"; - url = "https://github.com/tensorflow/tensorflow/commit/f3c4f4733692150fd6174f2cd16438cfaba2e5ab.patch"; - sha256 = "0zx4hbz679kn79f30159rl1mq74dg45cvaawii0cyv48z472yy4k"; - }) - # TODO: remove on the next version bump - (fetchpatch { - name = "cxxstandard-var.patch"; - url = "https://github.com/tensorflow/tensorflow/commit/9b128ae4200e10b4752f903492d1e7d11957ed5c.patch"; - sha256 = "1q0izdwdji5fbyqll6k4dmkzfykyvvz5cvc6hysdj285nkn2wy6h"; - }) + bazel = buildPackages.bazel_5; + + nativeBuildInputs = [ pythonEnv buildPackages.perl ]; + + bazelTargets = [ + "//tensorflow/lite:libtensorflowlite.so" + "//tensorflow/lite/c:tensorflowlite_c" + "//tensorflow/lite/tools/benchmark:benchmark_model" + "//tensorflow/lite/tools/benchmark:benchmark_model_performance_options" ]; - buildInputs = [ zlib flatbuffers ]; + bazelFlags = [ + "--config=opt" + ] ++ lib.optionals (hostPlatform.system != buildPlatform.system) [ + "--config=${bazelHostConfigName.${hostPlatform.system}}" + ]; - dontConfigure = true; + bazelBuildFlags = [ "--cxxopt=--std=c++17" ]; - postPatch = '' - substituteInPlace ./tensorflow/lite/tools/make/Makefile \ - --replace /bin/bash ${bash}/bin/bash \ - --replace /bin/sh ${bash}/bin/sh - ''; + buildAttrs = { + installPhase = '' + mkdir -p $out/{bin,lib} + + # copy the libs and binaries into the output dir + cp ./bazel-bin/tensorflow/lite/c/libtensorflowlite_c.so $out/lib + cp ./bazel-bin/tensorflow/lite/libtensorflowlite.so $out/lib + cp ./bazel-bin/tensorflow/lite/tools/benchmark/benchmark_model $out/bin + cp ./bazel-bin/tensorflow/lite/tools/benchmark/benchmark_model_performance_options $out/bin - makefile = "tensorflow/lite/tools/make/Makefile"; - - preBuild = - let - includes = - lib.concatMapStringsSep - " " - (subdir: "-I $PWD/tensorflow/lite/tools/make/downloads/${subdir}") - [ - "neon_2_sse" - "gemmlowp" - "absl" - "fp16/include" - "farmhash/src" - "ruy" - "cpuinfo" - "cpuinfo/src" - "cpuinfo/include" - "cpuinfo/deps/clog/include" - "eigen" - ]; - in - '' - # enter the vendoring lair of doom - - prefix="$PWD/tensorflow/lite/tools/make/downloads" - - mkdir -p "$prefix" - - tar xzf ${fft2d-src} -C "$prefix" - - ln -s ${ruy-src} "$prefix/ruy" - ln -s ${gemmlowp-src} "$prefix/gemmlowp" - ln -s ${neon-2-sse-src} "$prefix/neon_2_sse" - ln -s ${farmhash-src} "$prefix/farmhash" - ln -s ${cpuinfo-src} "$prefix/cpuinfo" - ln -s ${fp16-src} "$prefix/fp16" - ln -s ${tflite-eigen} "$prefix/eigen" - - # tensorflow lite is using the *source* of flatbuffers - ln -s ${flatbuffers.src} "$prefix/flatbuffers" - - # tensorflow lite expects to compile abseil into `libtensorflow-lite.a` - ln -s ${abseil-cpp.src} "$prefix/absl" - - # set CXXSTANDARD=c++17 here because abseil-cpp in nixpkgs is set as - # such and would be used in dependents like libedgetpu - buildFlagsArray+=( - INCLUDES="-I $PWD ${includes}" - CXXSTANDARD="-std=c++17" - TARGET_TOOLCHAIN_PREFIX="" - -j$NIX_BUILD_CORES - all) + find . -type f -name '*.h' | while read f; do + path="$out/include/''${f/.\//}" + install -D "$f" "$path" + + # remove executable bit from headers + chmod -x "$path" + done ''; + }; + + fetchAttrs.sha256 = bazelDepsSha256; - installPhase = '' - mkdir "$out" + PYTHON_BIN_PATH = pythonEnv.interpreter; - # copy the static lib and binaries into the output dir - cp -r ./tensorflow/lite/tools/make/gen/linux_${stdenv.hostPlatform.uname.processor}/{bin,lib} "$out" + dontAddBazelOpts = true; + removeRulesCC = false; - find ./tensorflow/lite -type f -name '*.h' | while read f; do - path="$out/include/''${f/.\//}" - install -D "$f" "$path" + postPatch = '' + rm .bazelversion + ''; - # remove executable bit from headers - chmod -x "$path" - done + preConfigure = '' + patchShebangs configure ''; + # configure script freaks out when parameters are passed + dontAddPrefix = true; + configurePlatforms = []; + meta = with lib; { description = "An open source deep learning framework for on-device inference."; homepage = "https://www.tensorflow.org/lite"; license = licenses.asl20; - maintainers = with maintainers; [ cpcloud ]; + maintainers = with maintainers; [ mschwaig cpcloud ]; platforms = [ "x86_64-linux" "aarch64-linux" ]; - knownVulnerabilities = [ - # at least some of - "CVE-2023-27579" - "CVE-2023-25801" - "CVE-2023-25676" - "CVE-2023-25675" - "CVE-2023-25674" - "CVE-2023-25673" - "CVE-2023-25671" - "CVE-2023-25670" - "CVE-2023-25669" - "CVE-2023-25668" - "CVE-2023-25667" - "CVE-2023-25665" - "CVE-2023-25666" - "CVE-2023-25664" - "CVE-2023-25663" - "CVE-2023-25662" - "CVE-2023-25660" - "CVE-2023-25659" - "CVE-2023-25658" - # and many many more - ]; }; } diff --git a/nixpkgs/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix b/nixpkgs/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix index ef501dfd09a0..d046c6864539 100644 --- a/nixpkgs/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/math/tiny-cuda-nn/default.nix @@ -1,20 +1,20 @@ -{ cmake -, cudaPackages -, fetchFromGitHub -, lib -, ninja -, pkgs -, python3Packages ? { } -, pythonSupport ? false -, stdenv -, symlinkJoin -, which -}: -let +{ + cmake, + cudaPackages, + fetchFromGitHub, + lib, + ninja, + python3Packages ? {}, + pythonSupport ? false, + stdenv, + symlinkJoin, + which, +}: let inherit (lib) lists strings; inherit (cudaPackages) backendStdenv cudaFlags; cuda-common-redist = with cudaPackages; [ + cuda_cudart # cuda_runtime.h libcublas # cublas_v2.h libcusolver # cusolverDn.h libcusparse # cusparse.h @@ -22,10 +22,9 @@ let cuda-native-redist = symlinkJoin { name = "cuda-redist"; - paths = with cudaPackages; [ - cuda_cudart # cuda_runtime.h - cuda_nvcc - ] ++ cuda-common-redist; + paths = with cudaPackages; + [cuda_nvcc] + ++ cuda-common-redist; }; cuda-redist = symlinkJoin { @@ -33,120 +32,127 @@ let paths = cuda-common-redist; }; in -stdenv.mkDerivation (finalAttrs: { - name = "tiny-cuda-nn"; - version = "1.6"; - - format = strings.optionalString pythonSupport "setuptools"; - - src = fetchFromGitHub { - owner = "NVlabs"; - repo = finalAttrs.name; - rev = "v${finalAttrs.version}"; - fetchSubmodules = true; - hash = "sha256-qW6Fk2GB71fvZSsfu+mykabSxEKvaikZ/pQQZUycOy0="; - }; - - nativeBuildInputs = [ - cmake - cuda-native-redist - ninja - which - ] ++ lists.optionals pythonSupport (with python3Packages; [ - pip - setuptools - wheel - ]); - - buildInputs = [ - cuda-redist - ] ++ lib.optionals pythonSupport ( - with python3Packages; [ - pybind11 - python - ] - ); - - propagatedBuildInputs = lib.optionals pythonSupport ( - with python3Packages; [ - torch - ] - ); - - # NOTE: We cannot use pythonImportsCheck for this module because it uses torch to immediately - # initailize CUDA and GPU access is not allowed in the nix build environment. - # NOTE: There are no tests for the C++ library or the python bindings, so we just skip the check - # phase -- we're not missing anything. - doCheck = false; - - preConfigure = '' - export TCNN_CUDA_ARCHITECTURES=${ - strings.concatStringsSep ";" (lists.map cudaFlags.dropDot cudaFlags.cudaCapabilities) - } - export CUDA_HOME=${cuda-native-redist} - export LIBRARY_PATH=${cuda-native-redist}/lib/stubs:$LIBRARY_PATH - export CC=${backendStdenv.cc}/bin/cc - export CXX=${backendStdenv.cc}/bin/c++ - ''; - - # When building the python bindings, we cannot re-use the artifacts from the C++ build so we - # skip the CMake confurePhase and the buildPhase. - dontUseCmakeConfigure = pythonSupport; - - # The configurePhase usually puts you in the build directory, so for the python bindings we - # need to change directories to the source directory. - configurePhase = strings.optionalString pythonSupport '' - runHook preConfigure - mkdir -p $NIX_BUILD_TOP/build - cd $NIX_BUILD_TOP/build - runHook postConfigure - ''; - - buildPhase = strings.optionalString pythonSupport '' - runHook preBuild - python -m pip wheel \ - --no-build-isolation \ - --no-clean \ - --no-deps \ - --no-index \ - --verbose \ - --wheel-dir $NIX_BUILD_TOP/build \ - $NIX_BUILD_TOP/source/bindings/torch - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - mkdir -p $out/lib - '' - # Installing the C++ library just requires copying the static library to the output directory - + strings.optionalString (!pythonSupport) '' - cp libtiny-cuda-nn.a $out/lib/ - '' - # Installing the python bindings requires building the wheel and installing it - + strings.optionalString pythonSupport '' - python -m pip install \ - --no-build-isolation \ - --no-cache-dir \ - --no-deps \ - --no-index \ - --no-warn-script-location \ - --prefix="$out" \ - --verbose \ - ./*.whl - '' + '' - runHook postInstall - ''; - - passthru = { - inherit cudaPackages; - }; - - meta = with lib; { - description = "Lightning fast C++/CUDA neural network framework"; - homepage = "https://github.com/NVlabs/tiny-cuda-nn"; - license = licenses.bsd3; - maintainers = with maintainers; [ connorbaker ]; - platforms = platforms.linux; - }; -}) + stdenv.mkDerivation (finalAttrs: { + pname = "tiny-cuda-nn"; + version = "1.6"; + strictDeps = true; + + format = strings.optionalString pythonSupport "setuptools"; + + src = fetchFromGitHub { + owner = "NVlabs"; + repo = finalAttrs.pname; + rev = "v${finalAttrs.version}"; + fetchSubmodules = true; + hash = "sha256-qW6Fk2GB71fvZSsfu+mykabSxEKvaikZ/pQQZUycOy0="; + }; + + nativeBuildInputs = + [ + cmake + cuda-native-redist + ninja + which + ] + ++ lists.optionals pythonSupport (with python3Packages; [ + pip + setuptools + wheel + ]); + + buildInputs = + [ + cuda-redist + ] + ++ lib.optionals pythonSupport ( + with python3Packages; [ + pybind11 + python + ] + ); + + propagatedBuildInputs = lib.optionals pythonSupport ( + with python3Packages; [ + torch + ] + ); + + # NOTE: We cannot use pythonImportsCheck for this module because it uses torch to immediately + # initailize CUDA and GPU access is not allowed in the nix build environment. + # NOTE: There are no tests for the C++ library or the python bindings, so we just skip the check + # phase -- we're not missing anything. + doCheck = false; + + preConfigure = '' + export TCNN_CUDA_ARCHITECTURES="${ + strings.concatStringsSep ";" (lists.map cudaFlags.dropDot cudaFlags.cudaCapabilities) + }" + export CUDA_HOME="${cuda-native-redist}" + export LIBRARY_PATH="${cuda-native-redist}/lib/stubs:$LIBRARY_PATH" + export CC="${backendStdenv.cc}/bin/cc" + export CXX="${backendStdenv.cc}/bin/c++" + ''; + + # When building the python bindings, we cannot re-use the artifacts from the C++ build so we + # skip the CMake confurePhase and the buildPhase. + dontUseCmakeConfigure = pythonSupport; + + # The configurePhase usually puts you in the build directory, so for the python bindings we + # need to change directories to the source directory. + configurePhase = strings.optionalString pythonSupport '' + runHook preConfigure + mkdir -p "$NIX_BUILD_TOP/build" + cd "$NIX_BUILD_TOP/build" + runHook postConfigure + ''; + + buildPhase = strings.optionalString pythonSupport '' + runHook preBuild + python -m pip wheel \ + --no-build-isolation \ + --no-clean \ + --no-deps \ + --no-index \ + --verbose \ + --wheel-dir "$NIX_BUILD_TOP/build" \ + "$NIX_BUILD_TOP/source/bindings/torch" + runHook postBuild + ''; + + installPhase = + '' + runHook preInstall + mkdir -p "$out/lib" + '' + # Installing the C++ library just requires copying the static library to the output directory + + strings.optionalString (!pythonSupport) '' + cp libtiny-cuda-nn.a "$out/lib/" + '' + # Installing the python bindings requires building the wheel and installing it + + strings.optionalString pythonSupport '' + python -m pip install \ + --no-build-isolation \ + --no-cache-dir \ + --no-deps \ + --no-index \ + --no-warn-script-location \ + --prefix="$out" \ + --verbose \ + ./*.whl + '' + + '' + runHook postInstall + ''; + + passthru = { + inherit cudaPackages; + }; + + meta = with lib; { + description = "Lightning fast C++/CUDA neural network framework"; + homepage = "https://github.com/NVlabs/tiny-cuda-nn"; + license = licenses.bsd3; + maintainers = with maintainers; [connorbaker]; + platforms = platforms.linux; + }; + }) diff --git a/nixpkgs/pkgs/development/libraries/science/networking/ns-3/default.nix b/nixpkgs/pkgs/development/libraries/science/networking/ns-3/default.nix index 0eba41234fd5..f515253026b8 100644 --- a/nixpkgs/pkgs/development/libraries/science/networking/ns-3/default.nix +++ b/nixpkgs/pkgs/development/libraries/science/networking/ns-3/default.nix @@ -1,77 +1,108 @@ { stdenv +, breakpointHook , fetchFromGitLab , python -, wafHook +, libxml2 +, sqlite -# for binding generation -, castxml ? null +, boost +, gtk3-x11 +, root +, glib +, gsl -# can take a long time, generates > 30000 images/graphs -, enableDoxygen ? false +, cmake +, pkg-config + + +, libpcap -# e.g. "optimized" or "debug". If not set, use default one -, build_profile ? null +, jansson -# --enable-examples -, withExamples ? false +, harfbuzz +, freetype -# very long -, withManual ? false, doxygen ? null, graphviz ? null, imagemagick ? null -# for manual, tetex is used to get the eps2pdf binary -# texlive to get latexmk. building manual still fails though -, dia, tetex ? null, ghostscript ? null, texlive ? null + # for binding generation +, castxml ? null +, cppyy ? null + + # can take a long time, generates > 30000 images/graphs +, enableDoxygen ? false -# generates python bindings -, pythonSupport ? false, ncurses ? null + # very long +, withManual ? false +, doxygen ? null +, graphviz ? null +, imagemagick ? null + # for manual, tetex is used to get the eps2pdf binary + # texlive to get latexmk. building manual still fails though +, dia +, tetex ? null +, ghostscript ? null +, texlive ? null + + # generates python bindings +, pythonSupport ? true +, ncurses ? null -# All modules can be enabled by choosing 'all_modules'. -# we include here the DCE mandatory ones -, modules ? [ "core" "network" "internet" "point-to-point" "point-to-point-layout" "fd-net-device" "netanim" ] , lib }: let - pythonEnv = python.withPackages(ps: + pythonEnv = python.withPackages (ps: lib.optional withManual ps.sphinx - ++ lib.optionals pythonSupport (with ps;[ pybindgen pygccxml ]) + ++ lib.optionals pythonSupport (with ps;[ pybindgen pygccxml cppyy]) ); in stdenv.mkDerivation rec { pname = "ns-3"; - version = "35"; + version = "39"; src = fetchFromGitLab { owner = "nsnam"; - repo = "ns-3-dev"; - rev = "ns-3.${version}"; - sha256 = "sha256-3w+lCWWra9sndL8+vkGfH5plrDYYCMFi1PzwIVRku6I="; + repo = "ns-3-dev"; + rev = "ns-3.${version}"; + sha256 = "sha256-2d8xCCfxRpcCZgt7ne17F7cUo/wIxLyvjQs3izNUnmY="; }; - nativeBuildInputs = [ wafHook python ]; + nativeBuildInputs = [ cmake pkg-config pythonEnv ]; - outputs = [ "out" ] ++ lib.optional pythonSupport "py"; + outputs = [ "out" ]; # ncurses is a hidden dependency of waf when checking python buildInputs = lib.optionals pythonSupport [ castxml ncurses ] ++ lib.optionals enableDoxygen [ doxygen graphviz imagemagick ] - ++ lib.optionals withManual [ dia tetex ghostscript texlive.combined.scheme-medium ]; + ++ lib.optionals withManual [ dia tetex ghostscript imagemagick texlive.combined.scheme-medium ] + ++ [ + libxml2 + pythonEnv + sqlite.dev + gsl + boost + root + glib.out + glib.dev + libpcap + gtk3-x11.dev + harfbuzz + freetype + jansson + ]; propagatedBuildInputs = [ pythonEnv ]; - postPatch = '' - patchShebangs doc/ns3_html_theme/get_version.sh - ''; + preConfigure = '' + substituteInPlace src/tap-bridge/CMakeLists.txt \ + --replace '-DTAP_CREATOR="''${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/tap-bridge/' "-DTAP_CREATOR=\"$out/libexec/ns3/" - wafConfigureFlags = with lib; [ - "--enable-modules=${concatStringsSep "," modules}" - "--with-python=${pythonEnv.interpreter}" - ] - ++ optional (build_profile != null) "--build-profile=${build_profile}" - ++ optional withExamples " --enable-examples " - ++ optional doCheck " --enable-tests " - ; + substituteInPlace src/fd-net-device/CMakeLists.txt \ + --replace '-DRAW_SOCK_CREATOR="''${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/' "-DRAW_SOCK_CREATOR=\"$out/libexec/ns3/" + + substituteInPlace src/fd-net-device/CMakeLists.txt \ + --replace '-DTAP_DEV_CREATOR="''${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/' "-DTAP_DEV_CREATOR=\"$out/libexec/ns3/" + ''; - doCheck = true; + doCheck = false; buildTargets = "build" + lib.optionalString enableDoxygen " doxygen" @@ -80,25 +111,25 @@ stdenv.mkDerivation rec { # to prevent fatal error: 'backward_warning.h' file not found CXXFLAGS = "-D_GLIBCXX_PERMIT_BACKWARD_HASH"; - postBuild = with lib; let flags = concatStringsSep ";" ( - optional enableDoxygen "./waf doxygen" - ++ optional withManual "./waf sphinx" - ); - in "${flags}" - ; - - postInstall = '' - moveToOutput "${pythonEnv.libPrefix}" "$py" - ''; - - # we need to specify the proper interpreter else ns3 can check against a - # different version - checkPhase = '' - ${pythonEnv.interpreter} ./test.py --nowaf - ''; + # Make generated python bindings discoverable in customized python environment + passthru = { pythonModule = python; }; + + cmakeFlags = [ + "-DPython3_LIBRARY_DIRS=${pythonEnv}/lib" + "-DPython3_INCLUDE_DIRS=${pythonEnv}/include" + "-DPython3_EXECUTABLE=${pythonEnv}/bin/python" + "-DNS3_PYTHON_BINDINGS=ON" + "-DNS3_DES_METRICS=ON" + "-DNS3_BINDINGS_INSTALL_DIR=lib/${pythonEnv.libPrefix}/site-packages" + "-DNS3_LOG=ON" + "-DNS3_ASSERT=ON" + "-DNS3_GTK3=ON" + "-DGTK3_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include" + ] + ++ lib.optional doCheck "-DNS3_TESTS=ON"; # strictoverflow prevents clang from discovering pyembed when bindings - hardeningDisable = [ "fortify" "strictoverflow"]; + hardeningDisable = [ "fortify" "strictoverflow" ]; meta = with lib; { homepage = "http://www.nsnam.org"; |