diff options
author | Soispha <soispha@vhack.eu> | 2024-01-19 18:55:21 +0100 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2024-01-19 18:55:21 +0100 |
commit | 849cd60632c2da99a4035e614266b0aa86612f4f (patch) | |
tree | 55372bc6c1f6424d84c75085ca0a3b4d12b4dabb /sys/nixpkgs/pkgs/tree-sitter-yts/flake.nix | |
parent | feat(flake): Add `pkgs` subattribute (diff) | |
download | nixos-config-849cd60632c2da99a4035e614266b0aa86612f4f.tar.gz nixos-config-849cd60632c2da99a4035e614266b0aa86612f4f.zip |
feat(hm/conf/nvim/plgs/treesitter): Add custom parser for `yts`
Diffstat (limited to 'sys/nixpkgs/pkgs/tree-sitter-yts/flake.nix')
-rw-r--r-- | sys/nixpkgs/pkgs/tree-sitter-yts/flake.nix | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/sys/nixpkgs/pkgs/tree-sitter-yts/flake.nix b/sys/nixpkgs/pkgs/tree-sitter-yts/flake.nix new file mode 100644 index 00000000..1b6f8ab0 --- /dev/null +++ b/sys/nixpkgs/pkgs/tree-sitter-yts/flake.nix @@ -0,0 +1,82 @@ +{ + description = "tree-sitter-yts"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + flake-utils.url = "github:numtide/flake-utils"; + + npmlock2nix = { + url = "github:nix-community/npmlock2nix"; + flake = false; + }; + + crane = { + url = "github:ipetkov/crane"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + npmlock2nix, + crane, + }: (flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + inherit (pkgs) lib; + + npmlock2nix' = pkgs.callPackage npmlock2nix {}; + craneLib = crane.lib.${system}; + in { + build = self.packages.${system}.tree-sitter-nix; + + rust-bindings = craneLib.buildPackage { + src = self; + }; + + # Requires xcode + node-bindings = npmlock2nix'.v2.build { + src = self; + inherit (self.devShells.${system}.default) nativeBuildInputs; + inherit (pkgs) nodejs; + + buildCommands = [ + "${pkgs.nodePackages.node-gyp}/bin/node-gyp configure" + "npm run build" + ]; + + installPhase = '' + touch $out + ''; + }; + + packages.tree-sitter-yts = (pkgs.callPackage ./grammar.nix {}) { + language = "yts"; + version = "1.0"; + src = self; + }; + + packages.default = self.packages.${system}.tree-sitter-yts; + devShells.default = pkgs.mkShell { + packages = [ + pkgs.nodejs + pkgs.python3 + + pkgs.tree-sitter + pkgs.editorconfig-checker + + pkgs.rustc + pkgs.cargo + + # Formatters + pkgs.treefmt + pkgs.nixpkgs-fmt + pkgs.nodePackages.prettier + pkgs.rustfmt + pkgs.clang-tools + ]; + }; + })); +} |