From 5ddf8ec5a8ba62f5e117a7700946f56e711a9618 Mon Sep 17 00:00:00 2001 From: maralorn Date: Mon, 3 Apr 2023 15:11:05 +0200 Subject: [PATCH] haskell.packages.ghc94.haskell-language-server: Fix build --- .../haskell-modules/configuration-common.nix | 46 +++++++++++++++++++ .../configuration-ghc-9.2.x.nix | 3 -- .../configuration-ghc-9.4.x.nix | 12 +---- .../configuration-hackage2nix/main.yaml | 1 + .../haskell-modules/configuration-nix.nix | 4 +- .../haskell-modules/hackage-packages.nix | 35 ++++++++++++++ 6 files changed, 85 insertions(+), 16 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 144730510f2c..c97f2c2fe82d 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -138,9 +138,55 @@ self: super: { hash = "sha256-sBuqSmgCQSgbXV6KPEZcIP09wbx81q5xjSg7/slH2HQ="; }) super.hls-test-utils; + hls-rename-plugin = if lib.versionAtLeast super.ghc.version "9.4" then overrideCabal + (drv: { + prePatch = drv.prePatch or "" + '' + "${pkgs.buildPackages.dos2unix}/bin/dos2unix" *.cabal + ''; + }) + (appendPatch (fetchpatch { + name = "hls-rename-ghc-9.4-compat.patch"; + url = "https://github.com/haskell/haskell-language-server/commit/472947cdb9e711f6ef889bba3b83b0dd44a1b6bc.patch"; + relative = "plugins/hls-rename-plugin"; + hash = "sha256-WPhCQmn3rjCOiQFJz23QQ84zfm43FNll0BfsNK5pkG0="; + }) super.hls-rename-plugin) else super.hls-rename-plugin; + + hls-floskell-plugin = if lib.versionAtLeast super.ghc.version "9.4" then overrideCabal + (drv: { + prePatch = drv.prePatch or "" + '' + "${pkgs.buildPackages.dos2unix}/bin/dos2unix" *.cabal + ''; + }) + (appendPatch (fetchpatch { + name = "hls-floskell-ghc-9.4-compat.patch"; + url = "https://github.com/haskell/haskell-language-server/commit/ddc67b2d4d719623b657aa54db20bf58c58a5d4a.patch"; + relative = "plugins/hls-floskell-plugin"; + hash = "sha256-n2vuzGbdvhW6I8c7Q22SuNIKSX2LwGNBTVyLLHJIsiU="; + }) super.hls-floskell-plugin) else super.hls-floskell-plugin; + + hls-stylish-haskell-plugin = if lib.versionAtLeast super.ghc.version "9.4" then overrideCabal + (drv: { + prePatch = drv.prePatch or "" + '' + "${pkgs.buildPackages.dos2unix}/bin/dos2unix" *.cabal + ''; + }) + (appendPatch (fetchpatch { + name = "hls-stylish-haskell-ghc-9.4-compat.patch"; + url = "https://github.com/haskell/haskell-language-server/commit/ddc67b2d4d719623b657aa54db20bf58c58a5d4a.patch"; + relative = "plugins/hls-stylish-haskell-plugin"; + hash = "sha256-GtN9t5zMOROCDSLiscLZ5GmqDV+ql9R2z/+W++C2h2Q="; + }) super.hls-stylish-haskell-plugin) else super.hls-stylish-haskell-plugin; # For -f-auto see cabal.project in haskell-language-server. ghc-lib-parser-ex = addBuildDepend self.ghc-lib-parser (disableCabalFlag "auto" super.ghc-lib-parser-ex); + # For -fghc-lib see cabal.project in haskell-language-server. + stylish-haskell = if lib.versionAtLeast super.ghc.version "9.2" + then enableCabalFlag "ghc-lib" + (if lib.versionAtLeast super.ghc.version "9.4" + then super.stylish-haskell_0_14_4_0 + else super.stylish-haskell) + else super.stylish-haskell; + ########################################### ### END HASKELL-LANGUAGE-SERVER SECTION ### ########################################### diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix index 0416124a6c31..ca7080c821b4 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix @@ -69,9 +69,6 @@ self: super: { # Tests depend on `parseTime` which is no longer available hourglass = dontCheck super.hourglass; - # For -fghc-lib see cabal.project in haskell-language-server. - stylish-haskell = enableCabalFlag "ghc-lib" super.stylish-haskell; - # Needs to match ghc version ghc-tags = doDistribute self.ghc-tags_1_5; diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix index 4e61341c0dd9..b094aa941ade 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.4.x.nix @@ -184,16 +184,6 @@ in { }) self.ghc-exactprint_1_6_1_1; - # 2023-02-01: plugins disabled for hls 1.9.0.0 based on - # https://haskell-language-server.readthedocs.io/en/latest/support/plugin-support.html#current-plugin-support-tiers - haskell-language-server = super.haskell-language-server.override { - hls-eval-plugin = null; - hls-ormolu-plugin = null; # This plugin is supposed to work, but fails to compile. - hls-floskell-plugin = null; # This plugin is supposed to work, but fails to compile. - hls-rename-plugin = null; # This plugin is supposed to work, but fails to compile. - hls-stylish-haskell-plugin = null; - }; - # needed to build servant http-api-data = super.http-api-data_0_5_1; attoparsec-iso8601 = super.attoparsec-iso8601_1_1_0_0; @@ -221,7 +211,7 @@ in { ormolu = doDistribute self.ormolu_0_5_3_0; fourmolu = overrideCabal (drv: { libraryHaskellDepends = drv.libraryHaskellDepends ++ [ self.file-embed ]; - }) (disableCabalFlag "fixity-th" super.fourmolu_0_11_0_0); + }) (disableCabalFlag "fixity-th" super.fourmolu_0_10_0_0); # Apply workaround for Cabal 3.8 bug https://github.com/haskell/cabal/issues/8455 # by making `pkg-config --static` happy. Note: Cabal 3.9 is also affected, so diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml index f9c82e58df48..40c12030db79 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml @@ -131,6 +131,7 @@ extra-packages: - retrie < 1.2.0.0 # 2022-12-30: required for hls on ghc < 9.2 - ghc-tags == 1.5.* # 2023-02-18: preserve for ghc-lib == 9.2.* - primitive == 0.7.4.0 # 2023-03-04: primitive 0.8 is not compatible with too many packages on ghc 9.4 as of now + - fourmolu == 0.10.0.0 # 2023-04-03: for hls-fourmolu-plugin 1.1.1.0 package-maintainers: abbradar: diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 2562565ad039..0cd51075f9a3 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -1070,11 +1070,11 @@ self: super: builtins.intersectAttrs super { }) super.fourmolu; # Test suite wants to run main executable - fourmolu_0_11_0_0 = overrideCabal (drv: { + fourmolu_0_10_0_0 = overrideCabal (drv: { preCheck = drv.preCheck or "" + '' export PATH="$PWD/dist/build/fourmolu:$PATH" ''; - }) super.fourmolu_0_11_0_0; + }) super.fourmolu_0_10_0_0; # Test suite needs to execute 'disco' binary disco = overrideCabal (drv: { diff --git a/pkgs/development/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix index b45c0a3fb0d1..2f1986f91ff9 100644 --- a/pkgs/development/haskell-modules/hackage-packages.nix +++ b/pkgs/development/haskell-modules/hackage-packages.nix @@ -104154,6 +104154,41 @@ self: { mainProgram = "fourmolu"; }) {}; + "fourmolu_0_10_0_0" = callPackage + ({ mkDerivation, aeson, ansi-terminal, array, base, bytestring + , Cabal-syntax, containers, Diff, directory, dlist, exceptions + , filepath, ghc-lib-parser, gitrev, hspec, hspec-discover + , hspec-megaparsec, megaparsec, MemoTrie, mtl, optparse-applicative + , path, path-io, pretty, process, QuickCheck, syb, template-haskell + , temporary, text, th-lift-instances, yaml + }: + mkDerivation { + pname = "fourmolu"; + version = "0.10.0.0"; + sha256 = "05ypz963xpz00fa6g1a8vpm4v2qy52jmcb4js6g8xi8m8r9fdica"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + aeson ansi-terminal array base bytestring Cabal-syntax containers + Diff directory dlist exceptions filepath ghc-lib-parser megaparsec + MemoTrie mtl syb template-haskell text th-lift-instances yaml + ]; + executableHaskellDepends = [ + base containers directory filepath ghc-lib-parser gitrev + optparse-applicative text yaml + ]; + testHaskellDepends = [ + base containers Diff directory filepath ghc-lib-parser hspec + hspec-megaparsec megaparsec path path-io pretty process QuickCheck + temporary text + ]; + testToolDepends = [ hspec-discover ]; + description = "A formatter for Haskell source code"; + license = lib.licenses.bsd3; + hydraPlatforms = lib.platforms.none; + mainProgram = "fourmolu"; + }) {}; + "fourmolu_0_11_0_0" = callPackage ({ mkDerivation, aeson, ansi-terminal, array, base, binary , bytestring, Cabal-syntax, containers, Diff, directory, dlist