Skip to content

Flake ghc 92 #2621

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 4 commits into from
Jan 24, 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
42 changes: 42 additions & 0 deletions configuration-ghc-921.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# nix version of cabal-ghc901.project
{ pkgs, hackage }:

let
disabledPlugins = [
"hls-brittany-plugin"
"hls-stylish-haskell-plugin"
];

hpkgsOverride = hself: hsuper:
with pkgs.haskell.lib;
{
fourmolu = hself.callCabal2nix "fourmolu" hackage.fourmolu {};
primitive-extras = hself.primitive-extras_0_10_1_2;
ghc-exactprint = hself.callCabal2nix "ghc-exactprint" hackage.ghc-exactprint {};
constraints-extras = hself.callCabal2nix "constraints-extras" hackage.constraints-extras {};
retrie = hself.callCabal2nix "retrie" hackage.retrie {};
hlint = doJailbreak (hself.callCabal2nix "hlint" hackage.hlint {});

# Re-generate HLS drv excluding some plugins
haskell-language-server =
hself.callCabal2nixWithOptions "haskell-language-server" ./.
(pkgs.lib.concatStringsSep " " [
"-f-brittany"
"-f-stylishhaskell"
"-f-hlint"
"-f-haddockComments"
"-f-alternateNumberFormat"
"-f-eval"
]) { };

# YOLO
mkDerivation = args:
hsuper.mkDerivation (args // {
jailbreak = true;
doCheck = false;
});
};
in {
inherit disabledPlugins;
tweakHpkgs = hpkgs: hpkgs.extend hpkgsOverride;
}
91 changes: 85 additions & 6 deletions flake.lock

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

30 changes: 14 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,16 @@
flake = false;
};

lsp-source = {
url = "https://hackage.haskell.org/package/lsp-1.4.0.0/lsp-1.4.0.0.tar.gz";
flake = false;
};
lsp-types-source = {
url = "https://hackage.haskell.org/package/lsp-types-1.4.0.0/lsp-types-1.4.0.0.tar.gz";
flake = false;
};
lsp-test-source = {
url = "https://hackage.haskell.org/package/lsp-test-0.14.0.2/lsp-test-0.14.0.2.tar.gz";
flake = false;
};
hackage-sources.url = "path:./flake_hackage";
};
outputs =
{ self, nixpkgs, flake-compat, flake-utils, pre-commit-hooks, gitignore, lsp-source, lsp-types-source, lsp-test-source }:
{ self, nixpkgs, flake-compat, flake-utils, pre-commit-hooks, gitignore, hackage-sources }:
{
overlay = final: prev:
with prev;
let
hackage = hackage-sources.inputs;

haskellOverrides = hself: hsuper: {
# we override mkDerivation here to apply the following
# tweak to each haskell package:
Expand Down Expand Up @@ -88,9 +79,9 @@
# We need an older version
hiedb = hself.hiedb_0_4_1_0;

lsp = hsuper.callCabal2nix "lsp" lsp-source {};
lsp-types = hsuper.callCabal2nix "lsp-types" lsp-types-source {};
lsp-test = hsuper.callCabal2nix "lsp-test" lsp-test-source {};
lsp = hsuper.callCabal2nix "lsp" hackage.lsp {};
lsp-types = hsuper.callCabal2nix "lsp-types" hackage.lsp-types {};
lsp-test = hsuper.callCabal2nix "lsp-test" hackage.lsp-test {};

implicit-hie-cradle = hself.callCabal2nix "implicit-hie-cradle"
(builtins.fetchTarball {
Expand Down Expand Up @@ -144,6 +135,7 @@
} // (flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ])
(system:
let
hackage = hackage-sources.inputs;
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
Expand Down Expand Up @@ -182,6 +174,7 @@
};

ghc901Config = (import ./configuration-ghc-901.nix) { inherit pkgs; };
ghc921Config = (import ./configuration-ghc-921.nix) { inherit pkgs hackage; };

# GHC versions
ghcDefault = pkgs.hlsHpkgs ("ghc"
Expand All @@ -190,6 +183,7 @@
ghc884 = pkgs.hlsHpkgs "ghc884";
ghc8107 = pkgs.hlsHpkgs "ghc8107";
ghc901 = ghc901Config.tweakHpkgs (pkgs.hlsHpkgs "ghc901");
ghc921 = ghc921Config.tweakHpkgs (pkgs.hlsHpkgs "ghc921");

# For markdown support
myst-parser = pkgs.python3Packages.callPackage ./myst-parser.nix {};
Expand Down Expand Up @@ -224,6 +218,8 @@
map (name: p.${name}) (attrNames
(if hpkgs.ghc.version == "9.0.1" then
removeAttrs hlsSources ghc901Config.disabledPlugins
else if hpkgs.ghc.version == "9.2.1" then
removeAttrs hlsSources ghc921Config.disabledPlugins
else
hlsSources));
buildInputs = [ gmp zlib ncurses capstone tracy (gen-hls-changelogs hpkgs) pythonWithPackages ]
Expand Down Expand Up @@ -266,12 +262,14 @@
haskell-language-server-884-dev = mkDevShell ghc884;
haskell-language-server-8107-dev = mkDevShell ghc8107;
haskell-language-server-901-dev = mkDevShell ghc901;
haskell-language-server-921-dev = mkDevShell ghc921;

# hls package
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;

# docs
docs = docs;
Expand Down
44 changes: 44 additions & 0 deletions flake_hackage/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
description = "Sources from hackage";

inputs = {
lsp = {
url = "https://hackage.haskell.org/package/lsp-1.4.0.0/lsp-1.4.0.0.tar.gz";
flake = false;
};
lsp-types = {
url = "https://hackage.haskell.org/package/lsp-types-1.4.0.0/lsp-types-1.4.0.0.tar.gz";
flake = false;
};
lsp-test = {
url = "https://hackage.haskell.org/package/lsp-test-0.14.0.2/lsp-test-0.14.0.2.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;
};

constraints-extras = {
url = "https://hackage.haskell.org/package/constraints-extras-0.3.2.1/constraints-extras-0.3.2.1.tar.gz";
flake = false;
};

retrie = {
url = "https://hackage.haskell.org/package/retrie-1.2.0.1/retrie-1.2.0.1.tar.gz";
flake = false;
};

fourmolu = {
url = "https://hackage.haskell.org/package/fourmolu-0.5.0.1/fourmolu-0.5.0.1.tar.gz";
flake = false;
};

hlint = {
url = "https://hackage.haskell.org/package/hlint-3.3.6/hlint-3.3.6.tar.gz";
flake = false;
};
};

outputs = {self, ...}: {};
}