aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2022-03-09 14:34:52 +0000
committerBlaž Hrastnik2022-03-10 08:31:57 +0000
commite01c53551db82146b59415498fc8f588f237b22c (patch)
treeccc4f8666e5f359fbbe4614ae97aa13a4e134b9b
parent7044d7d804ad798207594e1b3bb5bd80a96d3da0 (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.
-rw-r--r--flake.lock49
-rw-r--r--flake.nix10
-rw-r--r--grammars.nix6
-rw-r--r--languages.toml4
4 files changed, 22 insertions, 47 deletions
diff --git a/flake.lock b/flake.lock
index f061c80f..40a87eb5 100644
--- a/flake.lock
+++ b/flake.lock
@@ -25,11 +25,11 @@
]
},
"locked": {
- "lastModified": 1646322147,
- "narHash": "sha256-XwrdjThHPq/APV7B6mXJwYvN/3RmsjX1W4zPgjvCp0A=",
+ "lastModified": 1646667754,
+ "narHash": "sha256-LahZHvCC3UVzGQ55iWDRZkuDssXl1rYgqgScrPV9S38=",
"owner": "numtide",
"repo": "devshell",
- "rev": "2cc45675b223a35ca1d8af6383752c3d4b66f484",
+ "rev": "59fbe1dfc0de8c3332957c16998a7d16dff365d8",
"type": "github"
},
"original": {
@@ -75,11 +75,11 @@
]
},
"locked": {
- "lastModified": 1646647374,
- "narHash": "sha256-sFGoE9LbHfP5t8NGcNkX4sPVq9kp8+ae8ODnW5eOkzo=",
+ "lastModified": 1646710334,
+ "narHash": "sha256-eLBcDgcbOUfeH4k6SEW5a5v0PTp2KNCn+5ZXIoWGYww=",
"owner": "nix-community",
"repo": "dream2nix",
- "rev": "76412363073ea1252700eb48901849cf8480e138",
+ "rev": "5dcfbfd3b60ce0208b894c1bdea00e2bdf80ca6a",
"type": "github"
},
"original": {
@@ -119,24 +119,6 @@
"type": "github"
}
},
- "helix": {
- "flake": false,
- "locked": {
- "lastModified": 1646500939,
- "narHash": "sha256-M0QvrRuluDkBWUfd5CYwvj9WtgalKlm5stJUAwnhrwI=",
- "ref": "master",
- "rev": "7633c5acd30258fc9caca926bfaa264d07d508ec",
- "revCount": 2438,
- "submodules": true,
- "type": "git",
- "url": "https://github.com/helix-editor/helix.git"
- },
- "original": {
- "submodules": true,
- "type": "git",
- "url": "https://github.com/helix-editor/helix.git"
- }
- },
"nixCargoIntegration": {
"inputs": {
"devshell": "devshell",
@@ -149,11 +131,11 @@
]
},
"locked": {
- "lastModified": 1646681124,
- "narHash": "sha256-1ytR1z6RyBbxhk0LiO18QBH6Mu1JfAEWuUVBdbD4Bw8=",
+ "lastModified": 1646766572,
+ "narHash": "sha256-DV3+zxvAIKsMHsHedJKYFsracvFyLKpFQqurUBR86oY=",
"owner": "yusdacra",
"repo": "nix-cargo-integration",
- "rev": "3b08d21177cecd5d69bdf76400a6145a021d1e49",
+ "rev": "3a3f47f43ba486b7554164a698c8dfc5a38624ce",
"type": "github"
},
"original": {
@@ -164,11 +146,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1646254136,
- "narHash": "sha256-8nQx02tTzgYO21BP/dy5BCRopE8OwE8Drsw98j+Qoaw=",
+ "lastModified": 1646497237,
+ "narHash": "sha256-Ccpot1h/rV8MgcngDp5OrdmLTMaUTbStZTR5/sI7zW0=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "3e072546ea98db00c2364b81491b893673267827",
+ "rev": "062a0c5437b68f950b081bbfc8a699d57a4ee026",
"type": "github"
},
"original": {
@@ -180,7 +162,6 @@
},
"root": {
"inputs": {
- "helix": "helix",
"nixCargoIntegration": "nixCargoIntegration",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
@@ -194,11 +175,11 @@
]
},
"locked": {
- "lastModified": 1642128126,
- "narHash": "sha256-av8JUACdrTfQYl/ftZJvKpZEmZfa0avCq7tt5Usdoq0=",
+ "lastModified": 1646792695,
+ "narHash": "sha256-2drCXIKIQnJMlTZbcCfuHZAh+iPcdlRkCqtZnA6MHLY=",
"owner": "oxalica",
"repo": "rust-overlay",
- "rev": "ce4ef6f2d74f2b68f7547df1de22d1b0037ce4ad",
+ "rev": "7f599870402c8d2a5806086c8ee0f2d92b175c54",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index e1cd5036..38ba9fd0 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,17 +12,9 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.rustOverlay.follows = "rust-overlay";
};
- # NOTE: the flake looks like it is hanging when it pulls this input because
- # the submodules take a long time to clone. This will be fixed in #1659.
- helix = {
- url = "https://github.com/helix-editor/helix.git";
- type = "git";
- submodules = true;
- flake = false;
- };
};
- outputs = inputs@{ nixCargoIntegration, helix, ... }:
+ outputs = inputs@{ nixCargoIntegration, ... }:
nixCargoIntegration.lib.makeOutputs {
root = ./.;
renameOutputs = { "helix-term" = "helix"; };
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
diff --git a/languages.toml b/languages.toml
index 18182011..b0ed4b34 100644
--- a/languages.toml
+++ b/languages.toml
@@ -73,7 +73,7 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "protobuf"
-source = { git = "https://github.com/yusdacra/tree-sitter-protobuf", rev = "19c211a01434d9f03efff99f85e19f967591b175" }
+source = { git = "https://github.com/yusdacra/tree-sitter-protobuf", rev = "19c211a01434d9f03efff99f85e19f967591b175"}
[[language]]
name = "elixir"
@@ -88,7 +88,7 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "elixir"
-source = { git = "https://github.com/elixir-lang/tree-sitter-elixir", rev = "f5d7bda543da788bd507b05bd722627dde66c9ec" }
+source = { git = "https://github.com/elixir-lang/tree-sitter-elixir", rev = "f5d7bda543da788bd507b05bd722627dde66c9ec" }
[[language]]
name = "fish"