depot/third_party/nixpkgs/pkgs/development/tools/language-servers/nixd/default.nix
Default email 9c6ee729d6 Project import generated by Copybara.
GitOrigin-RevId: 6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222
2023-07-15 19:15:38 +02:00

87 lines
1.6 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, nix-update-script
, bison
, boost182
, flex
, gtest
, libbacktrace
, lit
, llvmPackages
, meson
, ninja
, nix
, nixpkgs-fmt
, pkg-config
}:
stdenv.mkDerivation rec {
pname = "nixd";
version = "1.2.0";
src = fetchFromGitHub {
owner = "nix-community";
repo = "nixd";
rev = version;
hash = "sha256-3PI/Bzs5WPIKevbRPz6TQ5yo7QpY4HeALrqbUY/zUgY=";
};
mesonBuildType = "release";
nativeBuildInputs = [
meson
ninja
pkg-config
bison
flex
];
nativeCheckInputs = [
lit
nixpkgs-fmt
];
buildInputs = [
libbacktrace
nix
gtest
boost182
llvmPackages.llvm
];
env.CXXFLAGS = "-include ${nix.dev}/include/nix/config.h";
doCheck = true;
checkPhase = ''
runHook preCheck
dirs=(store var var/nix var/log/nix etc home)
for dir in $dirs; do
mkdir -p "$TMPDIR/$dir"
done
export NIX_STORE_DIR=$TMPDIR/store
export NIX_LOCALSTATE_DIR=$TMPDIR/var
export NIX_STATE_DIR=$TMPDIR/var/nix
export NIX_LOG_DIR=$TMPDIR/var/log/nix
export NIX_CONF_DIR=$TMPDIR/etc
export HOME=$TMPDIR/home
# Disable nixd regression tests, because it uses some features provided by
# nix, and does not correctly work in the sandbox
meson test --print-errorlogs server regression/nix-ast-dump
runHook postCheck
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Nix language server";
homepage = "https://github.com/nix-community/nixd";
license = lib.licenses.lgpl3Plus;
maintainers = with lib.maintainers; [ inclyc Ruixi-rebirth ];
platforms = lib.platforms.unix;
};
}