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)
This commit is contained in:
Anderson Torres 2023-07-09 23:05:13 -03:00
parent 5c68e0e7e1
commit a3ccdee063
2 changed files with 21 additions and 23 deletions

View file

@ -1,37 +1,33 @@
{ 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;
};
}
})

View file

@ -18269,7 +18269,9 @@ with pkgs;
vscode-langservers-extracted = callPackage ../development/tools/language-servers/vscode-langservers-extracted { };
zls = callPackage ../development/tools/language-servers/zls {
zig = buildPackages.zig_0_10;
zigHook = zigHook.override {
zig = buildPackages.zig_0_10;
};
};
ansible-later = callPackage ../tools/admin/ansible/later.nix { };