zls/default.nix

41 lines
1.2 KiB
Nix
Raw Normal View History

2020-10-26 03:03:30 +00:00
let
2020-10-31 20:36:37 +00:00
zig-overlay = import (builtins.fetchGit {
url = "https://github.com/arqv/zig-overlay.git";
rev = "a56601116906a2f192702e0b97487b8e7f796fdc";
});
pkgs = import <nixpkgs> { overlays = [ zig-overlay ]; };
gitignoreSrc = pkgs.fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore";
rev = "c4662e662462e7bf3c2a968483478a665d00e717";
sha256 = "1npnx0h6bd0d7ql93ka7azhj40zgjp815fw2r6smg8ch9p7mzdlx";
};
inherit (import gitignoreSrc { inherit (pkgs) lib; }) gitignoreSource;
2020-10-31 20:05:19 +00:00
zig-default = pkgs.zig.master;
2020-10-31 20:36:37 +00:00
in { zig ? zig-default, extraConfig ? { } }:
2020-10-31 20:05:19 +00:00
pkgs.stdenvNoCC.mkDerivation {
name = "zls";
version = "master";
src = gitignoreSource ./.;
2020-10-31 20:36:37 +00:00
nativeBuildInputs = [ zig ];
2020-10-31 20:05:19 +00:00
dontConfigure = true;
2020-10-31 20:36:37 +00:00
dontInstall = true;
2020-10-31 20:05:19 +00:00
buildPhase = ''
mkdir -p $out
2020-10-31 20:36:37 +00:00
zig build install -Drelease-safe=true -Ddata_version=master --prefix $out
2020-10-31 20:05:19 +00:00
cat << EOF > $out/bin/zls.json
2020-10-31 20:36:37 +00:00
${
builtins.toJSON ({
zig_lib_path = "${zig}/lib/zig/";
zig_exe_path = "${zig}/bin/zig";
warn_style = false;
enable_snippets = false;
enable_semantic_tokens = false;
operator_completions = true;
} // extraConfig)
}
2020-10-31 20:05:19 +00:00
EOF
'';
XDG_CACHE_HOME = ".cache";
}