Skip to content

nix: fix nix environment for GHC 9.4 #3133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configuration-ghc-90.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let
ghc-lib-parser-ex = hself.ghc-lib-parser-ex_9_2_0_4;

Cabal = hself.Cabal_3_6_3_0;
ormolu = hself.ormolu_0_5_0_0;
ormolu = hself.ormolu_0_5_0_1;
fourmolu = hself.fourmolu_0_6_0_0;
# Hlint is still broken
hlint = doJailbreak (hself.callCabal2nix "hlint" inputs.hlint-34 { });
Expand Down
13 changes: 13 additions & 0 deletions configuration-ghc-94.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ let

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

cereal = hsuper.callHackage "cereal" "0.5.8.3" {};
base-compat = hsuper.callHackage "base-compat" "0.12.2" {};
base-compat-batteries = hsuper.callHackage "base-compat-batteries" "0.12.2" {};
hashable = hsuper.callHackage "hashable" "1.4.1.0" {};
primitive = hsuper.callHackage "primitive" "0.7.4.0" {};
ghc-check = hsuper.callHackage "ghc-check" "0.5.0.8" {};
lens = hsuper.callHackage "lens" "5.2" {};
integer-logarithms = hsuper.callHackage "integer-logarithms" "1.0.3.1" {};
hiedb = hsuper.callHackage "hiedb" "0.4.2.0" {};
hie-bios = hsuper.callHackage "hie-bios" "0.11.0" {};
lsp = hsuper.callCabal2nix "lsp" "${inputs.lsp}/lsp" {};
lsp-types = hsuper.callCabal2nix "lsp-types" "${inputs.lsp}/lsp-types" {};

# Re-generate HLS drv excluding some plugins
haskell-language-server =
hself.callCabal2nixWithOptions "haskell-language-server" ./.
Expand Down
88 changes: 49 additions & 39 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 29 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
flake = false;
};

# List of hackage dependencies
lsp = {
url = "https://hackage.haskell.org/package/lsp-1.6.0.0/lsp-1.6.0.0.tar.gz";
# cabal hashes contains all the version for different haskell packages, to update:
# nix flake lock --update-input all-cabal-hashes-unpacked
all-cabal-hashes-unpacked = {
url = "github:commercialhaskell/all-cabal-hashes/current-hackage";
flake = false;
};
lsp-types = {
url = "https://hackage.haskell.org/package/lsp-types-1.6.0.0/lsp-types-1.6.0.0.tar.gz";

# List of hackage dependencies
lsp = {
url = "github:haskell/lsp/b0f8596887088b8ab65fc1015c773f45b47234ae";
flake = false;
};
lsp-test = {
Expand Down Expand Up @@ -100,7 +103,7 @@
poetry2nix.url = "github:nix-community/poetry2nix/master";
};
outputs =
inputs@{ self, nixpkgs, flake-compat, flake-utils, gitignore, ... }:
inputs@{ self, nixpkgs, flake-compat, flake-utils, gitignore, all-cabal-hashes-unpacked, ... }:
{
overlays.default = final: prev:
with prev;
Expand Down Expand Up @@ -156,8 +159,8 @@
# GHCIDE requires hie-bios ^>=0.9.1
hie-bios = hself.callCabal2nix "hie-bios" inputs.hie-bios {};

lsp = hsuper.callCabal2nix "lsp" inputs.lsp {};
lsp-types = hsuper.callCabal2nix "lsp-types" inputs.lsp-types {};
lsp = hsuper.callCabal2nix "lsp" "${inputs.lsp}/lsp" {};
lsp-types = hsuper.callCabal2nix "lsp-types" "${inputs.lsp}/lsp-types" {};
lsp-test = hsuper.callCabal2nix "lsp-test" inputs.lsp-test {};

implicit-hie-cradle = hself.callCabal2nix "implicit-hie-cradle" inputs.implicit-hie-cradle {};
Expand Down Expand Up @@ -186,6 +189,14 @@
in {
inherit hlsSources;

all-cabal-hashes = prev.runCommand "all-cabal-hashes.tar.gz"
{ }
''
cd ${all-cabal-hashes-unpacked}
cd ..
tar czf $out $(basename ${all-cabal-hashes-unpacked})
'';

# Haskell packages extended with our packages
hlsHpkgs = compiler: extended haskell.packages.${compiler};

Expand Down Expand Up @@ -216,7 +227,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; };
ghc942Config = (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 @@ -226,13 +237,13 @@
cases = {
ghc902 = ghc902Config.tweakHpkgs (pkgs.hlsHpkgs "ghc902");
ghc924 = ghc924Config.tweakHpkgs (pkgs.hlsHpkgs "ghc924");
ghc941 = ghc941Config.tweakHpkgs (pkgs.hlsHpkgs "ghc941");
ghc942 = ghc942Config.tweakHpkgs (pkgs.hlsHpkgs "ghc942");
};
in { default = cases."${ghcVersion}"; } // cases;

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

# For markdown support
Expand Down Expand Up @@ -282,16 +293,16 @@
hpkgs.ghc
pkgs.cabal-install
# @guibou: I'm not sure hie-bios is needed
ghcDefault.hie-bios
pkgs.haskellPackages.hie-bios
# Dependencies needed to build some parts of hackage
gmp zlib ncurses
# Changelog tooling
(gen-hls-changelogs ghcDefault)
(gen-hls-changelogs pkgs.haskellPackages)
# For the documentation
pythonWithPackages
# @guibou: I'm not sure this is needed.
hlint
ghcDefault.opentelemetry-extra
pkgs.haskellPackages.opentelemetry-extra
capstone tracy
# ormolu
# stylish-haskell
Expand Down Expand Up @@ -345,7 +356,7 @@
src = null;
};
# Create a hls executable
# Copied from https://github.com/NixOS/nixpkgs/blob/210784b7c8f3d926b7db73bdad085f4dc5d79418/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix#L16
# Copied from https://github.com/NixOS/nixpkgs/blob/210784b7c8f3d926b7db73bdad085f4dc5d79428/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix#L16
mkExe = hpkgs:
with pkgs.haskell.lib;
(enableSharedExecutables (overrideCabal hpkgs.haskell-language-server
Expand All @@ -365,22 +376,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";
haskell-language-server-942-dev = mkDevShell ghc942 "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";
haskell-language-server-942-dev-nix = mkDevShellWithNixDeps ghc942 "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;
haskell-language-server-942 = mkExe ghc942;
};

devShells = simpleDevShells // nixDevShells // {
Expand Down