2022-06-01 16:15:54 +02:00
|
|
|
{
|
|
|
|
description = "A tree-sitter grammar for Tiger";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
flake-utils = {
|
|
|
|
type = "github";
|
|
|
|
owner = "numtide";
|
|
|
|
repo = "flake-utils";
|
|
|
|
ref = "master";
|
|
|
|
};
|
|
|
|
|
|
|
|
nixpkgs = {
|
|
|
|
type = "github";
|
|
|
|
owner = "NixOS";
|
|
|
|
repo = "nixpkgs";
|
|
|
|
ref = "nixpkgs-unstable";
|
|
|
|
};
|
|
|
|
|
|
|
|
pre-commit-hooks = {
|
|
|
|
type = "github";
|
|
|
|
owner = "cachix";
|
|
|
|
repo = "pre-commit-hooks.nix";
|
|
|
|
ref = "master";
|
|
|
|
inputs = {
|
|
|
|
flake-utils.follows = "flake-utils";
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, flake-utils
|
|
|
|
, nixpkgs
|
|
|
|
, pre-commit-hooks
|
|
|
|
}:
|
|
|
|
flake-utils.lib.eachDefaultSystem
|
|
|
|
(system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
rec {
|
|
|
|
checks = {
|
|
|
|
pre-commit = pre-commit-hooks.lib.${system}.run {
|
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
hooks = {
|
2022-06-02 16:59:21 +02:00
|
|
|
clang-format = {
|
|
|
|
enable = true;
|
|
|
|
name = "clang-format";
|
|
|
|
entry = "${pkgs.clang-tools}/bin/clang-format -style=file -i";
|
|
|
|
types = [ "text" "c" ];
|
|
|
|
# I don't care for generated files' formatting
|
|
|
|
excludes = [ "src/parser.c" "src/tree_sitter/parser.h" ];
|
|
|
|
language = "system";
|
|
|
|
};
|
|
|
|
|
2022-06-01 16:15:54 +02:00
|
|
|
nixpkgs-fmt = {
|
|
|
|
enable = true;
|
|
|
|
};
|
2022-06-02 17:02:29 +02:00
|
|
|
|
2022-06-02 17:04:32 +02:00
|
|
|
tree-sitter = {
|
|
|
|
enable = true;
|
|
|
|
name = "tree-sitter tests";
|
|
|
|
entry = "${pkgs.tree-sitter}/bin/tree-sitter test";
|
|
|
|
pass_filenames = false;
|
|
|
|
};
|
|
|
|
|
2022-06-02 17:02:29 +02:00
|
|
|
tree-sitter-files = {
|
|
|
|
enable = true;
|
|
|
|
name = "tree-sitter generated files";
|
|
|
|
entry = "${pkgs.tree-sitter}/bin/tree-sitter generate";
|
|
|
|
pass_filenames = false;
|
|
|
|
};
|
2022-06-01 16:15:54 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
devShells = {
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
nodejs
|
|
|
|
tree-sitter
|
|
|
|
];
|
|
|
|
|
|
|
|
inherit (checks.pre-commit) shellHook;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|