diff options
author | Michael Davis | 2022-03-09 14:34:52 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-03-10 08:31:57 +0000 |
commit | e01c53551db82146b59415498fc8f588f237b22c (patch) | |
tree | ccc4f8666e5f359fbbe4614ae97aa13a4e134b9b /grammars.nix | |
parent | 7044d7d804ad798207594e1b3bb5bd80a96d3da0 (diff) |
flake: use builtins.fetchTree to shallow-clone grammar repos
Here we perform a shallow fetch using builtins.fetchTree. In order
to make this work, we need to specify the `ref' for any repository
that doesn't have `master' as its default branch (I'm not sure why
this limitation exists since we don't need this when performing
the shallow fetch in `--grammar build')
This `ref' field is ignored by helix, so I have left it undocumented
for now, but I could be open to documenting it.
Diffstat (limited to 'grammars.nix')
-rw-r--r-- | grammars.nix | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/grammars.nix b/grammars.nix index 6dbc05c8..bd2c95cc 100644 --- a/grammars.nix +++ b/grammars.nix @@ -13,10 +13,12 @@ let gitGrammars = builtins.filter isGitGrammar languagesConfig.grammar; buildGrammar = grammar: let - source = builtins.fetchGit { + source = builtins.fetchTree { + type = "git"; url = grammar.source.git; rev = grammar.source.rev; - allRefs = true; + ref = grammar.source.ref or "HEAD"; + shallow = true; }; in stdenv.mkDerivation rec { # see https://github.com/NixOS/nixpkgs/blob/fbdd1a7c0bc29af5325e0d7dd70e804a972eb465/pkgs/development/tools/parsing/tree-sitter/grammar.nix |