Unverified Commit 174e6bba authored by Wolfgang Walther's avatar Wolfgang Walther Committed by GitHub
Browse files

various: move throws to aliases (#426639)

parents 69a99526 1d4e0690
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
{
  config,
  lib,
  callPackage,
  pkg-config,
@@ -28,12 +29,12 @@ let
    { hypr-dynamic-cursors = import ./hypr-dynamic-cursors.nix; }
    { hyprfocus = import ./hyprfocus.nix; }
    { hyprgrass = import ./hyprgrass.nix; }
    {
      hyprscroller = throw "hyprlandPlugins.hyprscroller has been removed as the upstream project is deprecated. Consider using `hyprlandPlugins.hyprscrolling`.";
    } # Added 2025-05-09
    { hyprspace = import ./hyprspace.nix; }
    { hyprsplit = import ./hyprsplit.nix; }
    (import ./hyprland-plugins.nix)
    (lib.optionalAttrs config.allowAliases {
      hyprscroller = throw "hyprlandPlugins.hyprscroller has been removed as the upstream project is deprecated. Consider using `hyprlandPlugins.hyprscrolling`."; # Added 2025-05-09
    })
  ];
in
(lib.mapAttrs (name: plugin: callPackage plugin { inherit mkHyprlandPlugin; }) plugins)
+9 −2
Original line number Diff line number Diff line
{ pkgs, haskellLib }:
{
  config,
  pkgs,
  haskellLib,
}:

with haskellLib;

@@ -108,7 +112,10 @@ self: super: {

  doctest = dontCheck super.doctest;

  haskell-language-server = throw "haskell-language-server has dropped support for ghc 9.0 in version 2.4.0.0, please use a newer ghc version or an older nixpkgs version";
  haskell-language-server =
    lib.throwIf config.allowAliases
      "haskell-language-server has dropped support for ghc 9.0 in version 2.4.0.0, please use a newer ghc version or an older nixpkgs version"
      (markBroken super.haskell-language-server);

  # Needs to use ghc-lib due to incompatible GHC
  ghc-tags = doDistribute self.ghc-tags_1_5;
+9 −2
Original line number Diff line number Diff line
{ pkgs, haskellLib }:
{
  config,
  pkgs,
  haskellLib,
}:

with haskellLib;

@@ -74,7 +78,10 @@ self: super: {
    }
  );

  haskell-language-server = throw "haskell-language-server has dropped support for ghc 9.2 in version 2.10.0.0, please use a newer ghc version or an older nixpkgs version";
  haskell-language-server =
    lib.throwIf config.allowAliases
      "haskell-language-server has dropped support for ghc 9.2 in version 2.10.0.0, please use a newer ghc version or an older nixpkgs version"
      (markBroken super.haskell-language-server);

  # For GHC < 9.4, some packages need data-array-byte as an extra dependency
  hashable = addBuildDepends [ self.data-array-byte ] super.hashable;
+0 −2
Original line number Diff line number Diff line
@@ -422,8 +422,6 @@ in
    } ./setuptools-build-hook.sh
  ) { };

  setuptoolsCheckHook = throw "The setuptoolsCheckHook has been removed, since the test command has been removed in setuptools 72.0";

  setuptoolsRustBuildHook = callPackage (
    { makePythonHook, setuptools-rust }:
    makePythonHook {
+21 −39
Original line number Diff line number Diff line
@@ -42,20 +42,7 @@ let
    ;
  inherit (magmaRelease) version hash supportedGpuTargets;

  # Per https://icl.utk.edu/magma/downloads, support for CUDA 12 wasn't added until 2.7.1.
  # If we're building a version prior to that, use the latest release of the 11.x series.
  effectiveCudaPackages =
    if strings.versionOlder version "2.7.1" then cudaPackages_11 else cudaPackages;

  inherit (effectiveCudaPackages) cudaAtLeast flags cudaOlder;

  effectiveRocmPackages =
    if strings.versionOlder version "2.8.0" then
      throw ''
        the required ROCm 5.7 version for magma ${version} has been removed
      ''
    else
      rocmPackages;
  inherit (cudaPackages) cudaAtLeast flags cudaOlder;

  # NOTE: The lists.subtractLists function is perhaps a bit unintuitive. It subtracts the elements
  #   of the first list *from* the second list. That means:
@@ -65,7 +52,7 @@ let
  # NOTE: The hip.gpuTargets are prefixed with "gfx" instead of "sm" like flags.realArches.
  #   For some reason, Magma's CMakeLists.txt file does not handle the "gfx" prefix, so we must
  #   remove it.
  rocmArches = lists.map (x: strings.removePrefix "gfx" x) effectiveRocmPackages.clr.gpuTargets;
  rocmArches = lists.map (x: strings.removePrefix "gfx" x) rocmPackages.clr.gpuTargets;
  supportedRocmArches = lists.intersectLists rocmArches supportedGpuTargets;
  unsupportedRocmArches = lists.subtractLists supportedRocmArches rocmArches;

@@ -123,18 +110,11 @@ stdenv.mkDerivation (finalAttrs: {
    "test"
  ];

  postPatch =
    ''
  postPatch = ''
    # For rocm version script invoked by cmake
    patchShebangs tools/
    # Fixup for the python test runners
    patchShebangs ./testing/run_{tests,summarize}.py
    ''
    + lib.optionalString (strings.versionOlder version "2.9.0") ''
      substituteInPlace ./testing/run_tests.py \
        --replace-fail \
          "print >>sys.stderr, cmdp, \"doesn't exist (original name: \" + cmd + \", precision: \" + precision + \")\"" \
          "print(f\"{cmdp} doesn't exist (original name: {cmd}, precision: {precision})\", file=sys.stderr)"
  '';

  nativeBuildInputs =
@@ -145,7 +125,7 @@ stdenv.mkDerivation (finalAttrs: {
      gfortran
    ]
    ++ lists.optionals cudaSupport [
      effectiveCudaPackages.cuda_nvcc
      cudaPackages.cuda_nvcc
    ];

  buildInputs =
@@ -157,7 +137,7 @@ stdenv.mkDerivation (finalAttrs: {
      (getLib gfortran.cc) # libgfortran.so
    ]
    ++ lists.optionals cudaSupport (
      with effectiveCudaPackages;
      with cudaPackages;
      [
        cuda_cccl # <nv/target> and <cuda/std/type_traits>
        cuda_cudart # cuda_runtime.h
@@ -172,7 +152,7 @@ stdenv.mkDerivation (finalAttrs: {
      ]
    )
    ++ lists.optionals rocmSupport (
      with effectiveRocmPackages;
      with rocmPackages;
      [
        clr
        hipblas
@@ -203,9 +183,9 @@ stdenv.mkDerivation (finalAttrs: {
      # Can be removed once https://github.com/icl-utk-edu/magma/pull/27 is merged
      # Can't easily apply the PR as a patch because we rely on the tarball with pregenerated
      # hipified files ∴ fetchpatch of the PR will apply cleanly but fail to build
      (strings.cmakeFeature "ROCM_CORE" "${effectiveRocmPackages.clr}")
      (strings.cmakeFeature "CMAKE_C_COMPILER" "${effectiveRocmPackages.clr}/bin/hipcc")
      (strings.cmakeFeature "CMAKE_CXX_COMPILER" "${effectiveRocmPackages.clr}/bin/hipcc")
      (strings.cmakeFeature "ROCM_CORE" "${rocmPackages.clr}")
      (strings.cmakeFeature "CMAKE_C_COMPILER" "${rocmPackages.clr}/bin/hipcc")
      (strings.cmakeFeature "CMAKE_CXX_COMPILER" "${rocmPackages.clr}/bin/hipcc")
    ];

  # Magma doesn't have a test suite we can easily run, just loose executables, all of which require a GPU.
@@ -241,8 +221,12 @@ stdenv.mkDerivation (finalAttrs: {
    '';

  passthru = {
    inherit cudaSupport rocmSupport gpuTargets;
    cudaPackages = effectiveCudaPackages;
    inherit
      cudaPackages
      cudaSupport
      rocmSupport
      gpuTargets
      ;
    testers = {
      all =
        let
@@ -395,8 +379,6 @@ stdenv.mkDerivation (finalAttrs: {
      # dynamic CUDA support is broken https://github.com/NixOS/nixpkgs/issues/239237
      (cudaSupport && !static)
      || !(cudaSupport || rocmSupport) # At least one back-end enabled
      || (cudaSupport && rocmSupport) # Mutually exclusive
      || (cudaSupport && strings.versionOlder version "2.7.1" && cudaPackages_11 == null)
      || (rocmSupport && strings.versionOlder version "2.8.0");
      || (cudaSupport && rocmSupport); # Mutually exclusive
  };
})
Loading