From db0627c662e8729d67a6053779fd74fa0d0535e4 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Mon, 12 Feb 2024 11:34:19 +0100 Subject: [PATCH 1/3] feat(ci): add REUSE compliance check Signed-off-by: Sefa Eyeoglu --- .github/workflows/reuse.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/reuse.yaml diff --git a/.github/workflows/reuse.yaml b/.github/workflows/reuse.yaml new file mode 100644 index 0000000..bc45892 --- /dev/null +++ b/.github/workflows/reuse.yaml @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. +# +# SPDX-License-Identifier: CC0-1.0 + +name: REUSE Compliance Check + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: REUSE Compliance Check + uses: fsfe/reuse-action@v2 From 7f8313321fd5481117a730900c9b78de735b0ab4 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Mon, 12 Feb 2024 11:35:04 +0100 Subject: [PATCH 2/3] refactor: implement excludes for flake formatter Signed-off-by: Sefa Eyeoglu --- parts/dev.nix | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/parts/dev.nix b/parts/dev.nix index 62b3179..4382743 100644 --- a/parts/dev.nix +++ b/parts/dev.nix @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2023 Sefa Eyeoglu +# SPDX-FileCopyrightText: 2023 Naïm Favier # # SPDX-License-Identifier: MIT { @@ -12,6 +13,36 @@ ]; }; - formatter = pkgs.nixfmt-rfc-style; + formatter = pkgs.writeShellApplication { + name = "nixpkgs-xr-format"; + + runtimeInputs = [ pkgs.nixfmt-rfc-style ]; + text = '' + nixfmt_args=() + while [[ $# -gt 0 ]]; do + case "$1" in + .) + # ignore "." parameter passed by nix fmt + shift + ;; + -c|--check) + nixfmt_args+=("$1") + shift + ;; + *) + echo "Unknown option $1" >&2 + exit 1 + ;; + esac + done + + git_root=$(git rev-parse --show-toplevel) + + git ls-files -z --cached --full-name -- ":!:_sources/" \ + | grep -z '\.nix$' \ + | sed -z "s|^|$git_root/|" \ + | xargs -0 nixfmt "$@" + ''; + }; }; } From ce1996440ade6fa42214ddebffdf6380d5bf691e Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Mon, 12 Feb 2024 11:50:38 +0100 Subject: [PATCH 3/3] feat(ci): add formatter check Signed-off-by: Sefa Eyeoglu --- .github/workflows/format.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/format.yaml diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml new file mode 100644 index 0000000..5755431 --- /dev/null +++ b/.github/workflows/format.yaml @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2024 Sefa Eyeoglu +# +# SPDX-License-Identifier: MIT + +name: Nix Format Check + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Check formatting + run: | + nix fmt -- --check