From 356cd30269fbb9a378af048fb577328147f0592a Mon Sep 17 00:00:00 2001 From: Guillaume Desforges Date: Thu, 25 Jun 2020 14:23:09 +0200 Subject: [PATCH 1/2] haskell-language-server: init at 0.1.0.0 --- .../haskell-modules/configuration-common.nix | 40 +++++++++++++ .../configuration-hackage2nix.yaml | 3 +- .../haskell-modules/hackage-packages.nix | 32 ++++++++-- .../haskell-modules/non-hackage-packages.nix | 5 ++ .../haskell-language-server/default.nix | 49 ++++++++++++++++ .../haskell-language-server/hls-ghcide.nix | 58 +++++++++++++++++++ .../haskell/haskell-language-server/update.sh | 56 ++++++++++++++++++ 7 files changed, 237 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/tools/haskell/haskell-language-server/default.nix create mode 100644 pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix create mode 100755 pkgs/development/tools/haskell/haskell-language-server/update.sh diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 7ade5ede29d..d22eb95ad3b 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1415,6 +1415,46 @@ self: super: { # 2020-06-24: Tests are broken in hackage distribution. # See: https://github.com/robstewart57/rdf4h/issues/39 rdf4h = dontCheck super.rdf4h; + + # hasn't bumped upper bounds + # test fails: "floskell-test: styles/base.md: openBinaryFile: does not exist (No such file or directory)" + # https://github.com/ennocramer/floskell/issues/48 + floskell = dontCheck (doJailbreak super.floskell); + + # hasn't bumped upper bounds + # test fails because of a "Warning: Unused LANGUAGE pragma" + # https://github.com/ennocramer/monad-dijkstra/issues/4 + monad-dijkstra = dontCheck (doJailbreak super.monad-dijkstra); + + # haskell-language-server uses its own fork of ghcide + # Test disabled: it seems to freeze (is it just that it takes a long time ?) + hls-ghcide = + dontCheck ( + overrideCabal super.hls-ghcide + (old: { + # The integration test run by lsp-test requires the executable to be in the PATH + preCheck = '' + export PATH=$PATH:dist/build/ghcide + ''; + }) + ); + + haskell-language-server = (overrideCabal super.haskell-language-server + (old: { + # The integration test run by lsp-test requires the executable to be in the PATH + preCheck = '' + export PATH=$PATH:dist/build/haskell-language-server + ''; + + # test needs the git tool + testToolDepends = old.testToolDepends + ++ [ pkgs.git ]; + })).override { + # use a fork of ghcide + ghcide = self.hls-ghcide; + # use specific version + ormolu = super.ormolu_0_0_5_0; + }; # https://github.com/kowainik/policeman/issues/57 policeman = doJailbreak super.policeman; diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml index ce7dfc100c6..ec1fa04ebfc 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml @@ -2586,6 +2586,7 @@ extra-packages: - mtl-prelude < 2 # required for to build postgrest on mtl 2.1.x platforms - network == 2.6.3.1 # newer versions don't compile with GHC 7.4.x and below - network == 3.0.* # required by network-bsd, HTTP, and many others (2019-04-30) + - ormolu == 0.0.5.0 # required by haskell-language-server - pantry == 0.2.0.0 # required by stack-2.1.3.1 - parallel == 3.2.0.3 # newer versions don't work with GHC 6.12.3 - patience ^>= 0.1 # required by chell-0.4.x @@ -4988,7 +4989,6 @@ broken-packages: - flite - float-binstring - floating-bits - - floskell - flow-er - flow2dot - flowdock @@ -7698,7 +7698,6 @@ broken-packages: - monad-atom - monad-atom-simple - monad-branch - - monad-dijkstra - monad-exception - monad-finally - monad-fork diff --git a/pkgs/development/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix index b0feb383179..19c5897362b 100644 --- a/pkgs/development/haskell-modules/hackage-packages.nix +++ b/pkgs/development/haskell-modules/hackage-packages.nix @@ -89490,8 +89490,6 @@ self: { ]; description = "A flexible Haskell source code pretty printer"; license = stdenv.lib.licenses.bsd3; - hydraPlatforms = stdenv.lib.platforms.none; - broken = true; }) {}; "flow" = callPackage @@ -169912,8 +169910,6 @@ self: { testHaskellDepends = [ base hlint tasty tasty-hspec ]; description = "A monad transformer for weighted graph searches"; license = stdenv.lib.licenses.bsd3; - hydraPlatforms = stdenv.lib.platforms.none; - broken = true; }) {}; "monad-exception" = callPackage @@ -185372,6 +185368,34 @@ self: { broken = true; }) {}; + "ormolu_0_0_5_0" = callPackage + ({ mkDerivation, base, bytestring, containers, dlist, exceptions + , filepath, ghc-lib-parser, gitrev, hspec, hspec-discover, mtl + , optparse-applicative, path, path-io, syb, text + }: + mkDerivation { + pname = "ormolu"; + version = "0.0.5.0"; + sha256 = "1sf22silpj89sldd7wanlr34nsv77bq0cf4i0q1x2r20pz7s4w4m"; + isLibrary = true; + isExecutable = true; + enableSeparateDataOutput = true; + libraryHaskellDepends = [ + base bytestring containers dlist exceptions ghc-lib-parser mtl syb + text + ]; + executableHaskellDepends = [ + base ghc-lib-parser gitrev optparse-applicative text + ]; + testHaskellDepends = [ + base containers filepath hspec path path-io text + ]; + testToolDepends = [ hspec-discover ]; + description = "A formatter for Haskell source code"; + license = stdenv.lib.licenses.bsd3; + hydraPlatforms = stdenv.lib.platforms.none; + }) {}; + "ormolu" = callPackage ({ mkDerivation, base, bytestring, containers, dlist, exceptions , filepath, ghc-lib-parser, gitrev, hspec, hspec-discover, mtl diff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix index 9a2ff6f4a2a..9b9b61e6c09 100644 --- a/pkgs/development/haskell-modules/non-hackage-packages.nix +++ b/pkgs/development/haskell-modules/non-hackage-packages.nix @@ -16,4 +16,9 @@ self: super: { # spago is not released to Hackage. # https://github.com/spacchetti/spago/issues/512 spago = self.callPackage ../tools/purescript/spago/spago.nix { }; + + # HLS and its fork of ghcide that it uses + # both are auto-generated by pkgs/development/tools/haskell/haskell-language-server/update.sh + haskell-language-server = self.callPackage ../tools/haskell/haskell-language-server { }; + hls-ghcide = self.callPackage ../tools/haskell/haskell-language-server/hls-ghcide.nix { }; } diff --git a/pkgs/development/tools/haskell/haskell-language-server/default.nix b/pkgs/development/tools/haskell/haskell-language-server/default.nix new file mode 100644 index 00000000000..171e87530d2 --- /dev/null +++ b/pkgs/development/tools/haskell/haskell-language-server/default.nix @@ -0,0 +1,49 @@ +{ mkDerivation, aeson, async, base, base16-bytestring, binary +, blaze-markup, brittany, bytestring, Cabal, cabal-helper +, containers, cryptohash-sha1, data-default, deepseq, Diff +, directory, extra, fetchgit, filepath, floskell, ghc, ghc-check +, ghc-paths, ghcide, gitrev, hashable, haskell-lsp +, haskell-lsp-types, hie-bios, hslogger, hspec, hspec-core +, hspec-expectations, lens, lsp-test, optparse-applicative +, optparse-simple, ormolu, process, regex-tdfa, safe-exceptions +, shake, stdenv, stm, stylish-haskell, tasty, tasty-ant-xml +, tasty-expected-failure, tasty-golden, tasty-hunit, tasty-rerun +, text, time, transformers, unix, unordered-containers, yaml +}: +mkDerivation { + pname = "haskell-language-server"; + version = "0.1.0.0"; + src = fetchgit { + url = "https://github.com/haskell/haskell-language-server.git"; + sha256 = "092i32kc9dakl6cg1dpckrb87g4k8s4w1nvrs5x85n9ncgkpqk25"; + rev = "2a192db290bfe8640dafb6c1d650a0815e70d966"; + fetchSubmodules = true; + }; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + aeson base binary brittany bytestring Cabal cabal-helper containers + data-default deepseq Diff directory extra filepath floskell ghc + ghcide gitrev hashable haskell-lsp hie-bios hslogger lens + optparse-simple ormolu process regex-tdfa shake stylish-haskell + text transformers unix unordered-containers + ]; + executableHaskellDepends = [ + aeson async base base16-bytestring binary bytestring containers + cryptohash-sha1 data-default deepseq directory extra filepath ghc + ghc-check ghc-paths ghcide gitrev hashable haskell-lsp hie-bios + hslogger optparse-applicative process safe-exceptions shake text + time unordered-containers + ]; + testHaskellDepends = [ + aeson base blaze-markup bytestring containers data-default + directory filepath haskell-lsp haskell-lsp-types hie-bios hslogger + hspec hspec-core hspec-expectations lens lsp-test stm tasty + tasty-ant-xml tasty-expected-failure tasty-golden tasty-hunit + tasty-rerun text unordered-containers yaml + ]; + testToolDepends = [ ghcide ]; + homepage = "https://github.com/haskell/haskell-language-server#readme"; + description = "LSP server for GHC"; + license = stdenv.lib.licenses.asl20; +} diff --git a/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix b/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix new file mode 100644 index 00000000000..8c68c887295 --- /dev/null +++ b/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix @@ -0,0 +1,58 @@ +{ mkDerivation, aeson, array, async, base, base16-bytestring +, binary, bytestring, Chart, Chart-diagrams, containers +, cryptohash-sha1, data-default, deepseq, diagrams, diagrams-svg +, directory, extra, fetchgit, filepath, fuzzy, ghc, ghc-boot +, ghc-boot-th, ghc-check, ghc-paths, ghc-typelits-knownnat, gitrev +, haddock-library, hashable, haskell-lsp, haskell-lsp-types +, hie-bios, hslogger, lens, lsp-test, mtl, network-uri +, opentelemetry, optparse-applicative, parser-combinators +, prettyprinter, prettyprinter-ansi-terminal, process, QuickCheck +, quickcheck-instances, regex-tdfa, rope-utf16-splay +, safe-exceptions, shake, sorted-list, stdenv, stm, syb, tasty +, tasty-expected-failure, tasty-hunit, tasty-quickcheck +, tasty-rerun, text, time, transformers, unix, unordered-containers +, utf8-string, yaml +}: +mkDerivation { + pname = "ghcide"; + version = "0.2.0"; + src = fetchgit { + url = "https://github.com/wz1000/ghcide"; + sha256 = "0rifbrfvbgv7szgwc5apzb0i5fbkr2spzqvwg5kzng5b4zrf9a9d"; + rev = "cc09b6d4cf03efa645c682347c62850c2291be25"; + fetchSubmodules = true; + }; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + aeson array async base binary bytestring containers data-default + deepseq directory extra filepath fuzzy ghc ghc-boot ghc-boot-th + haddock-library hashable haskell-lsp haskell-lsp-types hslogger mtl + network-uri opentelemetry prettyprinter prettyprinter-ansi-terminal + regex-tdfa rope-utf16-splay safe-exceptions shake sorted-list stm + syb text time transformers unix unordered-containers utf8-string + ]; + executableHaskellDepends = [ + aeson async base base16-bytestring binary bytestring containers + cryptohash-sha1 data-default deepseq directory extra filepath ghc + ghc-check ghc-paths gitrev hashable haskell-lsp haskell-lsp-types + hie-bios hslogger optparse-applicative safe-exceptions shake text + time unordered-containers + ]; + testHaskellDepends = [ + aeson base bytestring containers directory extra filepath ghc + ghc-typelits-knownnat haddock-library haskell-lsp haskell-lsp-types + lens lsp-test network-uri optparse-applicative parser-combinators + process QuickCheck quickcheck-instances rope-utf16-splay + safe-exceptions shake tasty tasty-expected-failure tasty-hunit + tasty-quickcheck tasty-rerun text + ]; + benchmarkHaskellDepends = [ + aeson base bytestring Chart Chart-diagrams containers diagrams + diagrams-svg directory extra filepath lsp-test optparse-applicative + parser-combinators process safe-exceptions shake text yaml + ]; + homepage = "https://github.com/digital-asset/ghcide#readme"; + description = "The core of an IDE"; + license = stdenv.lib.licenses.asl20; +} diff --git a/pkgs/development/tools/haskell/haskell-language-server/update.sh b/pkgs/development/tools/haskell/haskell-language-server/update.sh new file mode 100755 index 00000000000..de1d62d7ed7 --- /dev/null +++ b/pkgs/development/tools/haskell/haskell-language-server/update.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p cabal2nix jq curl +# +# This script will update the haskell-language-server derivation to the latest version using +# cabal2nix. +# +# Note that you should always try building haskell-language-server after updating it here, since +# some of the overrides in pkgs/development/haskell/configuration-nix.nix may +# need to be updated/changed. + +set -eo pipefail + +# This is the directory of this update.sh script. +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +# =========================== +# ghcide fork on https://github.com/wz1000/ghcide +# =========================== + +# ghcide derivation created with cabal2nix. +ghcide_derivation_file="${script_dir}/hls-ghcide.nix" + +# This is the current revision of hls in Nixpkgs. +ghcide_old_version="$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$ghcide_derivation_file")" + +# This is the revision of ghcide used by hls on GitHub. +ghcide_new_version=$(curl --silent "https://api.github.com/repos/haskell/haskell-language-server/contents/ghcide" | jq '.sha' --raw-output) + +echo "Updating haskell-language-server from old version $ghcide_old_version to new version $ghcide_new_version." +echo "Running cabal2nix and outputting to ${ghcide_derivation_file}..." + +cabal2nix --revision "$ghcide_new_version" "https://github.com/wz1000/ghcide" > "$ghcide_derivation_file" + + +# =========================== +# HLS +# =========================== + +# hls derivation created with cabal2nix. +hls_derivation_file="${script_dir}/default.nix" + +# This is the current revision of hls in Nixpkgs. +hls_old_version="$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$hls_derivation_file")" + +# This is the latest release version of hls on GitHub. +hls_new_version=$(curl --silent "https://api.github.com/repos/haskell/haskell-language-server/commits/master" | jq '.sha' --raw-output) + +echo "Updating haskell-language-server from old version $hls_old_version to new version $hls_new_version." +echo "Running cabal2nix and outputting to ${hls_derivation_file}..." + +cabal2nix --revision "$hls_new_version" "https://github.com/haskell/haskell-language-server.git" > "$hls_derivation_file" + +# TODO: This should ideally also automatically update the docsSearchVersion +# from pkgs/development/haskell/configuration-nix.nix. + +echo "Finished." \ No newline at end of file From 2998bc1f779637fa03d259de2e0f573786b67e1b Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 30 Jun 2020 11:21:17 +0900 Subject: [PATCH 2/2] Update pkgs/development/tools/haskell/haskell-language-server/update.sh --- .../tools/haskell/haskell-language-server/update.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkgs/development/tools/haskell/haskell-language-server/update.sh b/pkgs/development/tools/haskell/haskell-language-server/update.sh index de1d62d7ed7..498859843c4 100755 --- a/pkgs/development/tools/haskell/haskell-language-server/update.sh +++ b/pkgs/development/tools/haskell/haskell-language-server/update.sh @@ -50,7 +50,4 @@ echo "Running cabal2nix and outputting to ${hls_derivation_file}..." cabal2nix --revision "$hls_new_version" "https://github.com/haskell/haskell-language-server.git" > "$hls_derivation_file" -# TODO: This should ideally also automatically update the docsSearchVersion -# from pkgs/development/haskell/configuration-nix.nix. - -echo "Finished." \ No newline at end of file +echo "Finished."