Skip to content

Commit

Permalink
Merge pull request #32 from nix-community/ci/checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrumplex authored Feb 12, 2024
2 parents 4e02570 + ce19964 commit 6628b7f
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: 2024 Sefa Eyeoglu <contact@scrumplex.net>
#
# 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
15 changes: 15 additions & 0 deletions .github/workflows/reuse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# 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
33 changes: 32 additions & 1 deletion parts/dev.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SPDX-FileCopyrightText: 2023 Sefa Eyeoglu <contact@scrumplex.net>
# SPDX-FileCopyrightText: 2023 Naïm Favier <n@monade.li>
#
# SPDX-License-Identifier: MIT
{
Expand All @@ -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 "$@"
'';
};
};
}

0 comments on commit 6628b7f

Please sign in to comment.