haskell-language-server: add brittany fork

This commit is contained in:
galagora 2020-09-11 14:10:19 +03:00
parent 0e8da16ac7
commit e9b791e6a0
4 changed files with 59 additions and 2 deletions

View File

@ -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 cant 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

View File

@ -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 {};

View File

@ -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;
}

View File

@ -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