From bf29c147c3fc616267868da67b28c3253e78b0c8 Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Tue, 10 Nov 2020 22:07:19 +0100 Subject: [PATCH] haskellPackages.haskell-language-server: Fix build In preparation of the upcoming 0.6.0 release I wanted to fix hls. It introduces two new plugin packages, which are not on hackage yet. I remove apply-refact overrides, because current apply-refact versions are compatible with all ghcs we support, according to their changelog. I override more of the hls dependencies globally on the whole package set, to avoid a lot of duplicate compilations. And because @peti changed my mind about this being a good practice. hls now uses a released version of ghcide --- .../haskell-modules/configuration-common.nix | 44 ++++++-------- .../configuration-ghc-8.10.x.nix | 3 - .../configuration-ghc-8.6.x.nix | 3 - .../configuration-ghc-8.8.x.nix | 3 - .../configuration-hackage2nix.yaml | 4 -- .../haskell-modules/non-hackage-packages.nix | 3 +- .../haskell-language-server/default.nix | 28 ++++----- .../haskell-language-server/hls-ghcide.nix | 60 ------------------- .../hls-hlint-plugin.nix | 26 ++++++++ .../hls-tactics-plugin.nix | 32 ++++++++++ .../haskell/haskell-language-server/update.sh | 20 +------ 11 files changed, 95 insertions(+), 131 deletions(-) delete mode 100644 pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix create mode 100644 pkgs/development/tools/haskell/haskell-language-server/hls-hlint-plugin.nix create mode 100644 pkgs/development/tools/haskell/haskell-language-server/hls-tactics-plugin.nix diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 364f6370e0f4..c4b10e436ace 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1229,14 +1229,6 @@ self: super: { sha256 = "0xbfhzhzg94b4r5qy5dg1c40liswwpqarrc2chcwgfbfnrmwkfc2"; }); - # this will probably need to get updated with every ghcide update, - # we need an override because ghcide is tracking haskell-lsp closely. - ghcide = dontCheck (super.ghcide.overrideScope (self: super: { - hie-bios = dontCheck super.hie-bios_0_7_1; - lsp-test = dontCheck self.lsp-test_0_11_0_7; - })); - implicit-hie-cradle = super.implicit-hie-cradle.override { hie-bios = dontCheck super.hie-bios_0_7_1; }; - # hasn‘t bumped upper bounds # upstream: https://github.com/obsidiansystems/which/pull/6 which = doJailbreak super.which; @@ -1459,25 +1451,27 @@ self: super: { # INSERT NEW OVERRIDES ABOVE THIS LINE } // (let - inherit (self) hls-ghcide hls-brittany; - hlsScopeOverride = self: super: { - # haskell-language-server uses its own fork of ghcide - # Test disabled: it seems to freeze (is it just that it takes a long time ?) - ghcide = dontCheck hls-ghcide; - # we are faster than stack here - hie-bios = dontCheck super.hie-bios_0_7_1; - lsp-test = dontCheck super.lsp-test_0_11_0_7; - # fourmolu can‘t compile with an older aeson + # fourmolu can‘t compile with an older aeson + overrideAeson = name: value: value.overrideScope (self: super: { aeson = dontCheck super.aeson_1_5_2_0; - # brittany has an aeson upper bound of 1.5 - brittany = hls-brittany; + }); + in pkgs.lib.mapAttrs overrideAeson { + # tons of overrides for bleeding edge versions for ghcide and hls + # overriding aeson on all of them to prevent double compilations + # this shouldn‘t break anything because nearly all their reverse deps are + # in this list or marked as broken anyways + haskell-language-server = dontCheck super.haskell-language-server; + fourmolu = dontCheck super.fourmolu; + stylish-haskell = super.stylish-haskell_0_12_2_0; + ghcide = dontCheck super.ghcide; + refinery = super.refinery_0_3_0_0; data-tree-print = doJailbreak super.data-tree-print; ghc-exactprint = dontCheck super.ghc-exactprint_0_6_3_2; - }; - in { - haskell-language-server = dontCheck (super.haskell-language-server.overrideScope hlsScopeOverride); - hls-ghcide = dontCheck (super.hls-ghcide.overrideScope hlsScopeOverride); - hls-brittany = dontCheck (super.hls-brittany.overrideScope hlsScopeOverride); - fourmolu = dontCheck (super.fourmolu.overrideScope hlsScopeOverride); + hie-bios = dontCheck super.hie-bios_0_7_1; + lsp-test = dontCheck super.lsp-test_0_11_0_7; + # the hls brittany is objectively better, because there hasn‘t been a + # brittany release in a while and this version works with 8.10. + # And we need to build it anyways. + brittany = dontCheck super.hls-brittany; } ) // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix index 047c5ba481fb..b801a08a9eab 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix @@ -111,9 +111,6 @@ self: super: { sha256 = "0rgzrq0513nlc1vw7nw4km4bcwn4ivxcgi33jly4a7n3c1r32v1f"; }); - # Only 0.8 is compatible with ghc 8.10 https://hackage.haskell.org/package/apply-refact/changelog - apply-refact = super.apply-refact_0_8_0_0; - # https://github.com/commercialhaskell/pantry/issues/21 pantry = appendPatch super.pantry (pkgs.fetchpatch { name = "add-cabal-3.2.x-support.patch"; diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix index f2da20426ace..0a64c20ea7a5 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix @@ -91,7 +91,4 @@ self: super: { # ghc versions prior to 8.8.x needs additional dependency to compile successfully. ghc-lib-parser-ex = addBuildDepend super.ghc-lib-parser-ex self.ghc-lib-parser; - - # Only 0.6 is compatible with ghc 8.6 https://hackage.haskell.org/package/apply-refact/changelog - apply-refact = super.apply-refact_0_6_0_0; } diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix index d0a070a72e15..718186c9f38f 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix @@ -104,9 +104,6 @@ self: super: { # of issues with Cabal 3.x. darcs = dontDistribute super.darcs; - # Only 0.7 is compatible with ghc 8.7 https://hackage.haskell.org/package/apply-refact/changelog - apply-refact = super.apply-refact_0_7_0_0; - # The package needs the latest Cabal version. cabal-install-parsers = super.cabal-install-parsers.overrideScope (self: super: { Cabal = self.Cabal_3_2_1_0; }); diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml index c232eb7162ad..9ff253a42326 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml @@ -2546,10 +2546,6 @@ extra-packages: - aeson-pretty < 0.8 # required by elm compiler - Agda == 2.6.1 # allows the agdaPackage set to be fixed to this version so that it won't break when another agda version is released. - ansi-terminal == 0.10.3 # required by cabal-plan, and policeman in ghc-8.8.x - - apply-refact < 0.4 # newer versions don't work with GHC 8.0.x - - apply-refact == 0.6.0.0 # works with GHC 8.6.x https://hackage.haskell.org/package/apply-refact/changelog - - apply-refact == 0.7.0.0 # works with GHC 8.8.x https://hackage.haskell.org/package/apply-refact/changelog - - apply-refact == 0.8.0.0 # works with GHC 8.10.x https://hackage.haskell.org/package/apply-refact/changelog - binary > 0.7 && < 0.8 # keep a 7.x major release around for older compilers - binary > 0.8 && < 0.9 # keep a 8.x major release around for older compilers - Cabal == 2.2.* # required for jailbreak-cabal etc. diff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix index 52a2737ebb74..c79673a28646 100644 --- a/pkgs/development/haskell-modules/non-hackage-packages.nix +++ b/pkgs/development/haskell-modules/non-hackage-packages.nix @@ -22,8 +22,9 @@ self: super: { # 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 { }; hls-brittany = self.callPackage ../tools/haskell/haskell-language-server/hls-brittany.nix { }; + hls-hlint-plugin = self.callPackage ../tools/haskell/haskell-language-server/hls-hlint-plugin.nix { }; + hls-tactics-plugin = self.callPackage ../tools/haskell/haskell-language-server/hls-tactics-plugin.nix { }; nix-output-monitor = self.callPackage ../../tools/nix/nix-output-monitor { }; diff --git a/pkgs/development/tools/haskell/haskell-language-server/default.nix b/pkgs/development/tools/haskell/haskell-language-server/default.nix index 0c1b6d0dbcca..530ed7c28391 100644 --- a/pkgs/development/tools/haskell/haskell-language-server/default.nix +++ b/pkgs/development/tools/haskell/haskell-language-server/default.nix @@ -1,22 +1,22 @@ { mkDerivation, aeson, base, binary, blaze-markup, brittany , bytestring, containers, data-default, deepseq, directory, extra -, fetchgit, filepath, fingertree, floskell, fourmolu, ghc -, ghc-boot-th, ghc-exactprint, ghc-paths, ghc-source-gen, ghcide -, gitrev, hashable, haskell-lsp, hie-bios, hls-plugin-api, hslogger +, fetchgit, filepath, floskell, fourmolu, ghc, ghc-boot-th +, ghc-paths, ghcide, gitrev, hashable, haskell-lsp, hie-bios +, hls-hlint-plugin, hls-plugin-api, hls-tactics-plugin, hslogger , hspec, hspec-core, lens, lsp-test, mtl, optparse-applicative -, optparse-simple, ormolu, process, refinery, regex-tdfa, retrie -, safe-exceptions, shake, stdenv, stm, stylish-haskell, syb, tasty +, optparse-simple, ormolu, process, regex-tdfa, retrie +, safe-exceptions, shake, stdenv, stm, stylish-haskell, tasty , tasty-ant-xml, tasty-expected-failure, tasty-golden, tasty-hunit , tasty-rerun, temporary, text, time, transformers , unordered-containers, yaml }: mkDerivation { pname = "haskell-language-server"; - version = "0.5.0.0"; + version = "0.5.1.0"; src = fetchgit { url = "https://github.com/haskell/haskell-language-server.git"; - sha256 = "1qi762fa72487i8fspxmr8xizm9n2s1shxsvnvsl67vj9if573r9"; - rev = "3ca2a6cd267f373aae19f59e1cf9e04b6524eff3"; + sha256 = "1w15p988a5h11fcp25lllaj7j78f35gzg5bixy1vs7ld0p6jj7n9"; + rev = "8682517e9ff92caa35e727e28445896f97c61e8d"; fetchSubmodules = true; }; isLibrary = true; @@ -29,12 +29,12 @@ mkDerivation { ]; executableHaskellDepends = [ aeson base binary brittany bytestring containers deepseq directory - extra filepath fingertree floskell fourmolu ghc ghc-boot-th - ghc-exactprint ghc-paths ghc-source-gen ghcide gitrev hashable - haskell-lsp hie-bios hls-plugin-api hslogger lens mtl - optparse-applicative optparse-simple ormolu process refinery - regex-tdfa retrie safe-exceptions shake stylish-haskell syb - temporary text time transformers unordered-containers + extra filepath floskell fourmolu ghc ghc-boot-th ghc-paths ghcide + gitrev hashable haskell-lsp hie-bios hls-hlint-plugin + hls-plugin-api hls-tactics-plugin hslogger lens mtl + optparse-applicative optparse-simple ormolu process regex-tdfa + retrie safe-exceptions shake stylish-haskell temporary text time + transformers unordered-containers ]; testHaskellDepends = [ aeson base blaze-markup bytestring containers data-default diff --git a/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix b/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix deleted file mode 100644 index 450c665bef85..000000000000 --- a/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ 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, fingertree, fuzzy, ghc -, ghc-boot, ghc-boot-th, ghc-check, ghc-paths -, ghc-typelits-knownnat, gitrev, Glob, haddock-library, hashable -, haskell-lsp, haskell-lsp-types, hie-bios, hslogger -, implicit-hie-cradle, lens, lsp-test, mtl, network-uri -, optparse-applicative, prettyprinter, prettyprinter-ansi-terminal -, process, QuickCheck, quickcheck-instances -, record-dot-preprocessor, record-hasfield, regex-tdfa -, rope-utf16-splay, safe, 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.4.0"; - src = fetchgit { - url = "https://github.com/haskell/ghcide"; - sha256 = "0zv14mvfhmwwkhyzkr38qpvyffa8ywzp41lr1k55pbrc5b10fjr6"; - rev = "0bfce3114c28bd00f7bf5729c32ec0f23a8d8854"; - fetchSubmodules = true; - }; - isLibrary = true; - isExecutable = true; - libraryHaskellDepends = [ - aeson array async base base16-bytestring binary bytestring - containers cryptohash-sha1 data-default deepseq directory extra - filepath fingertree fuzzy ghc ghc-boot ghc-boot-th ghc-check - ghc-paths Glob haddock-library hashable haskell-lsp - haskell-lsp-types hie-bios hslogger implicit-hie-cradle mtl - network-uri prettyprinter prettyprinter-ansi-terminal regex-tdfa - rope-utf16-splay safe safe-exceptions shake sorted-list stm syb - text time transformers unix unordered-containers utf8-string - ]; - executableHaskellDepends = [ - aeson base bytestring containers data-default directory extra - filepath gitrev hashable haskell-lsp haskell-lsp-types hie-bios - lens lsp-test optparse-applicative process safe-exceptions text - unordered-containers - ]; - testHaskellDepends = [ - aeson base binary bytestring containers directory extra filepath - ghc ghc-typelits-knownnat haddock-library haskell-lsp - haskell-lsp-types lens lsp-test network-uri optparse-applicative - process QuickCheck quickcheck-instances record-dot-preprocessor - record-hasfield rope-utf16-splay safe safe-exceptions shake tasty - tasty-expected-failure tasty-hunit tasty-quickcheck tasty-rerun - text - ]; - benchmarkHaskellDepends = [ - aeson base Chart Chart-diagrams diagrams diagrams-svg directory - extra filepath shake text yaml - ]; - homepage = "https://github.com/haskell/ghcide#readme"; - description = "The core of an IDE"; - license = stdenv.lib.licenses.asl20; -} diff --git a/pkgs/development/tools/haskell/haskell-language-server/hls-hlint-plugin.nix b/pkgs/development/tools/haskell/haskell-language-server/hls-hlint-plugin.nix new file mode 100644 index 000000000000..8fd3cdb2a32b --- /dev/null +++ b/pkgs/development/tools/haskell/haskell-language-server/hls-hlint-plugin.nix @@ -0,0 +1,26 @@ +{ mkDerivation, aeson, apply-refact, base, binary, bytestring +, containers, data-default, deepseq, Diff, directory, extra +, fetchgit, filepath, ghc, ghc-lib, ghc-lib-parser-ex, ghcide +, hashable, haskell-lsp, hlint, hls-plugin-api, hslogger, lens +, regex-tdfa, shake, stdenv, temporary, text, transformers +, unordered-containers +}: +mkDerivation { + pname = "hls-hlint-plugin"; + version = "0.1.0.0"; + src = fetchgit { + url = "https://github.com/haskell/haskell-language-server.git"; + sha256 = "1w15p988a5h11fcp25lllaj7j78f35gzg5bixy1vs7ld0p6jj7n9"; + rev = "8682517e9ff92caa35e727e28445896f97c61e8d"; + fetchSubmodules = true; + }; + postUnpack = "sourceRoot+=/plugins/hls-hlint-plugin; echo source root reset to $sourceRoot"; + libraryHaskellDepends = [ + aeson apply-refact base binary bytestring containers data-default + deepseq Diff directory extra filepath ghc ghc-lib ghc-lib-parser-ex + ghcide hashable haskell-lsp hlint hls-plugin-api hslogger lens + regex-tdfa shake temporary text transformers unordered-containers + ]; + description = "Hlint integration plugin with Haskell Language Server"; + license = stdenv.lib.licenses.asl20; +} diff --git a/pkgs/development/tools/haskell/haskell-language-server/hls-tactics-plugin.nix b/pkgs/development/tools/haskell/haskell-language-server/hls-tactics-plugin.nix new file mode 100644 index 000000000000..5fa0f6ed0cf9 --- /dev/null +++ b/pkgs/development/tools/haskell/haskell-language-server/hls-tactics-plugin.nix @@ -0,0 +1,32 @@ +{ mkDerivation, aeson, base, checkers, containers, deepseq +, directory, extra, fetchgit, filepath, fingertree, generic-lens +, ghc, ghc-boot-th, ghc-exactprint, ghc-source-gen, ghcide +, haskell-lsp, hie-bios, hls-plugin-api, hspec, lens, mtl +, QuickCheck, refinery, retrie, shake, stdenv, syb, text +, transformers +}: +mkDerivation { + pname = "hls-tactics-plugin"; + version = "0.5.1.0"; + src = fetchgit { + url = "https://github.com/haskell/haskell-language-server.git"; + sha256 = "1w15p988a5h11fcp25lllaj7j78f35gzg5bixy1vs7ld0p6jj7n9"; + rev = "8682517e9ff92caa35e727e28445896f97c61e8d"; + fetchSubmodules = true; + }; + postUnpack = "sourceRoot+=/plugins/tactics; echo source root reset to $sourceRoot"; + libraryHaskellDepends = [ + aeson base containers deepseq directory extra filepath fingertree + generic-lens ghc ghc-boot-th ghc-exactprint ghc-source-gen ghcide + haskell-lsp hls-plugin-api lens mtl refinery retrie shake syb text + transformers + ]; + testHaskellDepends = [ + base checkers containers ghc hie-bios hls-plugin-api hspec mtl + QuickCheck + ]; + homepage = "https://github.com/isovector/hls-tactics-plugin#readme"; + description = "LSP server for GHC"; + license = "unknown"; + hydraPlatforms = stdenv.lib.platforms.none; +} diff --git a/pkgs/development/tools/haskell/haskell-language-server/update.sh b/pkgs/development/tools/haskell/haskell-language-server/update.sh index fd22a80126d9..fbd97b5488a8 100755 --- a/pkgs/development/tools/haskell/haskell-language-server/update.sh +++ b/pkgs/development/tools/haskell/haskell-language-server/update.sh @@ -15,24 +15,6 @@ 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's ghcide 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/haskell/ghcide" > "$ghcide_derivation_file" - # =========================== # HLS maintainer's Brittany fork # =========================== @@ -67,5 +49,7 @@ echo "Updating haskell-language-server from old version $hls_old_version to new 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" +cabal2nix --revision "$hls_new_version" --subpath plugins/tactics "https://github.com/haskell/haskell-language-server.git" > "${script_dir}/hls-tactics-plugin.nix" +cabal2nix --revision "$hls_new_version" --subpath plugins/hls-hlint-plugin "https://github.com/haskell/haskell-language-server.git" > "${script_dir}/hls-hlint-plugin.nix" echo "Finished."