Skip to content

Commit

Permalink
chore: add the nix stuffs for GHC 9.4
Browse files Browse the repository at this point in the history
I've just added naively the different nix lines. The configuration file
comes from a copy of the one for 9.2.

With that, we can open a shell with `nix develop
.\#haskell-language-server-941-dev` and type `cabal build`.

(cherry picked from commit 48084ab)
  • Loading branch information
guibou authored and wz1000 committed Aug 31, 2022
1 parent 111901f commit a888817
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
42 changes: 42 additions & 0 deletions configuration-ghc-94.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ pkgs, inputs }:

let
disabledPlugins = [
"hls-hlint-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;
# YOLO
mkDerivation = args:
hsuper.mkDerivation (args // {
jailbreak = true;
doCheck = false;
});
} // (builtins.mapAttrs (_: drv: disableLibraryProfiling drv) {
# 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-exactprint =
hself.callCabal2nix "ghc-exactprint" inputs.ghc-exactprint-150 { };
# Hlint is still broken
hlint = doJailbreak (hself.callCabal2nix "hlint" inputs.hlint { });

stylish-haskell = appendConfigureFlag hsuper.stylish-haskell "-fghc-lib";

# Re-generate HLS drv excluding some plugins
haskell-language-server =
hself.callCabal2nixWithOptions "haskell-language-server" ./.
(pkgs.lib.concatStringsSep " " [ "-fpedantic" "-f-hlint" ]) { };
});
in {
inherit disabledPlugins;
tweakHpkgs = hpkgs: hpkgs.extend hpkgsOverride;
}
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@

ghc902Config = (import ./configuration-ghc-90.nix) { inherit pkgs inputs; };
ghc924Config = (import ./configuration-ghc-92.nix) { inherit pkgs inputs; };
ghc941Config = (import ./configuration-ghc-94.nix) { inherit pkgs inputs; };

# GHC versions
# While HLS still works fine with 8.10 GHCs, we only support the versions that are cached
Expand All @@ -224,11 +225,13 @@
cases = {
ghc902 = ghc902Config.tweakHpkgs (pkgs.hlsHpkgs "ghc902");
ghc924 = ghc924Config.tweakHpkgs (pkgs.hlsHpkgs "ghc924");
ghc941 = ghc941Config.tweakHpkgs (pkgs.hlsHpkgs "ghc941");
};
in { default = cases."${ghcVersion}"; } // cases;

ghc902 = supportedGHCs.ghc902;
ghc924 = supportedGHCs.ghc924;
ghc941 = supportedGHCs.ghc941;
ghcDefault = supportedGHCs.default;

# For markdown support
Expand Down Expand Up @@ -361,19 +364,22 @@
haskell-language-server-dev = mkDevShell ghcDefault "cabal.project";
haskell-language-server-902-dev = mkDevShell ghc902 "cabal.project";
haskell-language-server-924-dev = mkDevShell ghc924 "cabal.project";
haskell-language-server-941-dev = mkDevShell ghc941 "cabal.project";
};

# Developement shell, haskell packages are also provided by nix
nixDevShells = {
haskell-language-server-dev-nix = mkDevShellWithNixDeps ghcDefault "cabal.project";
haskell-language-server-902-dev-nix = mkDevShellWithNixDeps ghc902 "cabal.project";
haskell-language-server-924-dev-nix = mkDevShellWithNixDeps ghc924 "cabal.project";
haskell-language-server-941-dev-nix = mkDevShellWithNixDeps ghc941 "cabal.project";
};

allPackages = {
haskell-language-server = mkExe ghcDefault;
haskell-language-server-902 = mkExe ghc902;
haskell-language-server-924 = mkExe ghc924;
haskell-language-server-941 = mkExe ghc941;
};

devShells = simpleDevShells // nixDevShells // {
Expand Down

0 comments on commit a888817

Please sign in to comment.