summary refs log tree commit diff
diff options
context:
space:
mode:
authorgalagora <lightningstrikeiv@gmail.com>2020-09-11 14:10:19 +0300
committergalagora <lightningstrikeiv@gmail.com>2020-09-11 22:17:36 +0300
commite9b791e6a0a7b7cbc5bf17302cf6836bc2811007 (patch)
treeebb9d29c14be5e9a182f0ce37ea64299eaa9bafd
parent0e8da16ac7d21039b64a8db0dadd18592264ea0c (diff)
haskell-language-server: add brittany fork
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix6
-rw-r--r--pkgs/development/haskell-modules/non-hackage-packages.nix1
-rw-r--r--pkgs/development/tools/haskell/haskell-language-server/hls-brittany.nix36
-rwxr-xr-xpkgs/development/tools/haskell/haskell-language-server/update.sh18
4 files changed, 59 insertions, 2 deletions
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index dd9a9463b3c44..220af3b368443 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 dc6dbe6506142..7cd4547d90421 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 <rev> 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 0000000000000..0519cf42dd8c2
--- /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 2f2741e9a49aa..fd22a80126d9e 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