about summary refs log tree commit diff
path: root/pkgs/development/tools/misc/nimlsp/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/misc/nimlsp/default.nix')
-rw-r--r--pkgs/development/tools/misc/nimlsp/default.nix36
1 files changed, 10 insertions, 26 deletions
diff --git a/pkgs/development/tools/misc/nimlsp/default.nix b/pkgs/development/tools/misc/nimlsp/default.nix
index b1d59c9450ac..0e837b8fd614 100644
--- a/pkgs/development/tools/misc/nimlsp/default.nix
+++ b/pkgs/development/tools/misc/nimlsp/default.nix
@@ -1,22 +1,9 @@
-{ lib, stdenv, fetchFromGitHub, srcOnly, nim }:
-let
-  astpatternmatching = fetchFromGitHub {
-    owner = "krux02";
-    repo = "ast-pattern-matching";
-    rev = "87f7d163421af5a4f5e5cb6da7b93278e6897e96";
-    sha256 = "19mb5bb6riia8380p5dpc3q0vwgrj958dd6p7vw8vkvwiqrzg6zq";
-  };
+{ lib, nimPackages, fetchFromGitHub, srcOnly, nim }:
 
-  jsonschema = fetchFromGitHub {
-    owner = "PMunch";
-    repo = "jsonschema";
-    rev = "7b41c03e3e1a487d5a8f6b940ca8e764dc2cbabf";
-    sha256 = "1js64jqd854yjladxvnylij4rsz7212k31ks541pqrdzm6hpblbz";
-  };
-in
-stdenv.mkDerivation rec {
+nimPackages.buildNimPackage rec {
   pname = "nimlsp";
   version = "0.3.2";
+  nimBinOnly = true;
 
   src = fetchFromGitHub {
     owner = "PMunch";
@@ -25,18 +12,15 @@ stdenv.mkDerivation rec {
     sha256 = "1lm823nvpp3bj9527jd8n1jxh6y8p8ngkfkj91p94m7ffai6jazq";
   };
 
-  nativeBuildInputs = [ nim ];
+  buildInputs = with nimPackages; [ astpatternmatching jsonschema ];
 
-  buildPhase = ''
-    export HOME=$TMPDIR
-    nim -d:release -p:${astpatternmatching}/src -p:${jsonschema}/src \
-      c --threads:on -d:nimcore -d:nimsuggest -d:debugCommunication \
-      -d:debugLogging -d:explicitSourcePath=${srcOnly nim.passthru.nim} -d:tempDir=/tmp src/nimlsp
-  '';
+  nimFlags = [
+    "--threads:on"
+    "-d:explicitSourcePath=${srcOnly nimPackages.nim.passthru.nim}"
+    "-d:tempDir=/tmp"
+  ];
 
-  installPhase = ''
-    install -Dt $out/bin src/nimlsp
-  '';
+  nimDefines = [ "nimcore" "nimsuggest" "debugCommunication" "debugLogging" ];
 
   meta = with lib; {
     description = "Language Server Protocol implementation for Nim";