Compare commits
No commits in common. "d80739e62df7f788f0c8a009dbcf9d503e71de76" and "4e92c0f646c3e4c2e7bb962b61424ad6286721a3" have entirely different histories.
d80739e62d
...
4e92c0f646
|
@ -77,13 +77,13 @@ group.number = ["integer_literal", "float_literal", "negative_literal"]
|
||||||
|
|
||||||
If you are using nix, the `flake.nix` file provides an attribute `packages.kak-tree` resolving to a kakoune plugin one can use in home-manager's `programs.kakoune.plugins` or build yourself with `kakoune.override { plugins = ... }`.
|
If you are using nix, the `flake.nix` file provides an attribute `packages.kak-tree` resolving to a kakoune plugin one can use in home-manager's `programs.kakoune.plugins` or build yourself with `kakoune.override { plugins = ... }`.
|
||||||
|
|
||||||
If not, you will have to set up the build environment yourself. Since we use static linking, compile each tree sitter plugin to a statically linked library to `./sitters/libtree-sitter-LANG.a`, and then build:
|
If not, you will have to set up the build environment yourself. Since we use static linking, compile each tree sitter plugin to a statically linked library to `lib/libtree-sitter-LANG.a`, and then build:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ [ compile tree sitter for i.e. javascript... ]
|
$ [ compile tree sitter for i.e. javascript... ]
|
||||||
$ ls sitters
|
$ ls lib
|
||||||
libtree-sitter-javascript.a
|
libtree-sitter-javascript.a
|
||||||
$ SITTERS=./sitters cargo build --no-default-features --features javascript --release
|
$ cargo build --no-default-features --features javascript --release
|
||||||
[ ... ]
|
[ ... ]
|
||||||
$ ./target/release/kak-tree --do-you-understand javascript
|
$ ./target/release/kak-tree --do-you-understand javascript
|
||||||
Known language. Trying to load
|
Known language. Trying to load
|
||||||
|
|
2
build.rs
2
build.rs
|
@ -1,5 +1,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rustc-link-search=native={}", env!("SITTERS"));
|
println!("cargo:rustc-link-search=native=lib");
|
||||||
for lang in &[
|
for lang in &[
|
||||||
#[cfg(feature = "bash")]
|
#[cfg(feature = "bash")]
|
||||||
"bash",
|
"bash",
|
||||||
|
|
33
flake.nix
33
flake.nix
|
@ -9,9 +9,7 @@
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, rust-overlay, tree-sitters }:
|
outputs = { self, nixpkgs, flake-utils, rust-overlay, tree-sitters }:
|
||||||
flake-utils.lib.eachDefaultSystem (sys:
|
flake-utils.lib.eachDefaultSystem (sys:
|
||||||
let enabledSitters = ["bash" "c" "python" "rust" "nix" "agda" "html" "javascript"];
|
let pkgs = import nixpkgs {
|
||||||
|
|
||||||
pkgs = import nixpkgs {
|
|
||||||
system = sys;
|
system = sys;
|
||||||
overlays = [ (import rust-overlay) ];
|
overlays = [ (import rust-overlay) ];
|
||||||
};
|
};
|
||||||
|
@ -22,25 +20,25 @@
|
||||||
rustc = rust;
|
rustc = rust;
|
||||||
cargo = rust;
|
cargo = rust;
|
||||||
};
|
};
|
||||||
|
sitters = tree-sitters.packages.${sys};
|
||||||
sitterlist = map (lang: tree-sitters.packages.${sys}.${lang}) enabledSitters;
|
sitterlist = [
|
||||||
|
sitters.bash sitters.c sitters.python sitters.rust sitters.nix sitters.agda sitters.html sitters.javascript
|
||||||
sitters = pkgs.runCommand "sitters" {inherit sitterlist;} ''
|
];
|
||||||
mkdir -p $out
|
|
||||||
for sitter in $sitterlist ; do
|
|
||||||
echo "Copying $sitter"
|
|
||||||
cp $sitter/lib/*.a $out
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
|
|
||||||
kak-tree-bin = platform.buildRustPackage {
|
kak-tree-bin = platform.buildRustPackage {
|
||||||
name = "kak-tree-bin";
|
name = "kak-tree-bin";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
cargoLock = { lockFile = ./Cargo.lock; };
|
cargoLock = { lockFile = ./Cargo.lock; };
|
||||||
buildFeatures = enabledSitters;
|
buildFeatures = ["bash" "c" "python" "rust" "nix" "agda" "html" "javascript"];
|
||||||
|
inherit sitterlist;
|
||||||
|
preBuild = ''
|
||||||
|
mkdir lib
|
||||||
|
for sitter in $sitterlist ; do
|
||||||
|
echo "Copying $sitter"
|
||||||
|
cp $sitter/lib/* lib
|
||||||
|
done
|
||||||
|
'';
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
SITTERS = sitters;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in rec {
|
in rec {
|
||||||
|
@ -60,9 +58,6 @@
|
||||||
};
|
};
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
packages = [ rust ];
|
packages = [ rust ];
|
||||||
shellHook = ''
|
|
||||||
export SITTERS="${sitters}"
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user