vegetable-hamper/nix/zls/default.nix
2024-05-03 17:30:08 +02:00

51 lines
1.4 KiB
Nix

{
# { lib
# , stdenv
# , fetchFromGitHub
# , zig_0_11
# , callPackage
# }:
perSystem =
{ pkgs, lib, ... }:
{
packages.zls = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "zls";
version = "0.12.0";
src = pkgs.fetchFromGitHub {
owner = "zigtools";
repo = "zls";
rev = finalAttrs.version;
fetchSubmodules = true;
hash = "sha256-2iVDPUj9ExgTooDQmCCtZs3wxBe2be9xjzAk9HedPNY=";
};
langref = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/ziglang/zig/a685ab1499d6560c523f0dbce2890dc140671e43/doc/langref.html.in";
hash = "sha256-7lFSfkVLOrn42nYnYyDmBkkRfM903lUUJZ5Sg+eBUpE=";
};
zigBuildFlags = [ "-Dversion_data_path=${finalAttrs.langref}" ];
nativeBuildInputs = [ pkgs.zig_0_12.hook ];
postPatch = ''
ln -s ${pkgs.callPackage ./deps.nix { }} $ZIG_GLOBAL_CACHE_DIR/p
'';
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;
};
});
};
}