From e9b791e6a0a7b7cbc5bf17302cf6836bc2811007 Mon Sep 17 00:00:00 2001 From: galagora Date: Fri, 11 Sep 2020 14:10:19 +0300 Subject: [PATCH 1/6] haskell-language-server: add brittany fork --- .../haskell-modules/configuration-common.nix | 6 ++-- .../haskell-modules/non-hackage-packages.nix | 1 + .../haskell-language-server/hls-brittany.nix | 36 +++++++++++++++++++ .../haskell/haskell-language-server/update.sh | 18 ++++++++++ 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/tools/haskell/haskell-language-server/hls-brittany.nix diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index dd9a9463b3c44b..220af3b3684439 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1473,7 +1473,7 @@ self: super: { # INSERT NEW OVERRIDES ABOVE THIS LINE } // (let - inherit (self) hls-ghcide; + 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 ?) @@ -1484,7 +1484,8 @@ self: super: { # fourmolu can‘t compile with an older aeson aeson = dontCheck super.aeson_1_5_2_0; # brittany has an aeson upper bound of 1.5 - brittany = doJailbreak super.brittany; + brittany = hls-brittany; + data-tree-print = doJailbreak super.data-tree-print; }; in { # jailbreaking for hie-bios 0.7.0 (upstream PR: https://github.com/haskell/haskell-language-server/pull/357) @@ -1496,6 +1497,7 @@ self: super: { url = "https://github.com/haskell/ghcide/commit/3e1b3620948870a4da8808ca0c0897fbd3ecad16.patch"; sha256 = "1jwn7jgi740x6wwv1k0mz9d4z0b9p3mzs54pdg4nfq0h2v7zxchz"; }); + hls-brittany = dontCheck (super.hls-brittany.overrideScope hlsScopeOverride); fourmolu = super.fourmolu.overrideScope hlsScopeOverride; } ) // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super diff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix index dc6dbe65061425..7cd4547d904218 100644 --- a/pkgs/development/haskell-modules/non-hackage-packages.nix +++ b/pkgs/development/haskell-modules/non-hackage-packages.nix @@ -23,6 +23,7 @@ self: super: { # 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 { }; # cabal2nix --revision https://github.com/hasura/ci-info-hs.git ci-info = self.callPackage ../misc/haskell/hasura/ci-info {}; diff --git a/pkgs/development/tools/haskell/haskell-language-server/hls-brittany.nix b/pkgs/development/tools/haskell/haskell-language-server/hls-brittany.nix new file mode 100644 index 00000000000000..0519cf42dd8c20 --- /dev/null +++ b/pkgs/development/tools/haskell/haskell-language-server/hls-brittany.nix @@ -0,0 +1,36 @@ +{ mkDerivation, aeson, base, butcher, bytestring, cmdargs +, containers, czipwith, data-tree-print, deepseq, directory, extra +, fetchgit, filepath, ghc, ghc-boot-th, ghc-exactprint, ghc-paths +, hspec, monad-memo, mtl, multistate, parsec, pretty, random, safe +, semigroups, stdenv, strict, syb, text, transformers, uniplate +, unsafe, yaml +}: +mkDerivation { + pname = "brittany"; + version = "0.12.1.1"; + src = fetchgit { + url = "https://github.com/bubba/brittany"; + sha256 = "1rkk09f8750qykrmkqfqbh44dbx1p8aq1caznxxlw8zqfvx39cxl"; + rev = "c59655f10d5ad295c2481537fc8abf0a297d9d1c"; + fetchSubmodules = true; + }; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + aeson base butcher bytestring cmdargs containers czipwith + data-tree-print deepseq directory extra filepath ghc ghc-boot-th + ghc-exactprint ghc-paths monad-memo mtl multistate pretty random + safe semigroups strict syb text transformers uniplate unsafe yaml + ]; + executableHaskellDepends = [ base ]; + testHaskellDepends = [ + aeson base butcher bytestring cmdargs containers czipwith + data-tree-print deepseq directory extra filepath ghc ghc-boot-th + ghc-exactprint ghc-paths hspec monad-memo mtl multistate parsec + pretty safe semigroups strict syb text transformers uniplate unsafe + yaml + ]; + homepage = "https://github.com/lspitzner/brittany/"; + description = "Haskell source code formatter"; + license = stdenv.lib.licenses.agpl3; +} diff --git a/pkgs/development/tools/haskell/haskell-language-server/update.sh b/pkgs/development/tools/haskell/haskell-language-server/update.sh index 2f2741e9a49aa0..fd22a80126d9eb 100755 --- a/pkgs/development/tools/haskell/haskell-language-server/update.sh +++ b/pkgs/development/tools/haskell/haskell-language-server/update.sh @@ -7,6 +7,8 @@ # 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. +# +# Remember to split out different updates into multiple commits set -eo pipefail @@ -31,6 +33,22 @@ 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 +# =========================== + +# brittany derivation created with cabal2nix. +brittany_derivation_file="${script_dir}/hls-brittany.nix" + +# This is the current revision of the brittany fork in Nixpkgs. +brittany_old_version="$(sed -En 's/.*\bversion = "(.*?)".*/\1/p' "$brittany_derivation_file")" + +brittany_new_version=$(curl --silent "https://api.github.com/repos/bubba/brittany/commits/ghc-8.10.1" | jq '.sha' --raw-output) + +echo "Updating haskell-language-server's brittany from old version $brittany_old_version to new version $brittany_new_version." +echo "Running cabal2nix and outputting to ${brittany_derivation_file}..." + +cabal2nix --revision "$brittany_new_version" "https://github.com/bubba/brittany" > "$brittany_derivation_file" # =========================== # HLS From 80328d9ea46a7da19db5e897eb8fcda4f2c8361e Mon Sep 17 00:00:00 2001 From: galagora Date: Fri, 11 Sep 2020 14:13:34 +0300 Subject: [PATCH 2/6] haskell-language-server: hls-ghcide 0.3.0 -> 0.4.0 The patch is merged into master --- .../haskell-modules/configuration-common.nix | 10 ++----- .../haskell-language-server/hls-ghcide.nix | 29 +++++++++---------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 220af3b3684439..95214676ad4158 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1477,7 +1477,7 @@ self: super: { 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 = hls-ghcide; + 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_5; @@ -1490,13 +1490,7 @@ self: super: { in { # jailbreaking for hie-bios 0.7.0 (upstream PR: https://github.com/haskell/haskell-language-server/pull/357) haskell-language-server = dontCheck (doJailbreak (super.haskell-language-server.overrideScope hlsScopeOverride)); - hls-ghcide = appendPatch (dontCheck (super.hls-ghcide.overrideScope hlsScopeOverride)) - (pkgs.fetchpatch { - # This patch loosens the hie-bios upper bound. - # It is already merged into upstream and won‘t be needed for ghcide 0.4.0 - url = "https://github.com/haskell/ghcide/commit/3e1b3620948870a4da8808ca0c0897fbd3ecad16.patch"; - sha256 = "1jwn7jgi740x6wwv1k0mz9d4z0b9p3mzs54pdg4nfq0h2v7zxchz"; - }); + hls-ghcide = dontCheck (super.hls-ghcide.overrideScope hlsScopeOverride); hls-brittany = dontCheck (super.hls-brittany.overrideScope hlsScopeOverride); fourmolu = super.fourmolu.overrideScope hlsScopeOverride; } diff --git a/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix b/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix index c6a9b31fb7383a..af38312a361661 100644 --- a/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix +++ b/pkgs/development/tools/haskell/haskell-language-server/hls-ghcide.nix @@ -5,21 +5,20 @@ , 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, prettyprinter -, prettyprinter-ansi-terminal, process, QuickCheck -, quickcheck-instances, 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 +, optparse-applicative, prettyprinter, prettyprinter-ansi-terminal +, process, QuickCheck, quickcheck-instances, 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.2.0"; + version = "0.3.0"; src = fetchgit { url = "https://github.com/haskell/ghcide"; - sha256 = "1zq7ngaak8il91a309rl51dghzasnk4m2sm3av6d93cyqyra1hfc"; - rev = "078e3d3c0d319f83841ccbcdc60ff5f0e243f6be"; + sha256 = "15v3g3i5v0xbq50lfvl4bv3rx01nixiqx02sddqi5lj2idgmg24g"; + rev = "96cf8c53d0bdc16d3d2cd0559b74962593ce6dc5"; fetchSubmodules = true; }; isLibrary = true; @@ -29,10 +28,10 @@ mkDerivation { containers cryptohash-sha1 data-default deepseq directory extra filepath fuzzy ghc ghc-boot ghc-boot-th ghc-check ghc-paths haddock-library hashable haskell-lsp haskell-lsp-types hie-bios - hslogger mtl network-uri opentelemetry 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 + hslogger 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 @@ -52,7 +51,7 @@ mkDerivation { aeson base Chart Chart-diagrams diagrams diagrams-svg directory extra filepath shake text yaml ]; - homepage = "https://github.com/digital-asset/ghcide#readme"; + homepage = "https://github.com/haskell/ghcide#readme"; description = "The core of an IDE"; license = stdenv.lib.licenses.asl20; } From da9d7a4a7509c31f08d67dfcf19c379312e10ca8 Mon Sep 17 00:00:00 2001 From: galagora Date: Fri, 11 Sep 2020 14:19:04 +0300 Subject: [PATCH 3/6] haskell-language-server: ghc-exactprint update 0.6.2 -> 0.6.3.2 --- pkgs/development/haskell-modules/configuration-common.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 95214676ad4158..29ee9d481584bf 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1486,6 +1486,7 @@ self: super: { # brittany has an aeson upper bound of 1.5 brittany = hls-brittany; data-tree-print = doJailbreak super.data-tree-print; + ghc-exactprint = dontCheck super.ghc-exactprint_0_6_3_2; }; in { # jailbreaking for hie-bios 0.7.0 (upstream PR: https://github.com/haskell/haskell-language-server/pull/357) From 875e9b94d0358a88bd6f4cd2a35161ee1ebce896 Mon Sep 17 00:00:00 2001 From: galagora Date: Fri, 11 Sep 2020 14:21:34 +0300 Subject: [PATCH 4/6] haskell-language-server: cb861b878a -> c476992f43 --- .../tools/haskell/haskell-language-server/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/haskell/haskell-language-server/default.nix b/pkgs/development/tools/haskell/haskell-language-server/default.nix index c29ed6ce07ef78..10cfa57f914780 100644 --- a/pkgs/development/tools/haskell/haskell-language-server/default.nix +++ b/pkgs/development/tools/haskell/haskell-language-server/default.nix @@ -14,8 +14,8 @@ mkDerivation { version = "0.4.0.0"; src = fetchgit { url = "https://github.com/haskell/haskell-language-server.git"; - sha256 = "157bsq6i824bl6krw7znp0byd8ibaqsq7mfwnkl741dmrflsxpa9"; - rev = "cb861b878ae01911b066182ff0d8080050c3b2d6"; + sha256 = "1fh9k9b3880m6ql4i10yn2yanskk9xhrakrrddqvainhcf2ik8hl"; + rev = "c4576992f443a9abe48ffcfa0e2d2b9bce15d7ae"; fetchSubmodules = true; }; isLibrary = true; From 9ee19bc889dfaaecdf71392453c22ad2f3595cf7 Mon Sep 17 00:00:00 2001 From: galagora Date: Fri, 11 Sep 2020 10:05:06 +0300 Subject: [PATCH 5/6] haskellPackages.stylish-haskell: fix cabal bounds --- pkgs/development/haskell-modules/configuration-common.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 29ee9d481584bf..79c1e003ec136a 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1470,6 +1470,13 @@ self: super: { pandoc-types = doDistribute self.pandoc-types_1_21; rfc5051 = doDistribute self.rfc5051_0_2; + # Upstream forgot to change the Cabal version bounds in the test suite. + # See: https://github.com/jaspervdj/stylish-haskell/pull/297 + # Will be fixed whenever they next bump the version number + stylish-haskell = appendPatch super.stylish-haskell (pkgs.fetchpatch { + url = "https://github.com/jaspervdj/stylish-haskell/commit/9550aa1cd177aa6fe271d075177109d66a79e67f.patch"; + sha256 = "159jr80k40hdq5gpqfjknqx6vj2licx1l0f57l5r3k4264lnxjdb"; + }); # INSERT NEW OVERRIDES ABOVE THIS LINE } // (let From 5175a8947d87ebe1ef0574beb49685eba33196dd Mon Sep 17 00:00:00 2001 From: galagora Date: Fri, 11 Sep 2020 21:13:34 +0300 Subject: [PATCH 6/6] haskell-language-server: don't test fourmolu --- pkgs/development/haskell-modules/configuration-common.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 79c1e003ec136a..96bf7cb70fdba5 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1500,6 +1500,6 @@ self: super: { haskell-language-server = dontCheck (doJailbreak (super.haskell-language-server.overrideScope hlsScopeOverride)); hls-ghcide = dontCheck (super.hls-ghcide.overrideScope hlsScopeOverride); hls-brittany = dontCheck (super.hls-brittany.overrideScope hlsScopeOverride); - fourmolu = super.fourmolu.overrideScope hlsScopeOverride; + fourmolu = dontCheck (super.fourmolu.overrideScope hlsScopeOverride); } ) // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super