From 8ec23df6f6c8e647719cbbded5376fd83679a28b Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Wed, 11 Jun 2025 16:36:07 +0200 Subject: [PATCH] ci/treefmt: add yamlfmt Most workflow files are already well formatted, but to make it easier to keep it that way, we can add yamlfmt. I personally have a preference for non-indented arrays for YAML, but wanted to avoid bigger diffs here - the status-quo clearly are indented arrays. Some changes are made manually to the get-merge-commit action and the issue templates. Those would otherwise make yamlfmt misbehave on those. --- .github/ISSUE_TEMPLATE/01_bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/02_bug_report_darwin.yml | 2 +- .github/ISSUE_TEMPLATE/03_bug_report_nixos.yml | 2 +- .github/ISSUE_TEMPLATE/04_build_failure.yml | 2 +- .github/ISSUE_TEMPLATE/05_update_request.yml | 2 +- .github/ISSUE_TEMPLATE/06_module_request.yml | 2 +- .github/ISSUE_TEMPLATE/07_backport_request.yml | 2 +- .../ISSUE_TEMPLATE/08_documentation_request.yml | 2 +- .../ISSUE_TEMPLATE/09_unreproducible_package.yml | 2 +- .github/actions/get-merge-commit/action.yml | 2 +- ci/default.nix | 15 +++++++++++++++ 11 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.yml b/.github/ISSUE_TEMPLATE/01_bug_report.yml index c44935ceaf25..e0ec7544c83b 100644 --- a/.github/ISSUE_TEMPLATE/01_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/01_bug_report.yml @@ -101,7 +101,7 @@ body: label: "Notify maintainers" description: | Please mention the people who are in the **Maintainers** list of the offending package. This is done by by searching for the package on the [NixOS Package Search](https://search.nixos.org/packages) and mentioning the people listed under **Maintainers** by prefixing their GitHub usernames with an '@' character. Please add the mentions above the `---` characters in the template below. - value: | + value: |2 --- diff --git a/.github/ISSUE_TEMPLATE/02_bug_report_darwin.yml b/.github/ISSUE_TEMPLATE/02_bug_report_darwin.yml index 5389f6b5108c..980c7dd2bb2c 100644 --- a/.github/ISSUE_TEMPLATE/02_bug_report_darwin.yml +++ b/.github/ISSUE_TEMPLATE/02_bug_report_darwin.yml @@ -115,7 +115,7 @@ body: Please mention the people who are in the **Maintainers** list of the offending package. This is done by by searching for the package on the [NixOS Package Search](https://search.nixos.org/packages) and mentioning the people listed under **Maintainers** by prefixing their GitHub usernames with an '@' character. Please add the mentions above the `---` characters in the template below. If this issue is related to the Darwin packaging architecture as a whole, or is related to the core Darwin frameworks, consider mentioning the `@NixOS/darwin-core` team. - value: | + value: |2 --- diff --git a/.github/ISSUE_TEMPLATE/03_bug_report_nixos.yml b/.github/ISSUE_TEMPLATE/03_bug_report_nixos.yml index 2e8c3db66047..9a6834cf9810 100644 --- a/.github/ISSUE_TEMPLATE/03_bug_report_nixos.yml +++ b/.github/ISSUE_TEMPLATE/03_bug_report_nixos.yml @@ -105,7 +105,7 @@ body: Please note that the maintainer attribute name does not always match the maintainer's GitHub username. If that occurs, try looking in [`maintainers/maintainer-list.nix`](https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix) for the maintainer attribute name, and checking if the maintainer has a listed GitHub username. If in doubt, check `git blame` for whoever last touched the module, or check the associated package's maintainers. Please add the mentions above the `---` characters. - value: | + value: |2 --- diff --git a/.github/ISSUE_TEMPLATE/04_build_failure.yml b/.github/ISSUE_TEMPLATE/04_build_failure.yml index 806a22b93061..4060900452a7 100644 --- a/.github/ISSUE_TEMPLATE/04_build_failure.yml +++ b/.github/ISSUE_TEMPLATE/04_build_failure.yml @@ -111,7 +111,7 @@ body: label: "Notify maintainers" description: | Please mention the people who are in the **Maintainers** list of the offending package. This is done by by searching for the package on the [NixOS Package Search](https://search.nixos.org/packages) and mentioning the people listed under **Maintainers** by prefixing their GitHub usernames with an '@' character. Please add the mentions above the `---` characters in the template below. - value: | + value: |2 --- diff --git a/.github/ISSUE_TEMPLATE/05_update_request.yml b/.github/ISSUE_TEMPLATE/05_update_request.yml index 6500aa2605c4..a0f076973d7b 100644 --- a/.github/ISSUE_TEMPLATE/05_update_request.yml +++ b/.github/ISSUE_TEMPLATE/05_update_request.yml @@ -86,7 +86,7 @@ body: label: "Notify maintainers" description: | Please mention the people who are in the **Maintainers** list of the offending package. This is done by by searching for the package on the [NixOS Package Search](https://search.nixos.org/packages) and mentioning the people listed under **Maintainers** by prefixing their GitHub usernames with an '@' character. Please add the mentions above the `---` characters in the template below. - value: | + value: |2 --- diff --git a/.github/ISSUE_TEMPLATE/06_module_request.yml b/.github/ISSUE_TEMPLATE/06_module_request.yml index b794d18c673a..cdd7908041a5 100644 --- a/.github/ISSUE_TEMPLATE/06_module_request.yml +++ b/.github/ISSUE_TEMPLATE/06_module_request.yml @@ -61,7 +61,7 @@ body: label: "Notify maintainers" description: | Please mention the people who are in the **Maintainers** list of the offending package. This is done by by searching for the package on the [NixOS Package Search](https://search.nixos.org/packages) and mentioning the people listed under **Maintainers** by prefixing their GitHub usernames with an '@' character. Please add the mentions above the `---` characters in the template below. - value: | + value: |2 --- diff --git a/.github/ISSUE_TEMPLATE/07_backport_request.yml b/.github/ISSUE_TEMPLATE/07_backport_request.yml index 238d75084b98..eb07f62a9ab9 100644 --- a/.github/ISSUE_TEMPLATE/07_backport_request.yml +++ b/.github/ISSUE_TEMPLATE/07_backport_request.yml @@ -66,7 +66,7 @@ body: label: "Notify maintainers" description: | Please mention the people who are in the **Maintainers** list of the offending package. This is done by by searching for the package on the [NixOS Package Search](https://search.nixos.org/packages) and mentioning the people listed under **Maintainers** by prefixing their GitHub usernames with an '@' character. Please add the mentions above the `---` characters in the template below. - value: | + value: |2 --- diff --git a/.github/ISSUE_TEMPLATE/08_documentation_request.yml b/.github/ISSUE_TEMPLATE/08_documentation_request.yml index 92eb86739f64..6879cb48083c 100644 --- a/.github/ISSUE_TEMPLATE/08_documentation_request.yml +++ b/.github/ISSUE_TEMPLATE/08_documentation_request.yml @@ -48,7 +48,7 @@ body: label: "Notify maintainers" description: | Please mention the people who are in the **Maintainers** list of the offending package. This is done by by searching for the package on the [NixOS Package Search](https://search.nixos.org/packages) and mentioning the people listed under **Maintainers** by prefixing their GitHub usernames with an '@' character. Please add the mentions above the `---` characters in the template below. - value: | + value: |2 --- diff --git a/.github/ISSUE_TEMPLATE/09_unreproducible_package.yml b/.github/ISSUE_TEMPLATE/09_unreproducible_package.yml index 0542e74fa17b..bc3af9c4db47 100644 --- a/.github/ISSUE_TEMPLATE/09_unreproducible_package.yml +++ b/.github/ISSUE_TEMPLATE/09_unreproducible_package.yml @@ -120,7 +120,7 @@ body: label: "Notify maintainers" description: | Please mention the people who are in the **Maintainers** list of the offending package. This is done by by searching for the package on the [NixOS Package Search](https://search.nixos.org/packages) and mentioning the people listed under **Maintainers** by prefixing their GitHub usernames with an '@' character. Please add the mentions above the `---` characters in the template below. - value: | + value: |2 --- diff --git a/.github/actions/get-merge-commit/action.yml b/.github/actions/get-merge-commit/action.yml index a16d289cc6e0..3766ad4f4ea0 100644 --- a/.github/actions/get-merge-commit/action.yml +++ b/.github/actions/get-merge-commit/action.yml @@ -72,10 +72,10 @@ runs: } throw new Error("Not retrying anymore. It's likely that GitHub is having internal issues: check https://www.githubstatus.com.") + - if: inputs.merged-as-untrusted && steps.commits.outputs.mergedSha # Would be great to do the checkouts in git worktrees of the existing spare checkout instead, # but Nix is broken with them: # https://github.com/NixOS/nix/issues/6073 - - if: inputs.merged-as-untrusted && steps.commits.outputs.mergedSha uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ steps.commits.outputs.mergedSha }} diff --git a/ci/default.nix b/ci/default.nix index cddea6453606..32e067133422 100644 --- a/ci/default.nix +++ b/ci/default.nix @@ -52,6 +52,21 @@ let # See https://github.com/NixOS/nixfmt programs.nixfmt.enable = true; + programs.yamlfmt = { + enable = true; + settings.formatter = { + retain_line_breaks = true; + }; + }; + settings.formatter.yamlfmt.excludes = [ + # Breaks helm templating + "nixos/tests/k3s/k3s-test-chart/templates/*" + # Aligns comments with whitespace + "pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml" + # TODO: Fix formatting for auto-generated file + "pkgs/development/haskell-modules/configuration-hackage2nix/transitive-broken.yaml" + ]; + settings.formatter.editorconfig-checker = { command = "${pkgs.lib.getExe pkgs.editorconfig-checker}"; options = [ "-disable-indent-size" ];