Commit 93b08a70 authored by Connor Baker's avatar Connor Baker
Browse files

{pkgs/development/cuda-modules,pkgs/test/cuda,pkgs/top-level/cuda-packages.nix...

{pkgs/development/cuda-modules,pkgs/test/cuda,pkgs/top-level/cuda-packages.nix}: reformat all CUDA files with nixfmt-rfc-style 2023-03-01

```bash
nix run github:NixOS/nixpkgs/ab6071eb#nixfmt-rfc-style -L --allow-import-from-derivation -- pkgs/development/cuda-modules pkgs/test/cuda pkgs/top-level/cuda-packages.nix
```
parent 7f797a69
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,6 +21,6 @@ let
  assertCondition = true;
in

  /* TODO: Consider testing whether we in fact use the newer libstdc++ */
# TODO: Consider testing whether we in fact use the newer libstdc++

lib.extendDerivation assertCondition passthruExtra cudaStdenv
+48 −50
Original line number Diff line number Diff line
@@ -15,8 +15,7 @@
let
  inherit (lib) lists strings;
in
backendStdenv.mkDerivation (
  finalAttrs: {
backendStdenv.mkDerivation (finalAttrs: {
  strictDeps = true;

  pname = "cuda-samples";
@@ -75,5 +74,4 @@ backendStdenv.mkDerivation (
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ obsidian-systems-maintenance ] ++ lib.teams.cuda.members;
  };
  }
)
})
+16 −18
Original line number Diff line number Diff line
@@ -63,8 +63,7 @@ let
            featureRelease
            ;
        }).overrideAttrs
          (
            prevAttrs: {
          (prevAttrs: {
            # Add the package-specific license.
            meta = prevAttrs.meta // {
              license =
@@ -78,8 +77,7 @@ let
                in
                lib.licenses.nvidiaCudaRedist // { inherit url; };
            };
            }
          );
          });
    in
    drv;

+89 −91
Original line number Diff line number Diff line
{cudaVersion, lib, addDriverRunpath}:
{
  cudaVersion,
  lib,
  addDriverRunpath,
}:
let
  inherit (lib) attrsets lists strings;
  # cudaVersionOlder : Version -> Boolean
@@ -8,15 +12,16 @@ let

  addBuildInputs =
    drv: buildInputs:
    drv.overrideAttrs (prevAttrs: {buildInputs = prevAttrs.buildInputs ++ buildInputs;});
    drv.overrideAttrs (prevAttrs: {
      buildInputs = prevAttrs.buildInputs ++ buildInputs;
    });
in
# NOTE: Filter out attributes that are not present in the previous version of
# the package set. This is necessary to prevent the appearance of attributes
# like `cuda_nvcc` in `cudaPackages_10_0, which predates redistributables.
final: prev:
attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
  libcufile = prev.libcufile.overrideAttrs (
    prevAttrs: {
  libcufile = prev.libcufile.overrideAttrs (prevAttrs: {
    buildInputs = prevAttrs.buildInputs ++ [
      final.libcublas.lib
      final.pkgs.numactl
@@ -26,8 +31,7 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
    autoPatchelfIgnoreMissingDeps =
      prevAttrs.autoPatchelfIgnoreMissingDeps
      ++ lists.optionals (cudaVersionOlder "11.7") [ "libcufile.so.0" ];
    }
  );
  });

  libcusolver = addBuildInputs prev.libcusolver (
    # Always depends on this
@@ -42,8 +46,7 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
    lists.optionals (cudaVersionAtLeast "12.0") [ final.libnvjitlink.lib ]
  );

  cuda_cudart = prev.cuda_cudart.overrideAttrs (
    prevAttrs: {
  cuda_cudart = prev.cuda_cudart.overrideAttrs (prevAttrs: {
    # Remove once cuda-find-redist-features has a special case for libcuda
    outputs =
      prevAttrs.outputs
@@ -77,11 +80,9 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
        ln -s "$stubs"/lib/stubs/* "$stubs"/lib/
        ln -s "$stubs"/lib/stubs "''${!outputLib}/lib/stubs"
      '';
    }
  );
  });

  cuda_compat = prev.cuda_compat.overrideAttrs (
    prevAttrs: {
  cuda_compat = prev.cuda_compat.overrideAttrs (prevAttrs: {
    autoPatchelfIgnoreMissingDeps = prevAttrs.autoPatchelfIgnoreMissingDeps ++ [
      "libnvrm_gpu.so"
      "libnvrm_mem.so"
@@ -92,8 +93,7 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
      "Trying to use cuda_compat on aarch64-linux targeting non-Jetson devices" =
        !final.flags.isJetsonBuild;
    };
    }
  );
  });

  cuda_gdb = addBuildInputs prev.cuda_gdb (
    # x86_64 only needs gmp from 12.0 and on
@@ -176,9 +176,9 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
    }
  );

  cuda_nvprof = prev.cuda_nvprof.overrideAttrs (
    prevAttrs: {buildInputs = prevAttrs.buildInputs ++ [final.cuda_cupti.lib];}
  );
  cuda_nvprof = prev.cuda_nvprof.overrideAttrs (prevAttrs: {
    buildInputs = prevAttrs.buildInputs ++ [ final.cuda_cupti.lib ];
  });

  cuda_demo_suite = addBuildInputs prev.cuda_demo_suite [
    final.pkgs.freeglut
@@ -189,8 +189,7 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
    final.libcurand.lib
  ];

  nsight_compute = prev.nsight_compute.overrideAttrs (
    prevAttrs: {
  nsight_compute = prev.nsight_compute.overrideAttrs (prevAttrs: {
    nativeBuildInputs =
      prevAttrs.nativeBuildInputs
      ++ (
@@ -207,8 +206,7 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
        else
          [ final.pkgs.qt6.qtwebview ]
      );
    }
  );
  });

  nsight_systems = prev.nsight_systems.overrideAttrs (
    prevAttrs:
+60 −53
Original line number Diff line number Diff line
@@ -144,8 +144,7 @@ backendStdenv.mkDerivation rec {
        gst_all_1.gstreamer
        gst_all_1.gst-plugins-base
      ])
      ++ (
        with qt6; [
      ++ (with qt6; [
        qtmultimedia
        qttools
        qtpositioning
@@ -153,8 +152,7 @@ backendStdenv.mkDerivation rec {
        qtsvg
        qtwebchannel
        qtwebengine
        ]
      )
      ])
    ));

  # Prepended to runpaths by autoPatchelf.
@@ -170,7 +168,8 @@ backendStdenv.mkDerivation rec {
    "${placeholder "out"}/nvvm/lib64"
  ];

  autoPatchelfIgnoreMissingDeps = [
  autoPatchelfIgnoreMissingDeps =
    [
      # This is the hardware-dependent userspace driver that comes from
      # nvidia_x11 package. It must be deployed at runtime in
      # /run/opengl-driver/lib or pointed at by LD_LIBRARY_PATH variable, rather
@@ -182,7 +181,8 @@ backendStdenv.mkDerivation rec {
      # This dependency is asked for by target-linux-x64/CollectX/RedHat/x86_64/libssl.so.10
      # - do we even want to use nvidia-shipped libssl?
      "libcom_err.so.2"
  ] ++ lib.optionals (lib.versionOlder version "10.1") [
    ]
    ++ lib.optionals (lib.versionOlder version "10.1") [
      # For Cuda 10.0, nVidia also shipped a jre implementation which needed
      # two old versions of ffmpeg which are not available in nixpkgs
      "libavcodec.so.54"
@@ -282,7 +282,14 @@ backendStdenv.mkDerivation rec {
              for qtlib in $out/host-linux-x64/Plugins/*/libq*.so; do
                qtdir=$(basename $(dirname $qtlib))
                filename=$(basename $qtlib)
                for qtpkgdir in ${lib.concatMapStringsSep " " (x: qt6Packages.${x}) ["qtbase" "qtimageformats" "qtsvg" "qtwayland"]}; do
                for qtpkgdir in ${
                  lib.concatMapStringsSep " " (x: qt6Packages.${x}) [
                    "qtbase"
                    "qtimageformats"
                    "qtsvg"
                    "qtwayland"
                  ]
                }; do
                  if [ -e $qtpkgdir/lib/qt-6/plugins/$qtdir/$filename ]; then
                    ln -snf $qtpkgdir/lib/qt-6/plugins/$qtdir/$filename $qtlib
                  fi
@@ -303,8 +310,9 @@ backendStdenv.mkDerivation rec {
      ''}

      # Remove some cruft.
      ${lib.optionalString ((lib.versionAtLeast version "7.0") && (lib.versionOlder version "10.1"))
        "rm $out/bin/uninstall*"}
      ${lib.optionalString (
        (lib.versionAtLeast version "7.0") && (lib.versionOlder version "10.1")
      ) "rm $out/bin/uninstall*"}

      # Fixup path to samples (needed for cuda 6.5 or else nsight will not find them)
      if [ -d "$out"/cuda-samples ]; then
@@ -360,8 +368,7 @@ backendStdenv.mkDerivation rec {
      wrapProgram "$out/bin/$b" \
        --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
    done
    ${
      lib.optionalString (lib.versionAtLeast version "12")
    ${lib.optionalString (lib.versionAtLeast version "12")
      # Check we don't have any lurking vendored qt libraries that weren't
      # replaced during installPhase
      ''
Loading