Refactor flake.nix slightly
This commit is contained in:
parent
4e92c0f646
commit
a0fb48c088
2
build.rs
2
build.rs
|
@ -1,5 +1,5 @@
|
|||
fn main() {
|
||||
println!("cargo:rustc-link-search=native=lib");
|
||||
println!("cargo:rustc-link-search=native={}", env!("SITTERS"));
|
||||
for lang in &[
|
||||
#[cfg(feature = "bash")]
|
||||
"bash",
|
||||
|
|
33
flake.nix
33
flake.nix
|
@ -9,7 +9,9 @@
|
|||
|
||||
outputs = { self, nixpkgs, flake-utils, rust-overlay, tree-sitters }:
|
||||
flake-utils.lib.eachDefaultSystem (sys:
|
||||
let pkgs = import nixpkgs {
|
||||
let enabledSitters = ["bash" "c" "python" "rust" "nix" "agda" "html" "javascript"];
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
system = sys;
|
||||
overlays = [ (import rust-overlay) ];
|
||||
};
|
||||
|
@ -20,25 +22,25 @@
|
|||
rustc = rust;
|
||||
cargo = rust;
|
||||
};
|
||||
sitters = tree-sitters.packages.${sys};
|
||||
sitterlist = [
|
||||
sitters.bash sitters.c sitters.python sitters.rust sitters.nix sitters.agda sitters.html sitters.javascript
|
||||
];
|
||||
|
||||
sitterlist = map (lang: tree-sitters.packages.${sys}.${lang}) enabledSitters;
|
||||
|
||||
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 {
|
||||
name = "kak-tree-bin";
|
||||
src = ./.;
|
||||
cargoLock = { lockFile = ./Cargo.lock; };
|
||||
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
|
||||
'';
|
||||
buildFeatures = enabledSitters;
|
||||
doCheck = false;
|
||||
|
||||
SITTERS = sitters;
|
||||
};
|
||||
|
||||
in rec {
|
||||
|
@ -58,6 +60,9 @@
|
|||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = [ rust ];
|
||||
shellHook = ''
|
||||
export SITTERS="${sitters}"
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user