Skip to content

Commit

Permalink
haskellPackages.haskell-language-server: Fix build
Browse files Browse the repository at this point in the history
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
  • Loading branch information
maralorn authored and peti committed Nov 13, 2020
1 parent becd5f5 commit bf29c14
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 131 deletions.
44 changes: 19 additions & 25 deletions pkgs/development/haskell-modules/configuration-common.nix
Expand Up @@ -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;
Expand Down Expand Up @@ -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
3 changes: 0 additions & 3 deletions pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix
Expand Up @@ -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";
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix
Expand Up @@ -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;
}
3 changes: 0 additions & 3 deletions pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix
Expand Up @@ -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; });

Expand Down
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/haskell-modules/non-hackage-packages.nix
Expand Up @@ -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 { };

Expand Down
28 changes: 14 additions & 14 deletions 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;
Expand All @@ -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
Expand Down

This file was deleted.

@@ -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;
}
@@ -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;
}
20 changes: 2 additions & 18 deletions pkgs/development/tools/haskell/haskell-language-server/update.sh
Expand Up @@ -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
# ===========================
Expand Down Expand Up @@ -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."

0 comments on commit bf29c14

Please sign in to comment.