Commit a3ccdee0 authored by Anderson Torres's avatar Anderson Torres
Browse files

zls: use zigHook

Also, a cosmetic refactor:

- Reorder parameter listing
- Use rec-less, overlay-style overridable recursive attributes (in effect since
NixOS#119942);
- Remove nested with (according to
https://nix.dev/recipes/best-practices#with-scopes)
parent 5c68e0e7
Loading
Loading
Loading
Loading
+18 −22
Original line number Diff line number Diff line
{ stdenv, lib, fetchFromGitHub, zig }:
{ lib
, stdenv
, fetchFromGitHub
, zigHook
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "zls";
  version = "0.10.0";

  src = fetchFromGitHub {
    owner = "zigtools";
    repo = pname;
    rev = version;
    sha256 = "sha256-M0GG4KIMcHN+bEprUv6ISZkWNvWN12S9vqSKP+DRU9M=";
    repo = "zls";
    rev = finalAttrs.version;
    fetchSubmodules = true;
    hash = "sha256-M0GG4KIMcHN+bEprUv6ISZkWNvWN12S9vqSKP+DRU9M=";
  };

  nativeBuildInputs = [ zig ];
  nativeBuildInputs = [
    zigHook
  ];

  dontConfigure = true;

  preBuild = ''
    export HOME=$TMPDIR
  '';

  installPhase = ''
    runHook preInstall
    zig build -Drelease-safe -Dcpu=baseline --prefix $out install
    runHook postInstall
  '';

  meta = with lib; {
  meta = {
    description = "Zig LSP implementation + Zig Language Server";
    changelog = "https://github.com/zigtools/zls/releases/tag/${version}";
    changelog = "https://github.com/zigtools/zls/releases/tag/${finalAttrs.version}";
    homepage = "https://github.com/zigtools/zls";
    license = licenses.mit;
    maintainers = with maintainers; [ fortuneteller2k ];
    platforms = platforms.unix;
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fortuneteller2k ];
    platforms = lib.platforms.unix;
  };
}
})
+3 −1
Original line number Diff line number Diff line
@@ -18269,8 +18269,10 @@ with pkgs;
  vscode-langservers-extracted = callPackage ../development/tools/language-servers/vscode-langservers-extracted { };
  zls = callPackage ../development/tools/language-servers/zls {
    zigHook = zigHook.override {
      zig = buildPackages.zig_0_10;
    };
  };
  ansible-later = callPackage ../tools/admin/ansible/later.nix { };