From cc3e5198707b9b5523643e791677d4135fb3aee7 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Thu, 8 Jun 2023 22:44:51 +0800 Subject: [PATCH] nixd: init at 1.0.0 nixd: use fixed nix version (i.e. nix 2.16) nixd: address comments from @SharzyL nixd: comment https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1223259634 nixd: remove "nix" from nativeBuildInputs nixd: address https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1223507941 nixd: address https://github.com/NixOS/nixpkgs/pull/236675#issuecomment-1583207666 Now tests are passing nixd: disable nixd regression tests (i.e. `regression/nixd`) nixd: use `llvmPackages_16.libcxxStdenv` on darwin for C++20 `ranges` Revert "nixd: use `llvmPackages_16.libcxxStdenv` on darwin for C++20 `ranges`" This reverts commit 117d75aa2291dbf666e1ccdaecd22de78ce6617b. The complied binary SIGSEGVs on tests, looks like this is an upstream issue, I would like to mark it broken on darwin for now. nixd: mark it is broken on darwin See upstream issue: https://github.com/nix-community/nixd/issues/107 nixd: reorder inputs https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1225995719 nixd: set package in `all-packages.nix` https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1225995937 nixd: do not parameterize pname https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1225995988 nixd: CXXFLAGS -> env.CXXFLAGS https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1225996031 nixd: https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1225996269 Co-authored-by: Anderson Torres nixd: https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1225996546 Co-authored-by: Anderson Torres Revert "nixd: https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1225996269" This reverts commit 9ee792adad17baba242b1df9da144fd4cc8df032. eval: line 1598: syntax error near unexpected token `(' nixd: https://github.com/NixOS/nixpkgs/pull/236675#discussion_r1225996400 Squashed commits: https://github.com/NixOS/nixpkgs/pull/236675#issuecomment-1587405762 --- .../tools/language-servers/nixd/default.nix | 81 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 5 ++ 2 files changed, 86 insertions(+) create mode 100644 pkgs/development/tools/language-servers/nixd/default.nix diff --git a/pkgs/development/tools/language-servers/nixd/default.nix b/pkgs/development/tools/language-servers/nixd/default.nix new file mode 100644 index 000000000000..4bf1af6a01c7 --- /dev/null +++ b/pkgs/development/tools/language-servers/nixd/default.nix @@ -0,0 +1,81 @@ +{ lib +, stdenv +, fetchFromGitHub +, boost182 +, gtest +, libbacktrace +, lit +, llvmPackages +, meson +, ninja +, nix +, nixpkgs-fmt +, pkg-config +}: + +stdenv.mkDerivation rec { + pname = "nixd"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "nix-community"; + repo = "nixd"; + rev = version; + hash = "sha256-kTDPbsQi9gzFAFkiAPF+V3yI1WBmILEnnsqdgHMqXJA="; + }; + + mesonBuildType = "release"; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + 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 + ''; + + meta = { + description = "Nix language server"; + homepage = "https://github.com/nix-community/nixd"; + license = lib.licenses.lgpl3Plus; + maintainers = with lib.maintainers; [ inclyc ]; + platforms = lib.platforms.unix; + broken = stdenv.isDarwin; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c13b716a0e9a..0ec85de2ffdd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17798,6 +17798,11 @@ with pkgs; nil = callPackage ../development/tools/language-servers/nil { }; + nixd = callPackage ../development/tools/language-servers/nixd { + llvmPackages = llvmPackages_16; + nix = nixVersions.nix_2_16; + }; + nls = callPackage ../development/tools/language-servers/nls { }; pylyzer = callPackage ../development/tools/language-servers/pylyzer { };