-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from telostat/vst/update-haskell-toolchain
Update Haskell Toolchain
- Loading branch information
Showing
5 changed files
with
83 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
{ ... }: | ||
|
||
let | ||
nix = (import ./nix); | ||
sources = import ./nix/sources.nix; | ||
in | ||
{ | ||
pkgs = { | ||
stable = nix.pkgs; | ||
unstable = nix.pkgs-unstable; | ||
## Pinned Nix package sources. | ||
## | ||
## These can be used in various projects to benefit from Nix caching. | ||
pkgs-sources = { | ||
stable = sources.nixpkgs; | ||
unstable = sources.nixpkgs-unstable; | ||
}; | ||
|
||
## Categorized tools. | ||
tools = { | ||
haskell = import ./tools/haskell.nix { }; | ||
haskell = import ./tools/haskell.nix; | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,67 @@ | ||
{ compiler ? "ghc902" | ||
, ... | ||
}: | ||
|
||
let | ||
## Pinned nixpkgs: | ||
pkgs = (import ../nix).pkgs-unstable; | ||
|
||
## Get the haskell set with overrides: | ||
haskell = pkgs.haskell.packages.${compiler}.override { | ||
overrides = self: super: with pkgs.haskell.lib; { | ||
fourmolu = super.fourmolu_0_8_2_0; | ||
Cabal = super.Cabal_3_6_3_0; | ||
ghc-lib-parser = super.ghc-lib-parser_9_2_4_20220729; | ||
## Nix packages override configuration for Haskell development | ||
## tools. | ||
## | ||
## Usage: | ||
## | ||
## devpkgs = import <nixpkgs-unstable> { inherit config-dev-hs; }; | ||
## devpkgs = import telosnix.pkgs-sources.unstable { inherit config-dev-hs; }; | ||
## | ||
## Note that this is NOT for the package being developed. It can | ||
## have its own Nix packages source and configuration. This is | ||
## rather for the Haskell tools such as language server, linters, | ||
## formatters etc... | ||
## | ||
## The motivation is to: | ||
## | ||
## 1. Use latest Haskell development tools. | ||
## 2. Benefit from Nix binary caches. | ||
## | ||
## For the latter, you should be using the same underlying package | ||
## sources and GHC. | ||
config-dev-hs = { | ||
packageOverrides = pkgs: rec { | ||
haskellPackages = pkgs.haskellPackages.override { | ||
overrides = new: old: rec { | ||
apply-refact = old.apply-refact_0_10_0_0; | ||
Cabal = old.Cabal_3_6_3_0; | ||
fourmolu = old.fourmolu_0_8_2_0; | ||
ghc-lib-parser = old.ghc-lib-parser_9_2_4_20220729; | ||
hlint = old.hlint_3_5; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
## Imports and returns a given Nix packages source with our custom | ||
## Nix packages override configuration for Haskell development | ||
## tools. | ||
get-haskell-development-packages = source: | ||
import source { inherit config-dev-hs; }; | ||
|
||
## Imports and returns a compiler specific Haskell packages set with | ||
## our custom Nix packages override configuration for Haskell | ||
## development tools. | ||
get-haskell-development-compiler = source: compiler: | ||
(get-haskell-development-packages source).haskell.packages.${compiler}; | ||
|
||
## Returns common Haskell development tools for the given Nix | ||
## packages source with our custom Nix packages override | ||
## configuration for Haskell development tools. | ||
get-haskell-development-tools = source: compiler: | ||
let | ||
haskell = get-haskell-development-compiler source compiler; | ||
in | ||
[ | ||
haskell.apply-refact | ||
haskell.fourmolu | ||
haskell.haskell-language-server | ||
haskell.hlint | ||
]; | ||
in | ||
{ | ||
haskell = haskell; | ||
|
||
packages = { | ||
fourmolu = haskell.fourmolu; | ||
}; | ||
config-dev-hs = config-dev-hs; | ||
get-haskell-development-packages = get-haskell-development-packages; | ||
get-haskell-development-compiler = get-haskell-development-compiler; | ||
get-haskell-development-tools = get-haskell-development-tools; | ||
} |