diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index eff8fa2123..8458eea89c 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -113,8 +113,10 @@ jobs: run: cachix push haskell-language-server dev - name: Build binaries run: nix build --print-build-logs - - name: Build all binaries - run: nix build --print-build-logs .#all-haskell-language-server + # smunix: "Build all binaries" takes too long to run and doesn't contribute + # to caching to cachix for now; so I'm disabling it for now. + # - name: Build all binaries + # run: nix build --print-build-logs .#all-haskell-language-server - name: Push binaries if: ${{ env.HAS_TOKEN == 'true' }} run: nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server diff --git a/.gitignore b/.gitignore index 8b90d20187..61cfe5877b 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ test/testdata/**/hie.yaml .shake/ # pre-commit-hook.nix -#.pre-commit-config.yaml +.pre-commit-config.yaml # direnv /.direnv/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d4ad3ccc5..39025fb2b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ variables: - GHC_VERSION: 8.10.7 CABAL_PROJECT: cabal.project - GHC_VERSION: 9.0.2 - CABAL_PROJECT: cabal-ghc90.project + CABAL_PROJECT: cabal.project - GHC_VERSION: 9.2.2 CABAL_PROJECT: cabal-ghc92.project - GHC_VERSION: 9.2.1 diff --git a/bindist/ghcs b/bindist/ghcs index 32cfc187ed..154935c5ae 100644 --- a/bindist/ghcs +++ b/bindist/ghcs @@ -1,6 +1,6 @@ 8.6.5,cabal.project 8.8.4,cabal.project 8.10.7,cabal.project -9.0.2,cabal-ghc90.project +9.0.2,cabal.project 9.2.1,cabal-ghc92.project 9.2.2,cabal-ghc92.project diff --git a/bindist/ghcs-FreeBSD b/bindist/ghcs-FreeBSD index cab2c69bb2..a1b4b6e0bf 100644 --- a/bindist/ghcs-FreeBSD +++ b/bindist/ghcs-FreeBSD @@ -1,2 +1,2 @@ 8.10.7,cabal.project -9.0.2,cabal-ghc90.project +9.0.2,cabal.project diff --git a/bindist/ghcs-Msys b/bindist/ghcs-Msys index a6210abe73..37998b56f1 100644 --- a/bindist/ghcs-Msys +++ b/bindist/ghcs-Msys @@ -1,4 +1,4 @@ 8.10.7,cabal.project -9.0.2,cabal-ghc90.project +9.0.2,cabal.project 9.2.2,cabal-ghc92.project 9.2.1,cabal-ghc92.project diff --git a/cabal-ghc90.project b/cabal-ghc90.project deleted file mode 100644 index 06e0d35262..0000000000 --- a/cabal-ghc90.project +++ /dev/null @@ -1,58 +0,0 @@ -packages: - ./ - ./hie-compat - ./shake-bench - ./hls-graph - ./ghcide - ./hls-plugin-api - ./hls-test-utils - ./plugins/hls-tactics-plugin - ./plugins/hls-brittany-plugin - ./plugins/hls-stylish-haskell-plugin - ./plugins/hls-fourmolu-plugin - ./plugins/hls-class-plugin - ./plugins/hls-eval-plugin - ./plugins/hls-explicit-imports-plugin - ./plugins/hls-refine-imports-plugin - ./plugins/hls-hlint-plugin - ./plugins/hls-rename-plugin - ./plugins/hls-retrie-plugin - ./plugins/hls-haddock-comments-plugin - ./plugins/hls-splice-plugin - ./plugins/hls-qualify-imported-names-plugin - ./plugins/hls-floskell-plugin - ./plugins/hls-pragmas-plugin - ./plugins/hls-module-name-plugin - ./plugins/hls-ormolu-plugin - ./plugins/hls-call-hierarchy-plugin - ./plugins/hls-alternate-number-format-plugin - ./plugins/hls-selection-range-plugin - ./plugins/hls-change-type-signature-plugin - -tests: true - -package * - ghc-options: -haddock - test-show-details: direct - -write-ghc-environment-files: never - -index-state: 2022-04-27T09:22:49Z - -constraints: - --- although we are not building all plugins cabal solver phase is run for all packages --- this way we track explicitly all transitive dependencies which need support for ghc-9 -allow-newer: - - -- brittany: update ghc bounds in hls.cabal when those are removed - -- https://github.com/lspitzner/multistate/pull/8 - multistate:base, - -- https://github.com/lspitzner/data-tree-print/pull/3 - data-tree-print:base, - -- https://github.com/lspitzner/butcher/pull/8 - butcher:base, - - -- ghc-9.0.2 specific - -- for ghcide:test via ghc-typelits-knownnat - ghc-typelits-natnormalise:ghc-bignum diff --git a/cabal-ghc92.project b/cabal-ghc92.project index 136ea7365b..f0d47d04cb 100644 --- a/cabal-ghc92.project +++ b/cabal-ghc92.project @@ -39,7 +39,7 @@ package * write-ghc-environment-files: never -index-state: 2022-04-27T09:22:49Z +index-state: 2022-04-30T21:02:45Z constraints: -- These plugins don't build/work on GHC92 yet diff --git a/cabal.project b/cabal.project index ea1114f19a..3afb72dfac 100644 --- a/cabal.project +++ b/cabal.project @@ -37,21 +37,15 @@ optional-packages: vendored/*/*.cabal tests: true package * - -- ghc 8.10 cannot build ghc-lib 9.2 with --haddock - -- ghc-options: -haddock + -- ghc 8.10.7 fails to build ghc-lib-9.2.2 + -- ghc-options: --haddock test-show-details: direct write-ghc-environment-files: never -index-state: 2022-04-27T09:22:49Z +index-state: 2022-04-30T21:02:45Z constraints: - hyphenation +embed, - -- remove this when hlint sets ghc-lib to true by default - -- https://github.com/ndmitchell/hlint/issues/1376 - hlint +ghc-lib + hyphenation +embed, + hls-hlint-plugin +ghc-lib, -allow-newer: - -- for shake-bench - Chart-diagrams:diagrams-core, - SVGFonts:diagrams-core diff --git a/configuration-ghc-810.nix b/configuration-ghc-810.nix new file mode 100644 index 0000000000..49be331855 --- /dev/null +++ b/configuration-ghc-810.nix @@ -0,0 +1,58 @@ +{ pkgs, inputs }: + +let + disabledPlugins = [ + "hls-brittany-plugin" + "hls-hlint-plugin" + "hls-stylish-haskell-plugin" + "hls-haddock-comments-plugin" + "hls-tactics-plugin" + # That one is not technically a plugin, but by putting it in this list, we + # get it removed from the top level list of requirement and it is not pull + # in the nix shell. + "shake-bench" + ]; + + hpkgsOverride = hself: hsuper: + with pkgs.haskell.lib; { + hlsDisabledPlugins = disabledPlugins; + + ghc-lib = hself.ghc-lib_8_10_7_20220219; + ghc-lib-parser = hself.ghc-lib-parser_8_10_7_20220219; + + fourmolu = hself.callCabal2nix "fourmolu" inputs.fourmolu-0300 { }; + + stylish-haskell = hself.callCabal2nixWithOptions "stylish-haskell" + inputs.stylish-haskell-01220 (pkgs.lib.concatStringsSep " " [ ]) { }; + + aeson = hself.callCabal2nixWithOptions "aeson" inputs.aeson-1520 + (pkgs.lib.concatStringsSep " " [ ]) { }; + + brittany = hself.callCabal2nixWithOptions "brittany" inputs.brittany-01312 + (pkgs.lib.concatStringsSep " " [ ]) { }; + + hls-hlint-plugin = hself.callCabal2nixWithOptions "hls-hlint-plugin" + ./plugins/hls-hlint-plugin + (pkgs.lib.concatStringsSep " " [ "-f-hlint34" "-fhyphenation" ]) { }; + + # Re-generate HLS drv excluding some plugins + haskell-language-server = + hself.callCabal2nixWithOptions "haskell-language-server" ./. + (pkgs.lib.concatStringsSep " " [ + "-fpedantic" + "-f-hlint" + "-f-fourmolu" + "-f-ormolu" + ]) { }; + + # YOLO + mkDerivation = args: + hsuper.mkDerivation (args // { + jailbreak = true; + doCheck = false; + }); + }; +in { + inherit disabledPlugins; + tweakHpkgs = hpkgs: hpkgs.extend hpkgsOverride; +} diff --git a/configuration-ghc-88.nix b/configuration-ghc-88.nix new file mode 100644 index 0000000000..49be331855 --- /dev/null +++ b/configuration-ghc-88.nix @@ -0,0 +1,58 @@ +{ pkgs, inputs }: + +let + disabledPlugins = [ + "hls-brittany-plugin" + "hls-hlint-plugin" + "hls-stylish-haskell-plugin" + "hls-haddock-comments-plugin" + "hls-tactics-plugin" + # That one is not technically a plugin, but by putting it in this list, we + # get it removed from the top level list of requirement and it is not pull + # in the nix shell. + "shake-bench" + ]; + + hpkgsOverride = hself: hsuper: + with pkgs.haskell.lib; { + hlsDisabledPlugins = disabledPlugins; + + ghc-lib = hself.ghc-lib_8_10_7_20220219; + ghc-lib-parser = hself.ghc-lib-parser_8_10_7_20220219; + + fourmolu = hself.callCabal2nix "fourmolu" inputs.fourmolu-0300 { }; + + stylish-haskell = hself.callCabal2nixWithOptions "stylish-haskell" + inputs.stylish-haskell-01220 (pkgs.lib.concatStringsSep " " [ ]) { }; + + aeson = hself.callCabal2nixWithOptions "aeson" inputs.aeson-1520 + (pkgs.lib.concatStringsSep " " [ ]) { }; + + brittany = hself.callCabal2nixWithOptions "brittany" inputs.brittany-01312 + (pkgs.lib.concatStringsSep " " [ ]) { }; + + hls-hlint-plugin = hself.callCabal2nixWithOptions "hls-hlint-plugin" + ./plugins/hls-hlint-plugin + (pkgs.lib.concatStringsSep " " [ "-f-hlint34" "-fhyphenation" ]) { }; + + # Re-generate HLS drv excluding some plugins + haskell-language-server = + hself.callCabal2nixWithOptions "haskell-language-server" ./. + (pkgs.lib.concatStringsSep " " [ + "-fpedantic" + "-f-hlint" + "-f-fourmolu" + "-f-ormolu" + ]) { }; + + # YOLO + mkDerivation = args: + hsuper.mkDerivation (args // { + jailbreak = true; + doCheck = false; + }); + }; +in { + inherit disabledPlugins; + tweakHpkgs = hpkgs: hpkgs.extend hpkgsOverride; +} diff --git a/configuration-ghc-90.nix b/configuration-ghc-90.nix new file mode 100644 index 0000000000..bbf7eafbb1 --- /dev/null +++ b/configuration-ghc-90.nix @@ -0,0 +1,45 @@ +{ pkgs, inputs }: + +let + disabledPlugins = [ "hls-brittany-plugin" "hls-stylish-haskell-plugin" ]; + + hpkgsOverride = hself: hsuper: + with pkgs.haskell.lib; { + hlsDisabledPlugins = disabledPlugins; + + # ptr-poker breaks on MacOS without SSE2 optimizations + # https://github.com/nikita-volkov/ptr-poker/issues/11 + ptr-poker = hself.callCabal2nix "ptr-poker" inputs.ptr-poker { }; + + ghc-lib = hself.ghc-lib_9_2_2_20220307; + ghc-lib-parser = hself.ghc-lib-parser_9_2_2_20220307; + ghc-lib-parser-ex = hself.ghc-lib-parser-ex_9_2_0_3; + + Cabal = hself.Cabal_3_6_3_0; + ormolu = hself.ormolu_0_4_0_0; + fourmolu = hself.fourmolu_0_6_0_0; + + # Hlint is still broken + hlint = doJailbreak (hself.callCabal2nix "hlint" inputs.hlint-34 { }); + + hls-hlint-plugin = hself.callCabal2nixWithOptions "hls-hlint-plugin" + ./plugins/hls-hlint-plugin + (pkgs.lib.concatStringsSep " " [ "-fhlint34" "-fghc-lib" ]) { }; + + # Re-generate HLS drv excluding some plugins + haskell-language-server = + hself.callCabal2nixWithOptions "haskell-language-server" ./. + (pkgs.lib.concatStringsSep " " [ "-f-brittany" "-f-stylishhaskell" ]) + { }; + + # YOLO + mkDerivation = args: + hsuper.mkDerivation (args // { + jailbreak = true; + doCheck = false; + }); + }; +in { + inherit disabledPlugins; + tweakHpkgs = hpkgs: hpkgs.extend hpkgsOverride; +} diff --git a/configuration-ghc-901.nix b/configuration-ghc-901.nix deleted file mode 100644 index 789a5d2e19..0000000000 --- a/configuration-ghc-901.nix +++ /dev/null @@ -1,36 +0,0 @@ -# nix version of cabal-ghc901.project -{ pkgs }: - -let - disabledPlugins = [ - "hls-brittany-plugin" - "hls-stylish-haskell-plugin" - ]; - - hpkgsOverride = hself: hsuper: - with pkgs.haskell.lib; - { - hlsDisabledPlugins = disabledPlugins; - - fourmolu = hself.fourmolu_0_4_0_0; - primitive-extras = hself.primitive-extras_0_10_1_2; - - # Re-generate HLS drv excluding some plugins - haskell-language-server = - hself.callCabal2nixWithOptions "haskell-language-server" ./. - (pkgs.lib.concatStringsSep " " [ - "-f-brittany" - "-f-stylishhaskell" - ]) { }; - - # YOLO - mkDerivation = args: - hsuper.mkDerivation (args // { - jailbreak = true; - doCheck = false; - }); - }; -in { - inherit disabledPlugins; - tweakHpkgs = hpkgs: hpkgs.extend hpkgsOverride; -} diff --git a/configuration-ghc-921.nix b/configuration-ghc-92.nix similarity index 69% rename from configuration-ghc-921.nix rename to configuration-ghc-92.nix index d8660da1d9..b44e0fba67 100644 --- a/configuration-ghc-921.nix +++ b/configuration-ghc-92.nix @@ -1,4 +1,3 @@ -# nix version of cabal-ghc901.project { pkgs, inputs }: let @@ -14,19 +13,22 @@ let ]; hpkgsOverride = hself: hsuper: - with pkgs.haskell.lib; - { + with pkgs.haskell.lib; { hlsDisabledPlugins = disabledPlugins; - fourmolu = hself.callCabal2nix "fourmolu" inputs.fourmolu {}; - primitive-extras = hself.primitive-extras_0_10_1_2; - ghc-exactprint = hself.callCabal2nix "ghc-exactprint" inputs.ghc-exactprint {}; - constraints-extras = hself.callCabal2nix "constraints-extras" inputs.constraints-extras {}; - retrie = hself.callCabal2nix "retrie" inputs.retrie {}; + fourmolu = hself.callCabal2nix "fourmolu" inputs.fourmolu { }; + ghc-exactprint = + hself.callCabal2nix "ghc-exactprint" inputs.ghc-exactprint-150 { }; + constraints-extras = + hself.callCabal2nix "constraints-extras" inputs.constraints-extras { }; + retrie = hself.callCabal2nix "retrie" inputs.retrie { }; + + # ptr-poker breaks on MacOS without SSE2 optimizations + # https://github.com/nikita-volkov/ptr-poker/issues/11 + ptr-poker = hself.callCabal2nix "ptr-poker" inputs.ptr-poker { }; # Hlint is still broken - hlint = doJailbreak (hself.callCabal2nix "hlint" inputs.hlint {}); - hiedb = hself.hiedb_0_4_1_0; + hlint = doJailbreak (hself.callCabal2nix "hlint" inputs.hlint { }); # Re-generate HLS drv excluding some plugins haskell-language-server = diff --git a/docs/requirements.txt b/docs/requirements.txt index 66d33da6c1..b46859cb93 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,4 @@ Sphinx==4.0.2 sphinx-rtd-theme==0.5.2 myst-parser==0.15.1 -docutils<0.17 +docutils<0.19 diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 68642dada1..192ea006f8 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -174,7 +174,7 @@ cabal update && cabal install :pkg:haskell-language-server If you are compiling with a ghc version with a specific `cabal-ghc${ghcVersion}.project` in the repo you will have to use it. For example for ghc-9.0.x: ```bash -cabal update && cabal install :pkg:haskell-language-server --project-file=cabal-ghc90.project +cabal update && cabal install pkg:haskell-language-server ``` Or with `stack`: @@ -192,7 +192,7 @@ ghcup compile hls -v 1.6.1.0 --ghc 8.10.7 as it uses cabal underneath you might need to use a specific cabal.project for some ghc versions: ```bash -ghcup compile hls -v 1.6.1.0 --ghc 9.0.2 --cabal-project cabal-ghc90.project +ghcup compile hls -v 1.6.1.0 --ghc 9.0.2 ``` ### Preprocessors diff --git a/docutils.nix b/docutils.nix new file mode 100644 index 0000000000..1c47e1455d --- /dev/null +++ b/docutils.nix @@ -0,0 +1,32 @@ +{ stdenv, lib, fetchPypi, buildPythonPackage, isPy3k, python }: + +buildPythonPackage rec { + pname = "docutils"; + version = "0.17.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125"; + }; + + # Only Darwin needs LANG, but we could set it in general. + # It's done here conditionally to prevent mass-rebuilds. + checkPhase = lib.optionalString (isPy3k && stdenv.isDarwin) + ''LANG="en_US.UTF-8" LC_ALL="en_US.UTF-8" '' + '' + ${python.interpreter} test/alltests.py + ''; + + # Create symlinks lacking a ".py" suffix, many programs depend on these names + postFixup = '' + for f in $out/bin/*.py; do + ln -s $(basename $f) $out/bin/$(basename $f .py) + done + ''; + + meta = with lib; { + description = "Python Documentation Utilities"; + homepage = "http://docutils.sourceforge.net/"; + license = with licenses; [ publicDomain bsd2 psfl gpl3Plus ]; + maintainers = with maintainers; [ AndersonTorres ]; + }; +} diff --git a/flake.lock b/flake.lock index b1d15496c1..c73bd0fc2b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,29 @@ { "nodes": { + "aeson-1520": { + "flake": false, + "locked": { + "narHash": "sha256-btKp7CTOgC0wT33lROffARW9qr1jx9oKE5EWydaR52c=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/aeson-1.5.2.0/aeson-1.5.2.0.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/aeson-1.5.2.0/aeson-1.5.2.0.tar.gz" + } + }, + "brittany-01312": { + "flake": false, + "locked": { + "narHash": "sha256-4rDE2bu4C8cv1D6lkTtLxMwLRyDfIK70BnptSrygK60=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/brittany-0.13.1.2/brittany-0.13.1.2.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/brittany-0.13.1.2/brittany-0.13.1.2.tar.gz" + } + }, "constraints-extras": { "flake": false, "locked": { @@ -15,11 +39,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1641205782, - "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", "owner": "edolstra", "repo": "flake-compat", - "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", "type": "github" }, "original": { @@ -30,11 +54,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1629481132, - "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", "owner": "numtide", "repo": "flake-utils", - "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", "type": "github" }, "original": { @@ -45,11 +69,26 @@ }, "flake-utils_2": { "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", "owner": "numtide", "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", "type": "github" }, "original": { @@ -70,6 +109,18 @@ "url": "https://hackage.haskell.org/package/fourmolu-0.5.0.1/fourmolu-0.5.0.1.tar.gz" } }, + "fourmolu-0300": { + "flake": false, + "locked": { + "narHash": "sha256-SFBwhkXfDArITiBSxGSp2qf8gl+yBpWHglBB5aKeaBU=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/fourmolu-0.3.0.0/fourmolu-0.3.0.0.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/fourmolu-0.3.0.0/fourmolu-0.3.0.0.tar.gz" + } + }, "ghc-exactprint": { "flake": false, "locked": { @@ -82,14 +133,26 @@ "url": "https://hackage.haskell.org/package/ghc-exactprint-1.4.1/ghc-exactprint-1.4.1.tar.gz" } }, + "ghc-exactprint-150": { + "flake": false, + "locked": { + "narHash": "sha256-f+WmS86c7B0dx2SMABIMm66z6sbRVWdqSZ1QBBEpUMw=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/ghc-exactprint-1.5.0/ghc-exactprint-1.5.0.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/ghc-exactprint-1.5.0/ghc-exactprint-1.5.0.tar.gz" + } + }, "gitignore": { "flake": false, "locked": { - "lastModified": 1611672876, - "narHash": "sha256-qHu3uZ/o9jBHiA3MEKHJ06k7w4heOhA+4HCSIvflRxo=", + "lastModified": 1646480205, + "narHash": "sha256-kekOlTlu45vuK2L9nq8iVN17V3sB0WWPqTTW3a2SQG0=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "211907489e9f198594c0eb0ca9256a1949c9d412", + "rev": "bff2832ec341cf30acb3a4d3e2e7f1f7b590116a", "type": "github" }, "original": { @@ -101,13 +164,13 @@ "hie-bios": { "flake": false, "locked": { - "narHash": "sha256-nd+FfUQVZNxJfKZkAWA3dF0JwRgXntL+1gGvyNHDbKc=", + "narHash": "sha256-5RqspT27rb/tMBwrKr4VfSSbq0+c0LMNuaKlTun0Kkk=", "type": "tarball", - "url": "https://hackage.haskell.org/package/hie-bios-0.9.0/hie-bios-0.9.0.tar.gz" + "url": "https://hackage.haskell.org/package/hie-bios-0.9.1/hie-bios-0.9.1.tar.gz" }, "original": { "type": "tarball", - "url": "https://hackage.haskell.org/package/hie-bios-0.9.0/hie-bios-0.9.0.tar.gz" + "url": "https://hackage.haskell.org/package/hie-bios-0.9.1/hie-bios-0.9.1.tar.gz" } }, "hlint": { @@ -122,6 +185,18 @@ "url": "https://hackage.haskell.org/package/hlint-3.3.6/hlint-3.3.6.tar.gz" } }, + "hlint-34": { + "flake": false, + "locked": { + "narHash": "sha256-mDncRtVkjWnUbZc1fgDMGcGjy8CFNxUF8z2HGuuN7GU=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/hlint-3.4/hlint-3.4.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/hlint-3.4/hlint-3.4.tar.gz" + } + }, "implicit-hie-cradle": { "flake": false, "locked": { @@ -170,13 +245,30 @@ "url": "https://hackage.haskell.org/package/lsp-types-1.4.0.1/lsp-types-1.4.0.1.tar.gz" } }, + "myst-parser": { + "flake": false, + "locked": { + "lastModified": 1650933355, + "narHash": "sha256-Osd3urvH1bn9w/6sAMyLKHO7gxuYePpGJ9y8ReBfp4E=", + "owner": "smunix", + "repo": "MyST-Parser", + "rev": "57d0d78169a0e157406c35df951bdffdf94b4f9b", + "type": "github" + }, + "original": { + "owner": "smunix", + "ref": "fix.hls-docutils", + "repo": "MyST-Parser", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1639357775, - "narHash": "sha256-mJJFCPqZi1ZO3CvgEfN2nFAYv4uAJSRnTKzLFi61+WA=", + "lastModified": 1650792148, + "narHash": "sha256-n1MZSZIzvP70BJ56tV8GwQ5L0wHt/nTH9UkF5HTGB/4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c473cc8714710179df205b153f4e9fa007107ff9", + "rev": "ab83c5d70528f1edc7080dead3a5dee61797b3ff", "type": "github" }, "original": { @@ -188,11 +280,26 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1641016545, - "narHash": "sha256-JMNwvnBzG0RjGG3eH27Y5/GlJ9ryeCdGJfqGbqxnmZY=", + "lastModified": 1650933476, + "narHash": "sha256-kBefFyATME/AGGFMudAltOeKYnSc3YDOI0YgDjjIhzw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6f05cfdb1e78d36c0337516df674560e4b51c79b", + "rev": "7deb7b084d6959f4076bcf0ff4aa0a120f1d31ca", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1645655918, + "narHash": "sha256-ZfbEFRW7o237+A1P7eTKhXje435FCAoe0blj2n20Was=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "77a7a4197740213879b9a1d2e1788c6c8ade4274", "type": "github" }, "original": { @@ -200,17 +307,37 @@ "type": "indirect" } }, - "pre-commit-hooks": { + "poetry2nix": { "inputs": { "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1624971177, - "narHash": "sha256-Amf/nBj1E77RmbSSmV+hg6YOpR+rddCbbVgo5C7BS0I=", + "lastModified": 1650693998, + "narHash": "sha256-rypGV9HND1VsR/DEtD4O3cPcwCJVfIiTKvEbYskQSqg=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "8cfd980262181bd3ef15899708ceeb2e3f33958b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "poetry2nix", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1649054408, + "narHash": "sha256-wz8AH7orqUE4Xog29WMTqOYBs0DMj2wFM8ulrTRVgz0=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "397f0713d007250a2c7a745e555fa16c5dc8cadb", + "rev": "e5e7b3b542e7f4f96967966a943d7e1c07558042", "type": "github" }, "original": { @@ -219,6 +346,18 @@ "type": "github" } }, + "ptr-poker": { + "flake": false, + "locked": { + "narHash": "sha256-ll3wuUjkhTE8Grcs8LfGpdiuyobrSBmwgjqPOTlrPac=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/ptr-poker-0.1.2.8/ptr-poker-0.1.2.8.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/ptr-poker-0.1.2.8/ptr-poker-0.1.2.8.tar.gz" + } + }, "retrie": { "flake": false, "locked": { @@ -233,21 +372,60 @@ }, "root": { "inputs": { + "aeson-1520": "aeson-1520", + "brittany-01312": "brittany-01312", "constraints-extras": "constraints-extras", "flake-compat": "flake-compat", "flake-utils": "flake-utils", "fourmolu": "fourmolu", + "fourmolu-0300": "fourmolu-0300", "ghc-exactprint": "ghc-exactprint", + "ghc-exactprint-150": "ghc-exactprint-150", "gitignore": "gitignore", "hie-bios": "hie-bios", "hlint": "hlint", + "hlint-34": "hlint-34", "implicit-hie-cradle": "implicit-hie-cradle", "lsp": "lsp", "lsp-test": "lsp-test", "lsp-types": "lsp-types", + "myst-parser": "myst-parser", "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix", "pre-commit-hooks": "pre-commit-hooks", - "retrie": "retrie" + "ptr-poker": "ptr-poker", + "retrie": "retrie", + "sphinx_rtd_theme": "sphinx_rtd_theme", + "stylish-haskell-01220": "stylish-haskell-01220" + } + }, + "sphinx_rtd_theme": { + "flake": false, + "locked": { + "lastModified": 1628276861, + "narHash": "sha256-fzqi0QfDSiN8YXtAiWXIoOlyHZQI4V32uOKZjPfWeWY=", + "owner": "readthedocs", + "repo": "sphinx_rtd_theme", + "rev": "34f81daaf52466366c80003db293d50075c1b896", + "type": "github" + }, + "original": { + "owner": "readthedocs", + "repo": "sphinx_rtd_theme", + "rev": "34f81daaf52466366c80003db293d50075c1b896", + "type": "github" + } + }, + "stylish-haskell-01220": { + "flake": false, + "locked": { + "narHash": "sha256-uQIvhz/xRbKLHe9et+tHUVE9To5vt1Pz3+vvDEqJaLI=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/stylish-haskell-0.12.2.0/stylish-haskell-0.12.2.0.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/stylish-haskell-0.12.2.0/stylish-haskell-0.12.2.0.tar.gz" } } }, diff --git a/flake.nix b/flake.nix index 1676dbed47..ba822865b0 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,10 @@ url = "https://hackage.haskell.org/package/lsp-test-0.14.0.2/lsp-test-0.14.0.2.tar.gz"; flake = false; }; + ghc-exactprint-150 = { + url = "https://hackage.haskell.org/package/ghc-exactprint-1.5.0/ghc-exactprint-1.5.0.tar.gz"; + flake = false; + }; ghc-exactprint = { url = "https://hackage.haskell.org/package/ghc-exactprint-1.4.1/ghc-exactprint-1.4.1.tar.gz"; flake = false; @@ -51,10 +55,34 @@ url = "https://hackage.haskell.org/package/fourmolu-0.5.0.1/fourmolu-0.5.0.1.tar.gz"; flake = false; }; + fourmolu-0300 = { + url = "https://hackage.haskell.org/package/fourmolu-0.3.0.0/fourmolu-0.3.0.0.tar.gz"; + flake = false; + }; + aeson-1520= { + url = "https://hackage.haskell.org/package/aeson-1.5.2.0/aeson-1.5.2.0.tar.gz"; + flake = false; + }; + brittany-01312 = { + url = "https://hackage.haskell.org/package/brittany-0.13.1.2/brittany-0.13.1.2.tar.gz"; + flake = false; + }; hlint = { url = "https://hackage.haskell.org/package/hlint-3.3.6/hlint-3.3.6.tar.gz"; flake = false; }; + hlint-34 = { + url = "https://hackage.haskell.org/package/hlint-3.4/hlint-3.4.tar.gz"; + flake = false; + }; + ptr-poker = { + url = "https://hackage.haskell.org/package/ptr-poker-0.1.2.8/ptr-poker-0.1.2.8.tar.gz"; + flake = false; + }; + stylish-haskell-01220 = { + url = "https://hackage.haskell.org/package/stylish-haskell-0.12.2.0/stylish-haskell-0.12.2.0.tar.gz"; + flake = false; + }; implicit-hie-cradle = { url = "https://hackage.haskell.org/package/implicit-hie-cradle-0.3.0.5/implicit-hie-cradle-0.3.0.5.tar.gz"; flake = false; @@ -63,11 +91,21 @@ url = "https://hackage.haskell.org/package/hie-bios-0.9.1/hie-bios-0.9.1.tar.gz"; flake = false; }; + myst-parser = { + url = "github:smunix/MyST-Parser?ref=fix.hls-docutils"; + flake = false; + }; + # For https://github.com/readthedocs/sphinx_rtd_theme/pull/1185, otherwise lists are broken locally + sphinx_rtd_theme = { + url = "github:readthedocs/sphinx_rtd_theme?rev=34f81daaf52466366c80003db293d50075c1b896"; + flake = false; + }; + poetry2nix.url = "github:nix-community/poetry2nix/master"; }; outputs = inputs@{ self, nixpkgs, flake-compat, flake-utils, pre-commit-hooks, gitignore, ... }: { - overlay = final: prev: + overlays.default = final: prev: with prev; let haskellOverrides = hself: hsuper: { @@ -114,8 +152,6 @@ github = overrideCabal hsuper.github (drv: { patches = []; }); # GHCIDE requires hie-bios ^>=0.9.1 hie-bios = hself.callCabal2nix "hie-bios" inputs.hie-bios {}; - # We need an older version - hiedb = hself.hiedb_0_4_1_0; lsp = hsuper.callCabal2nix "lsp" inputs.lsp {}; lsp-types = hsuper.callCabal2nix "lsp-types" inputs.lsp-types {}; @@ -171,7 +207,7 @@ let pkgs = import nixpkgs { inherit system; - overlays = [ self.overlay ]; + overlays = [ self.overlays.default inputs.poetry2nix.overlay ]; config = { allowBroken = true; }; }; @@ -206,29 +242,46 @@ }; }; - ghc901Config = (import ./configuration-ghc-901.nix) { inherit pkgs; }; - ghc921Config = (import ./configuration-ghc-921.nix) { inherit pkgs inputs; }; + ghc88Config = (import ./configuration-ghc-88.nix) { inherit pkgs inputs; }; + ghc810Config = (import ./configuration-ghc-810.nix) { inherit pkgs inputs; }; + ghc902Config = (import ./configuration-ghc-90.nix) { inherit pkgs inputs; }; + ghc922Config = (import ./configuration-ghc-92.nix) { inherit pkgs inputs; }; # GHC versions - ghcDefault = pkgs.hlsHpkgs ("ghc" - + pkgs.lib.replaceStrings [ "." ] [ "" ] - pkgs.haskellPackages.ghc.version); - ghc884 = pkgs.hlsHpkgs "ghc884"; - ghc8107 = pkgs.hlsHpkgs "ghc8107"; - ghc901 = ghc901Config.tweakHpkgs (pkgs.hlsHpkgs "ghc901"); - ghc921 = ghc921Config.tweakHpkgs (pkgs.hlsHpkgs "ghc921"); + supportedGHCs = let + ghcVersion = "ghc" + (pkgs.lib.replaceStrings ["."] [""] pkgs.haskellPackages.ghc.version); + cases = { + ghc884 = ghc88Config.tweakHpkgs (pkgs.hlsHpkgs "ghc884"); + ghc8107 = ghc810Config.tweakHpkgs (pkgs.hlsHpkgs "ghc8107"); + ghc902 = ghc902Config.tweakHpkgs (pkgs.hlsHpkgs "ghc902"); + ghc922 = ghc922Config.tweakHpkgs (pkgs.hlsHpkgs "ghc922"); + }; + in { default = cases."${ghcVersion}"; } // cases; + + ghc884 = supportedGHCs.ghc884; + ghc8107 = supportedGHCs.ghc8107; + ghc902 = supportedGHCs.ghc902; + ghc922 = supportedGHCs.ghc922; + ghcDefault = supportedGHCs.default; # For markdown support - myst-parser = pkgs.python3Packages.callPackage ./myst-parser.nix {}; - sphinx_rtd_theme = pkgs.python3Packages.sphinx_rtd_theme.overrideAttrs (oldAttrs: { - # For https://github.com/readthedocs/sphinx_rtd_theme/pull/1185, otherwise lists are broken locally - src = pkgs.fetchFromGitHub { - owner = "readthedocs"; - repo = "sphinx_rtd_theme"; - rev = "34f81daaf52466366c80003db293d50075c1b896"; - sha256 = "0rkrsvvqr6g2p3v5vq88jhfp5sd0r1jqjh3vc5y26jn30z8s4fkz"; - }; - }); + myst-parser = pkgs.poetry2nix.mkPoetryEnv { + projectDir = inputs.myst-parser; + python = pkgs.python39; + overrides = [ + pkgs.poetry2nix.defaultPoetryOverrides + ]; + }; + sphinx_rtd_theme = pkgs.poetry2nix.mkPoetryEnv { + projectDir = inputs.sphinx_rtd_theme; + python = pkgs.python39; + overrides = [ + pkgs.poetry2nix.defaultPoetryOverrides + (self: super: { + docutils = pkgs.python3Packages.callPackage ./docutils.nix {}; + }) + ]; + }; pythonWithPackages = pkgs.python3.withPackages (ps: [ps.sphinx myst-parser sphinx_rtd_theme ps.pip]); docs = pkgs.stdenv.mkDerivation { @@ -270,6 +323,7 @@ capstone tracy # ormolu # stylish-haskell + pre-commit ]; @@ -280,7 +334,7 @@ export PATH=$PATH:$HOME/.local/bin # Enable the shell hooks - ${(pre-commit-check ghcDefault).shellHook} + ${self.checks.${system}.pre-commit-check.shellHook} # If the cabal project file is not the default one. # Print a warning and generate an alias. @@ -336,8 +390,8 @@ haskell-language-server-dev = mkDevShell ghcDefault "cabal.project"; haskell-language-server-884-dev = mkDevShell ghc884 "cabal.project"; haskell-language-server-8107-dev = mkDevShell ghc8107 "cabal.project"; - haskell-language-server-901-dev = mkDevShell ghc901 "cabal-ghc90.project"; - haskell-language-server-921-dev = mkDevShell ghc921 "cabal-ghc92.project"; + haskell-language-server-902-dev = mkDevShell ghc902 "cabal.project"; + haskell-language-server-922-dev = mkDevShell ghc922 "cabal-ghc92.project"; }; # Developement shell, haskell packages are also provided by nix @@ -345,21 +399,26 @@ haskell-language-server-dev-nix = mkDevShellWithNixDeps ghcDefault "cabal.project"; haskell-language-server-884-dev-nix = mkDevShellWithNixDeps ghc884 "cabal.project"; haskell-language-server-8107-dev-nix = mkDevShellWithNixDeps ghc8107 "cabal.project"; - haskell-language-server-901-dev-nix = mkDevShellWithNixDeps ghc901 "cabal-ghc90.project"; - haskell-language-server-921-dev-nix = mkDevShellWithNixDeps ghc921 "cabal-ghc92.project"; + haskell-language-server-902-dev-nix = mkDevShellWithNixDeps ghc902 "cabal.project"; + haskell-language-server-922-dev-nix = mkDevShellWithNixDeps ghc922 "cabal-ghc92.project"; }; allPackages = { haskell-language-server = mkExe ghcDefault; haskell-language-server-884 = mkExe ghc884; haskell-language-server-8107 = mkExe ghc8107; - haskell-language-server-901 = mkExe ghc901; - haskell-language-server-921 = mkExe ghc921; + haskell-language-server-902 = mkExe ghc902; + haskell-language-server-922 = mkExe ghc922; }; - devShells = simpleDevShells // nixDevShells; + devShells = simpleDevShells // nixDevShells // { + default = simpleDevShells.haskell-language-server-dev; + inherit (self.checks.${system}.pre-commit-check) shellHook; + }; packages = allPackages // { + default = allPackages.haskell-language-server; + # See https://github.com/NixOS/nix/issues/5591 # nix flake cannot build a list/set of derivation in one command. # Using a linkFarmFromDrvs, I'm creating a unique entry point to @@ -377,9 +436,10 @@ docs = docs; }; - defaultPackage = packages.haskell-language-server; + checks = { pre-commit-check = pre-commit-check ghcDefault; }; - devShell = devShells.haskell-language-server-dev; + devShell = devShells.default; + defaultPackage = packages.default; }); nixConfig = { diff --git a/hie-compat/hie-compat.cabal b/hie-compat/hie-compat.cabal index 13b0cb3ef1..0683c7a628 100644 --- a/hie-compat/hie-compat.cabal +++ b/hie-compat/hie-compat.cabal @@ -24,7 +24,7 @@ library default-language: Haskell2010 build-depends: base < 4.17, array, bytestring, containers, directory, filepath, transformers - if flag(ghc-lib) + if flag(ghc-lib) && impl(ghc < 9) build-depends: ghc-lib < 9.0 else build-depends: ghc, ghc-boot