diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 3bc009c411..f48b8c2d9c 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -92,11 +92,15 @@ jobs: authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }} - name: Build development shell run: nix develop --profile dev + - name: Build development shell (GHC 9.0.1) + run: nix develop .#haskell-language-server-901-dev --profile dev - name: Push development shell if: ${{ env.HAS_TOKEN == 'true' }} run: cachix push haskell-language-server dev - name: Build binaries run: nix build + - name: Build binaries (GHC 9.0.1) + run: nix build .#haskell-language-server-901 - name: Push binaries if: ${{ env.HAS_TOKEN == 'true' }} run: nix path-info --json | jq -r '.[].path' | cachix push haskell-language-server diff --git a/cabal-ghc901.project b/cabal-ghc901.project index c6242f007a..942cfe7691 100644 --- a/cabal-ghc901.project +++ b/cabal-ghc901.project @@ -75,6 +75,13 @@ source-repository-package subdir: lsp-test -- https://github.com/haskell/lsp/pull/312 +-- benchmark dependency +source-repository-package + type: git + location: https://github.com/berberman/operational + tag: 0e062895678f49fd673ae493371262cfb8c5ab56 +-- https://github.com/HeinrichApfelmus/operational/pull/26 + write-ghc-environment-files: never index-state: 2021-06-30T16:00:00Z diff --git a/configuration-ghc-901.nix b/configuration-ghc-901.nix new file mode 100644 index 0000000000..9c74864608 --- /dev/null +++ b/configuration-ghc-901.nix @@ -0,0 +1,128 @@ +# nix version of cabal-ghc901.project +{ pkgs }: + +let + disabledPlugins = [ + "hls-tactics-plugin" + "hls-brittany-plugin" + "hls-stylish-haskell-plugin" + "hls-fourmolu-plugin" + "hls-splice-plugin" + "hls-ormolu-plugin" + "hls-eval-plugin" + "hls-class-plugin" + "hls-refine-imports-plugin" + ]; + + hpkgsOverride = hself: hsuper: + with pkgs.haskell.lib; + let + lsp-src = pkgs.fetchFromGitHub { + owner = "anka-213"; + repo = "lsp"; + rev = "tag-ghc-9.0.1-without-pr-326"; + sha256 = "lW/EdBnvKPLE2+CGE/grIekOu+U/Wh6zMCN4xhJDtPY="; + }; + + dependent-sum-src = pkgs.fetchFromGitHub { + owner = "anka-213"; + repo = "dependent-sum"; + rev = "8cf4c7fbc3bfa2be475a17bb7c94a1e1e9a830b5"; + sha256 = "WtxTB6ufTZC6SxOtGSfhlO4mY0y9eWejMSa0yUJ7dHQ="; + }; + in { + blaze-textual = hself.callCabal2nix "blaze-textual" + (pkgs.fetchFromGitHub { + owner = "jwaldmann"; + repo = "blaze-textual"; + rev = "d8ee6cf80e27f9619d621c936bb4bda4b99a183f"; + sha256 = "C0dIzf64fBaY8mlhMm1kCQC5Jc1wKBtNO2Y24k7YPUw="; + }) { }; + + czipwith = hself.callCabal2nix "czipwith" (pkgs.fetchFromGitHub { + owner = "mithrandi"; + repo = "czipwith"; + rev = "b6245884ae83e00dd2b5261762549b37390179f8"; + sha256 = "2uSoGyrxT/OstRcpx55kwP4JwjPbWLxD72LajeyQV0E="; + }) { }; + + hie-bios = hself.callCabal2nix "hie-bios" (pkgs.fetchFromGitHub { + owner = "jneira"; + repo = "hie-bios"; + rev = "9b1445ab5efcabfad54043fc9b8e50e9d8c5bbf3"; + sha256 = "8ct7t3xIxIAoC+f8VO5e5+QKrd5L5Zu1eButSaE+1Uk="; + }) { }; + + ghc-api-compat = hself.callCabal2nix "ghc-api-compat" + (pkgs.fetchFromGitHub { + owner = "hsyl20"; + repo = "ghc-api-compat"; + rev = "8fee87eac97a538dbe81ff1ab18cff10f2f9fa15"; + sha256 = "byehvdxQxhNk5ZQUXeFHjAZpAze4Ct9261ro4c5acZk="; + }) { }; + + th-extras = hself.callCabal2nix "th-extras" (pkgs.fetchFromGitHub { + owner = "anka-213"; + repo = "th-extras"; + rev = "57a97b4df128eb7b360e8ab9c5759392de8d1659"; + sha256 = "Qtha1ge/C0L+uFcV2dZ5xpG59DCxQT7LuK/OYfiM4Pk="; + }) { }; + + lsp = hself.callCabal2nix "lsp" "${lsp-src}/lsp" { }; + lsp-types = hself.callCabal2nix "lsp-types" "${lsp-src}/lsp-types" { }; + lsp-test = hself.callCabal2nix "lsp-test" "${lsp-src}/lsp-test" { }; + + dependent-sum = + hself.callCabal2nix "dependent-sum" "${dependent-sum-src}/dependent-sum" + { }; + + dependent-sum-template = hself.callCabal2nix "dependent-sum-template" + "${dependent-sum-src}/dependent-sum-template" { }; + + hlint = hself.hlint_3_3_1; + + ghc-lib-parser = hself.ghc-lib-parser_9_0_1_20210324; + + ghc-lib-parser-ex = hself.ghc-lib-parser-ex_9_0_0_4; + + operational = hself.callCabal2nix "operational" (pkgs.fetchFromGitHub { + owner = "berberman"; + repo = "operational"; + rev = "0e062895678f49fd673ae493371262cfb8c5ab56"; + sha256 = "P+aocEcqCN8klnW3IMrmIqq6ztBZJxk4sBp1ewN6YaA="; + }) { }; + + diagrams-core = hself.diagrams-core_1_5_0; + + diagrams-lib = hself.diagrams-lib_1_4_4; + + dual-tree = hself.dual-tree_0_2_3_0; + + monoid-extras = hself.monoid-extras_0_6; + + # Re-generate HLS drv excluding some plugins + haskell-language-server = + hself.callCabal2nixWithOptions "haskell-language-server" ./. + (pkgs.lib.concatStringsSep " " [ + "-f-brittany" + "-f-class" + "-f-eval" + "-f-fourmolu" + "-f-ormolu" + "-f-splice" + "-f-stylishhaskell" + "-f-tactic" + "-f-refineImports" + ]) { }; + + # YOLO + mkDerivation = args: + hsuper.mkDerivation (args // { + jailbreak = true; + doCheck = false; + }); + }; +in { + inherit disabledPlugins; + tweakHpkgs = hpkgs: hpkgs.extend hpkgsOverride; +} diff --git a/flake.nix b/flake.nix index 1a3c5d3f47..ea8cdc3c65 100644 --- a/flake.nix +++ b/flake.nix @@ -30,24 +30,22 @@ overlay = final: prev: with prev; let - haskellOverrides = { - overrides = hself: hsuper: { - # we override mkDerivation here to apply the following - # tweak to each haskell package: - # if the package is broken, then we disable its check and relax the cabal bounds; - # otherwise, we leave it unchanged. - # hopefully, this could fix packages marked as broken by nix due to check failures - # or the build failure because of tight cabal bounds - mkDerivation = args: - let - broken = args.broken or false; - check = args.doCheck or true; - jailbreak = args.jailbreak or false; - in hsuper.mkDerivation (args // { - jailbreak = if broken then true else jailbreak; - doCheck = if broken then false else check; - }); - }; + haskellOverrides = hself: hsuper: { + # we override mkDerivation here to apply the following + # tweak to each haskell package: + # if the package is broken, then we disable its check and relax the cabal bounds; + # otherwise, we leave it unchanged. + # hopefully, this could fix packages marked as broken by nix due to check failures + # or the build failure because of tight cabal bounds + mkDerivation = args: + let + broken = args.broken or false; + check = args.doCheck or true; + jailbreak = args.jailbreak or false; + in hsuper.mkDerivation (args // { + jailbreak = if broken then true else jailbreak; + doCheck = if broken then false else check; + }); }; gitignoreSource = (import gitignore { inherit lib; }).gitignoreSource; @@ -91,7 +89,10 @@ builtins.mapAttrs (_: dir: gitignoreSource dir) sourceDirs; extended = hpkgs: - (hpkgs.override haskellOverrides).extend (hself: hsuper: + (hpkgs.override (old: { + overrides = lib.composeExtensions (old.overrides or (_: _: { })) + haskellOverrides; + })).extend (hself: hsuper: # disable all checks for our packages builtins.mapAttrs (_: drv: haskell.lib.dontCheck drv) (lib.composeExtensions @@ -135,7 +136,7 @@ hooks = { stylish-haskell.enable = true; # use stylish-haskell with our target ghc - stylish-haskell.entry = "${hpkgs.stylish-haskell}/bin/stylish-haskell --inplace"; + stylish-haskell.entry = pkgs.lib.mkForce "${hpkgs.stylish-haskell}/bin/stylish-haskell --inplace"; stylish-haskell.excludes = [ # Ignored files "^Setup.hs$" @@ -156,6 +157,8 @@ }; }; + ghc901Config = (import ./configuration-ghc-901.nix) { inherit pkgs; }; + # GHC versions ghcDefault = pkgs.hlsHpkgs ("ghc" + pkgs.lib.replaceStrings [ "." ] [ "" ] @@ -163,7 +166,7 @@ ghc884 = pkgs.hlsHpkgs "ghc884"; ghc8104 = pkgs.hlsHpkgs "ghc8104"; ghc8105 = pkgs.hlsHpkgs "ghc8105"; - ghc901 = pkgs.hlsHpkgs "ghc901"; + ghc901 = ghc901Config.tweakHpkgs (pkgs.hlsHpkgs "ghc901"); # Create a development shell of hls project # See https://github.com/NixOS/nixpkgs/blob/5d4a430472cafada97888cc80672fab255231f57/pkgs/development/haskell-modules/make-package-set.nix#L319 @@ -173,13 +176,17 @@ doBenchmark = true; packages = p: with builtins; - map (name: p.${name}) (attrNames hlsSources); + map (name: p.${name}) (attrNames + (if hpkgs.ghc.version == "9.0.1" then + removeAttrs hlsSources ghc901Config.disabledPlugins + else + hlsSources)); buildInputs = [ gmp zlib ncurses capstone tracy (gen-hls-changelogs hpkgs) ] ++ (with hpkgs; [ cabal-install hlint - ormolu - stylish-haskell + # ormolu + # stylish-haskell opentelemetry-extra ]); @@ -188,7 +195,7 @@ export LD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib export DYLD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib export PATH=$PATH:$HOME/.local/bin - ${(pre-commit-check hpkgs).shellHook} + ${if hpkgs.ghc.version != "9.0.1" then (pre-commit-check hpkgs).shellHook else ""} ''; }; # Create a hls executable @@ -213,14 +220,14 @@ haskell-language-server-884-dev = mkDevShell ghc884; haskell-language-server-8104-dev = mkDevShell ghc8104; haskell-language-server-8105-dev = mkDevShell ghc8105; - haskell-language-server-901-dev = builtins.throw "Nix expression for developing HLS in GHC 9.0.1 is not yet available"; # mkDevShell ghc901; + haskell-language-server-901-dev = mkDevShell ghc901; # hls package haskell-language-server = mkExe ghcDefault; haskell-language-server-884 = mkExe ghc884; haskell-language-server-8104 = mkExe ghc8104; haskell-language-server-8105 = mkExe ghc8105; - haskell-language-server-901 = builtins.throw "Nix expression for building HLS in GHC 9.0.1 is not yet available"; # mkExe ghc901; + haskell-language-server-901 = mkExe ghc901; }; defaultPackage = packages.haskell-language-server; diff --git a/stack-9.0.1.yaml b/stack-9.0.1.yaml index c335fa7947..a38c400ef6 100644 --- a/stack-9.0.1.yaml +++ b/stack-9.0.1.yaml @@ -94,6 +94,11 @@ extra-deps: commit: ca23431a8dfa013992f9164ccc882a3277361f17 # https://github.com/diagrams/active/pull/36 +# benchmark dependency +- github: berberman/operational + commit: 0e062895678f49fd673ae493371262cfb8c5ab56 +# https://github.com/HeinrichApfelmus/operational/pull/26 + configure-options: ghcide: - --disable-library-for-ghci