on master help sign in
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.

commite01c53551db82146b59415498fc8f588f237b22c authorMichael Davis <mcarsondavis@gmail.com> dateWed 9 Mar 2022, 08:34 (5 years ago) parent7044d7d
4 files changed+22−47
flake.lock+15−34 flake.nix+1−9 grammars.nix+4−2 languages.toml+2−2
flake.lock+15−34
@@ -25,11 +25,11 @@
2525 ]
2626 },
2727 "locked": {
28− "lastModified": 1646322147,
29− "narHash": "sha256-XwrdjThHPq/APV7B6mXJwYvN/3RmsjX1W4zPgjvCp0A=",
28+ "lastModified": 1646667754,
29+ "narHash": "sha256-LahZHvCC3UVzGQ55iWDRZkuDssXl1rYgqgScrPV9S38=",
3030 "owner": "numtide",
3131 "repo": "devshell",
32− "rev": "2cc45675b223a35ca1d8af6383752c3d4b66f484",
32+ "rev": "59fbe1dfc0de8c3332957c16998a7d16dff365d8",
3333 "type": "github"
3434 },
3535 "original": {
@@ -75,11 +75,11 @@
7575 ]
7676 },
7777 "locked": {
78− "lastModified": 1646647374,
79− "narHash": "sha256-sFGoE9LbHfP5t8NGcNkX4sPVq9kp8+ae8ODnW5eOkzo=",
78+ "lastModified": 1646710334,
79+ "narHash": "sha256-eLBcDgcbOUfeH4k6SEW5a5v0PTp2KNCn+5ZXIoWGYww=",
8080 "owner": "nix-community",
8181 "repo": "dream2nix",
82− "rev": "76412363073ea1252700eb48901849cf8480e138",
82+ "rev": "5dcfbfd3b60ce0208b894c1bdea00e2bdf80ca6a",
8383 "type": "github"
8484 },
8585 "original": {
@@ -119,24 +119,6 @@
119119 "type": "github"
120120 }
121121 },
122− "helix": {
123− "flake": false,
124− "locked": {
125− "lastModified": 1646500939,
126− "narHash": "sha256-M0QvrRuluDkBWUfd5CYwvj9WtgalKlm5stJUAwnhrwI=",
127− "ref": "master",
128− "rev": "7633c5acd30258fc9caca926bfaa264d07d508ec",
129− "revCount": 2438,
130− "submodules": true,
131− "type": "git",
132− "url": "https://github.com/helix-editor/helix.git"
133− },
134− "original": {
135− "submodules": true,
136− "type": "git",
137− "url": "https://github.com/helix-editor/helix.git"
138− }
139− },
140122 "nixCargoIntegration": {
141123 "inputs": {
142124 "devshell": "devshell",
@@ -149,11 +131,11 @@
149131 ]
150132 },
151133 "locked": {
152− "lastModified": 1646681124,
153− "narHash": "sha256-1ytR1z6RyBbxhk0LiO18QBH6Mu1JfAEWuUVBdbD4Bw8=",
134+ "lastModified": 1646766572,
135+ "narHash": "sha256-DV3+zxvAIKsMHsHedJKYFsracvFyLKpFQqurUBR86oY=",
154136 "owner": "yusdacra",
155137 "repo": "nix-cargo-integration",
156− "rev": "3b08d21177cecd5d69bdf76400a6145a021d1e49",
138+ "rev": "3a3f47f43ba486b7554164a698c8dfc5a38624ce",
157139 "type": "github"
158140 },
159141 "original": {
@@ -164,11 +146,11 @@
164146 },
165147 "nixpkgs": {
166148 "locked": {
167− "lastModified": 1646254136,
168− "narHash": "sha256-8nQx02tTzgYO21BP/dy5BCRopE8OwE8Drsw98j+Qoaw=",
149+ "lastModified": 1646497237,
150+ "narHash": "sha256-Ccpot1h/rV8MgcngDp5OrdmLTMaUTbStZTR5/sI7zW0=",
169151 "owner": "nixos",
170152 "repo": "nixpkgs",
171− "rev": "3e072546ea98db00c2364b81491b893673267827",
153+ "rev": "062a0c5437b68f950b081bbfc8a699d57a4ee026",
172154 "type": "github"
173155 },
174156 "original": {
@@ -180,7 +162,6 @@
180162 },
181163 "root": {
182164 "inputs": {
183− "helix": "helix",
184165 "nixCargoIntegration": "nixCargoIntegration",
185166 "nixpkgs": "nixpkgs",
186167 "rust-overlay": "rust-overlay"
@@ -194,11 +175,11 @@
194175 ]
195176 },
196177 "locked": {
197− "lastModified": 1642128126,
198− "narHash": "sha256-av8JUACdrTfQYl/ftZJvKpZEmZfa0avCq7tt5Usdoq0=",
178+ "lastModified": 1646792695,
179+ "narHash": "sha256-2drCXIKIQnJMlTZbcCfuHZAh+iPcdlRkCqtZnA6MHLY=",
199180 "owner": "oxalica",
200181 "repo": "rust-overlay",
201− "rev": "ce4ef6f2d74f2b68f7547df1de22d1b0037ce4ad",
182+ "rev": "7f599870402c8d2a5806086c8ee0f2d92b175c54",
202183 "type": "github"
203184 },
204185 "original": {
flake.nix+1−9
@@ -12,17 +12,9 @@
1212 inputs.nixpkgs.follows = "nixpkgs";
1313 inputs.rustOverlay.follows = "rust-overlay";
1414 };
15− # NOTE: the flake looks like it is hanging when it pulls this input because
16− # the submodules take a long time to clone. This will be fixed in #1659.
17− helix = {
18− url = "https://github.com/helix-editor/helix.git";
19− type = "git";
20− submodules = true;
21− flake = false;
22− };
2315 };
2416
25− outputs = inputs@{ nixCargoIntegration, helix, ... }:
17+ outputs = inputs@{ nixCargoIntegration, ... }:
2618 nixCargoIntegration.lib.makeOutputs {
2719 root = ./.;
2820 renameOutputs = { "helix-term" = "helix"; };
grammars.nix+4−2
@@ -13,10 +13,12 @@ let
1313 gitGrammars = builtins.filter isGitGrammar languagesConfig.grammar;
1414 buildGrammar = grammar:
1515 let
16− source = builtins.fetchGit {
16+ source = builtins.fetchTree {
17+ type = "git";
1718 url = grammar.source.git;
1819 rev = grammar.source.rev;
19− allRefs = true;
20+ ref = grammar.source.ref or "HEAD";
21+ shallow = true;
2022 };
2123 in stdenv.mkDerivation rec {
2224 # see https://github.com/NixOS/nixpkgs/blob/fbdd1a7c0bc29af5325e0d7dd70e804a972eb465/pkgs/development/tools/parsing/tree-sitter/grammar.nix
languages.toml+2−2
@@ -73,7 +73,7 @@ indent = { tab-width = 2, unit = " " }
7373
7474[[grammar]]
7575name = "protobuf"
76−source = { git = "https://github.com/yusdacra/tree-sitter-protobuf", rev = "19c211a01434d9f03efff99f85e19f967591b175" }
76+source = { git = "https://github.com/yusdacra/tree-sitter-protobuf", rev = "19c211a01434d9f03efff99f85e19f967591b175"}
7777
7878[[language]]
7979name = "elixir"
@@ -88,7 +88,7 @@ indent = { tab-width = 2, unit = " " }
8888
8989[[grammar]]
9090name = "elixir"
91−source = { git = "https://github.com/elixir-lang/tree-sitter-elixir", rev = "f5d7bda543da788bd507b05bd722627dde66c9ec" }
91+source = { git = "https://github.com/elixir-lang/tree-sitter-elixir", rev = "f5d7bda543da788bd507b05bd722627dde66c9ec" }
9292
9393[[language]]
9494name = "fish"