-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78b8ddc
commit 1b06224
Showing
14 changed files
with
11,703 additions
and
5,839 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
BasedOnStyle: LLVM | ||
IndentWidth: 4 | ||
--- | ||
Language: Cpp | ||
# Force pointers to the type for C. | ||
DerivePointerAlignment: false | ||
PointerAlignment: Right | ||
|
||
# Short functions should not be on a single line, unless empty | ||
AllowShortFunctionsOnASingleLine: Empty | ||
|
||
# It makes more sense this way | ||
BreakBeforeBinaryOperators: All | ||
BreakBeforeTernaryOperators: true | ||
|
||
# Aesthetic | ||
AlignOperands: AlignAfterOperator | ||
BinPackParameters: false | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
node_modules | ||
build | ||
|
||
.direnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/ik0xp2lddma9sx1gpvrzzrfccx7pzika-pre-commit-config.json |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{ | ||
inputs = { | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
nixpkgs = { | ||
url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
}; | ||
pre-commit-hooks = { | ||
url = "github:cachix/pre-commit-hooks.nix"; | ||
inputs = { | ||
flake-utils.follows = "flake-utils"; | ||
nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, pre-commit-hooks }: | ||
{ } // | ||
flake-utils.lib.eachDefaultSystem | ||
( | ||
system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
overlays = [ self.overlays.default ]; | ||
}; | ||
|
||
tree-sitter-env = pkgs.stdenv.mkDerivation { | ||
name = "tree-sitter-env"; | ||
|
||
nativeBuildInputs = with pkgs; [ | ||
makeWrapper | ||
]; | ||
|
||
dontUnpack = true; | ||
|
||
dontBuild = true; | ||
|
||
installPhase = '' | ||
mkdir -p $out/bin | ||
makeWrapper \ | ||
${pkgs.tree-sitter}/bin/tree-sitter \ | ||
$out/bin/tree-sitter \ | ||
--prefix PATH : "${with pkgs; lib.makeBinPath [stdenv.cc nodejs]}" | ||
''; | ||
}; | ||
|
||
in | ||
rec { | ||
checks = { | ||
pre-commit = pre-commit-hooks.lib.${system}.run { | ||
src = ./.; | ||
|
||
hooks = { | ||
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"; | ||
}; | ||
|
||
nixpkgs-fmt = { | ||
enable = true; | ||
}; | ||
|
||
tree-sitter = { | ||
enable = true; | ||
name = "tree-sitter tests"; | ||
entry = "${tree-sitter-env}/bin/tree-sitter test"; | ||
pass_filenames = false; | ||
}; | ||
|
||
tree-sitter-files = { | ||
enable = true; | ||
name = "tree-sitter generated files"; | ||
entry = "${tree-sitter-env}/bin/tree-sitter generate"; | ||
pass_filenames = false; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
devShells = { | ||
default = pkgs.mkShell { | ||
nativeBuildInputs = with pkgs; [ | ||
nodejs-16_x | ||
nodePackages.typescript | ||
rustc | ||
cargo | ||
rustfmt | ||
clippy | ||
(tree-sitter.override { webUISupport = true; }) | ||
]; | ||
|
||
inherit (checks.pre-commit) shellHook; | ||
}; | ||
}; | ||
|
||
packages = { | ||
default = packages.tree-sitter-beancount; | ||
|
||
inherit (pkgs.tree-sitter.passthru.builtGrammars) tree-sitter-beancount; | ||
|
||
inherit (pkgs) tree-sitter; | ||
}; | ||
} | ||
) // { | ||
overlays = { | ||
default = final: prev: { | ||
tree-sitter = prev.tree-sitter.override { | ||
extraGrammars = { | ||
tree-sitter-beancount = { | ||
src = ./.; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.