summaryrefslogtreecommitdiff
path: root/nix/check/editorconfig.nix
blob: 526ed5bd15e2498c13de630d5fad7deed2c6b64a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#──────────────────────────────────────────────────────────────────────────────┐
# SPDX-FileCopyrightText: 2025 toastal <https://toast.al/contact/>             │
# SPDX-License-Identifier: LGPL-2.1-or-later                                   │
#──────────────────────────────────────────────────────────────────────────────┘
{
   lib,
   runDashCommand,
   editorconfig-checker,
   nixtamal,
}:

runDashCommand
   {
      name = "check-EditorConfig";
      runtimeInputs = [
         editorconfig-checker
      ];
      env.src =
         let
            fs = lib.fileset;
         in
         (fs.toSource {
            root = ../..;
            fileset = fs.unions [
               (fs.fileFilter (file: file.name == ".editorconfig") ../..)
               (fs.fromSource nixtamal.src)
               ../../nix
            ];
         });
   }
   /* sh */ ''
      if [ -z "$src" ]; then
         echo "Missing \$src" >&2
         exit 1
      fi
      cd "$src"
      editorconfig-checker | tee "$out"
   ''