diff --git a/recipes/burin/default.nix b/recipes/burin/default.nix new file mode 100644 index 0000000..ef196ce --- /dev/null +++ b/recipes/burin/default.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: let + burin = fetchTree { + narHash = "sha256-JVSxADqfMOHQ9L2d9wM63W8cSR8whkFkdtz/nzolzJU="; + url = "https://tangled.org/did:plc:q5dy7qm2eu6lcxfykcegjptu"; + rev = "fa24e303ff369760d4e010820dc2e86bd6cf0418"; + type = "git"; + }; +in { + imports = [ + ./grammars.nix + ]; + + programs.helix.enable = true; + programs.helix.package = pkgs.callPackage "${burin}/default.nix" { + includeGrammarIf = _: false; + }; +} diff --git a/recipes/burin/dovetail.toml b/recipes/burin/dovetail.toml new file mode 100644 index 0000000..2ec1c79 --- /dev/null +++ b/recipes/burin/dovetail.toml @@ -0,0 +1,7 @@ +name = "Burin" +author = "@isaaccorbrey.com" +description = "A Helix fork that adds many much-needed features." +keywords = ["helix", "editor", "tree-sitter", "tui"] +class = "home-manager" + +topics.reads = ["@isaaccorbrey.com/tree-sitter-grammar"] diff --git a/recipes/burin/grammars.nix b/recipes/burin/grammars.nix new file mode 100644 index 0000000..49137ed --- /dev/null +++ b/recipes/burin/grammars.nix @@ -0,0 +1,23 @@ +{ config, dovetail, lib, pkgs, ... }: { + config = let + grammars = config.topics.${dovetail.mkNamespaced "tree-sitter-grammar"}; + extension = pkgs.stdenv.hostPlatform.extensions.sharedLibrary; + + mkGrammar = name: source: pkgs.tree-sitter.buildGrammar { + location = source.subpath; + version = source.rev; + language = name; + + src = pkgs.fetchgit { + inherit (source) url rev hash; + }; + }; + + mkGrammarFile = name: grammar: { + name = "helix/runtime/grammars/${name}${extension}"; + value.source = "${mkGrammar name grammar}/parser"; + }; + in { + xdg.configFile = lib.mapAttrs' mkGrammarFile grammars; + }; +} diff --git a/topics/tree-sitter-grammar.nix b/topics/tree-sitter-grammar.nix new file mode 100644 index 0000000..c73ffb0 --- /dev/null +++ b/topics/tree-sitter-grammar.nix @@ -0,0 +1,15 @@ +{ dovetail, lib, ... }: { + options.topics.${dovetail.mkNamespaced "tree-sitter-grammar"} = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule { + options.hash = lib.mkOption { type = lib.types.str; }; + options.rev = lib.mkOption { type = lib.types.str; }; + options.url = lib.mkOption { type = lib.types.str; }; + + options.subpath = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + }; + }); + default = {}; + }; +}