Compare commits

...

5 commits

Author SHA1 Message Date
Bruno BELANYI 752f941589 Fix 'nix flake check'
All checks were successful
continuous-integration/drone Build is passing
Turns out that 'tree-sitter' is not wrapped to have node and a compiler
available, because nixpkgs assumes that grammars already include
generated files.

So wrap it manually and use that in our pre-commit/checks.
2022-06-03 16:00:13 +02:00
Bruno BELANYI 02f89ac524 Refactor nix package
Introduce an overlay, and use the existing 'tree-sitter' package
machinery to extend it with this grammar.

Expose the extended 'tree-sitter' as part of the flake packages.
2022-06-03 15:58:16 +02:00
Bruno BELANYI 964d796b4b Fix 'nix flake check' evaluation
I should figure out why 'pre-commit' even needs dotnet at some point...
2022-06-03 15:58:12 +02:00
Bruno BELANYI c48624c0f3 Add string escape high-lighting 2022-06-03 12:58:34 +02:00
Bruno BELANYI 47eb986835 Add Drone CI 2022-06-03 12:00:05 +02:00
4 changed files with 89 additions and 15 deletions

31
.drone.yml Normal file
View file

@ -0,0 +1,31 @@
---
kind: pipeline
type: exec
name: abacus checks
steps:
- name: flake check
commands:
- nix flake check
- name: package check
commands:
- nix build
- name: notifiy
commands:
- nix run github:ambroisie/matrix-notifier
environment:
ADDRESS:
from_secret: matrix_homeserver
ROOM:
from_secret: matrix_roomid
USER:
from_secret: matrix_username
PASS:
from_secret: matrix_password
when:
status:
- failure
- success
...

View file

@ -34,14 +34,45 @@
, nixpkgs
, pre-commit-hooks
}:
flake-utils.lib.eachDefaultSystem
let
inherit (flake-utils.lib) eachSystem system;
mySystems = [
system.aarch64-darwin
system.aarch64-linux
system.x86_64-darwin
system.x86_64-linux
];
eachMySystem = eachSystem mySystems;
in
eachMySystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
version = (builtins.fromJSON (builtins.readFile ./package.json)).version;
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 = {
@ -66,14 +97,14 @@
tree-sitter = {
enable = true;
name = "tree-sitter tests";
entry = "${pkgs.tree-sitter}/bin/tree-sitter test";
entry = "${tree-sitter-env}/bin/tree-sitter test";
pass_filenames = false;
};
tree-sitter-files = {
enable = true;
name = "tree-sitter generated files";
entry = "${pkgs.tree-sitter}/bin/tree-sitter generate";
entry = "${tree-sitter-env}/bin/tree-sitter generate";
pass_filenames = false;
};
};
@ -92,14 +123,23 @@
};
packages = {
default =
let mkGrammar = pkgs.callPackage "${nixpkgs}/pkgs/development/tools/parsing/tree-sitter/grammar.nix" { };
in
mkGrammar {
language = "tiger";
inherit version;
source = ./.;
};
default = packages.tree-sitter-tiger;
inherit (pkgs.tree-sitter.passthru.builtGrammars) tree-sitter-tiger;
inherit (pkgs) tree-sitter;
};
});
}) // {
overlays = {
default = final: prev: {
tree-sitter = prev.tree-sitter.override {
extraGrammars = {
tree-sitter-tiger = {
src = ./.;
};
};
};
};
};
};
}

View file

@ -33,6 +33,7 @@
(nil_literal) @constant.builtin
(integer_literal) @number
(string_literal) @string
(escape_sequence) @string.escape
; }}}
; Operators {{{

View file

@ -2,5 +2,7 @@ nil
/* <- constant.builtin */
42
/* <- number */
"Hello World!"
/* <- string */
"Hello World!\n"
/* <- string
^ string.escape
*/