vegetable-hamper/nix/zls/default.nix

52 lines
1.4 KiB
Nix
Raw Normal View History

2024-05-03 17:16:20 +02:00
{
# { lib
# , stdenv
# , fetchFromGitHub
# , zig_0_11
# , callPackage
# }:
perSystem =
{ pkgs, lib, ... }:
{
2024-05-03 17:30:08 +02:00
packages.zls = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "zls";
version = "0.12.0";
2024-05-03 17:16:20 +02:00
2024-05-03 17:30:08 +02:00
src = pkgs.fetchFromGitHub {
owner = "zigtools";
repo = "zls";
rev = finalAttrs.version;
fetchSubmodules = true;
hash = "sha256-2iVDPUj9ExgTooDQmCCtZs3wxBe2be9xjzAk9HedPNY=";
};
2024-05-03 17:16:20 +02:00
2024-05-03 17:30:08 +02:00
langref = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/ziglang/zig/a685ab1499d6560c523f0dbce2890dc140671e43/doc/langref.html.in";
hash = "sha256-7lFSfkVLOrn42nYnYyDmBkkRfM903lUUJZ5Sg+eBUpE=";
};
2024-05-03 17:16:20 +02:00
2024-05-03 17:30:08 +02:00
zigBuildFlags = [ "-Dversion_data_path=${finalAttrs.langref}" ];
2024-05-03 17:16:20 +02:00
2024-05-03 17:30:08 +02:00
nativeBuildInputs = [ pkgs.zig_0_12.hook ];
2024-05-03 17:16:20 +02:00
2024-05-03 17:30:08 +02:00
postPatch = ''
ln -s ${pkgs.callPackage ./deps.nix { }} $ZIG_GLOBAL_CACHE_DIR/p
'';
2024-05-03 17:16:20 +02:00
2024-05-03 17:30:08 +02:00
meta = {
description = "Zig LSP implementation + Zig Language Server";
mainProgram = "zls";
changelog = "https://github.com/zigtools/zls/releases/tag/${finalAttrs.version}";
homepage = "https://github.com/zigtools/zls";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
figsoda
moni
];
platforms = lib.platforms.unix;
};
});
2024-05-03 17:16:20 +02:00
};
}