Unverified Commit 073542a1 authored by Silvan Mosberger's avatar Silvan Mosberger Committed by GitHub
Browse files

Merge pull request #299578 from ConnorBaker/fix/treewide-cuda-reformat-nixfmt-rfc-style-2024-03-01

treewide: CUDA reformat with `nixfmt-rfc-style`
parents bdcc3e88 d94495d5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -102,3 +102,6 @@ fb0e5be84331188a69b3edd31679ca6576edb75a

# systemd: break too long lines of Nix code
67643f8ec84bef1482204709073e417c9f07eb87

# {pkgs/development/cuda-modules,pkgs/test/cuda,pkgs/top-level/cuda-packages.nix}: reformat all CUDA files with nixfmt-rfc-style 2023-03-01
802a1b4d3338f24cbc4efd704616654456d75a94
+50 −0
Original line number Diff line number Diff line
# This file was copied mostly from check-maintainers-sorted.yaml.
# NOTE: Formatting with the RFC-style nixfmt command is not yet stable. See
# https://github.com/NixOS/rfcs/pull/166.
# Because of this, this action is not yet enabled for all files -- only for
# those who have opted in.
name: Check that Nix files are formatted

on:
  pull_request_target:
permissions:
  contents: read

jobs:
  nixos:
    runs-on: ubuntu-latest
    if: github.repository_owner == 'NixOS'
    steps:
      - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
        with:
          # pull_request_target checks out the base branch by default
          ref: refs/pull/${{ github.event.pull_request.number }}/merge
      - uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
        with:
          # explicitly enable sandbox
          extra_nix_config: sandbox = true
      - name: Install nixfmt
        run: nix-env -f default.nix -iAP nixfmt-rfc-style
      - name: Check that Nix files are formatted according to the RFC style
        # Each environment variable beginning with NIX_FMT_PATHS_ is a list of
        # paths to check with nixfmt.
        env:
          # Format paths related to the Nixpkgs CUDA ecosystem.
          NIX_FMT_PATHS_CUDA: |
            pkgs/development/cuda-modules
            pkgs/test/cuda
            pkgs/top-level/cuda-packages.nix
        # Iterate over all environment variables beginning with NIX_FMT_PATHS_.
        run: |
          for env_var in "${!NIX_FMT_PATHS_@}"; do
            readarray -t paths <<< "${!env_var}"
            if [[ "${paths[*]}" == "" ]]; then
              echo "Error: $env_var is empty."
              exit 1
            fi
            echo "Checking paths: ${paths[@]}"
            if ! nixfmt --check "${paths[@]}"; then
              echo "Error: nixfmt failed."
              exit 1
            fi
          done
+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;

Loading