@@ -0,0 +1,102 @@
1+# This overlay helps accessing common executable components.
2+# Typically we want to make these available in a nix-shell
3+# created with shellFor. In most cases the package name
4+# will be the same as the executable, but we have a
5+# `toolPackageName` mapping to help when it is not.
7+# To get a single tool:
8+# haskell-nix.tool "cabal" "3.2.0.0"
10+# This does the same thing as:
11+# (haskell-nix.hackage-package {
12+# name = "cabal-install"
14+# }).components.exes.cabal
16+# To get an attr set containing multiple tools:
17+# haskell-nix.tools { cabal = "3.2.0.0"; hlint = "2.2.11"; }
19+# To add tools to a shell:
20+# shellFor { tools = { cabal = "3.2.0.0"; hlint = "2.2.11"; }; }
22+# When used in shellFor the tools will be compiled with the same version
23+# of ghc used in the shell (the build ghc in the case of cross compilation).
25+# Instead of a version string we can use an attr set containing
26+# arguments that will be passed to `cabalProject`.
28+# For instance to specify the ghc used to compile. Use:
29+# haskell-nix.tool "cabal" {
30+# version = "3.2.0.0";
31+# ghc = haskell-nix.compiler.ghc883;
38+in { haskell-nix = super.haskell-nix // {
40+ # Some times the package name in hackage is not the same as tool name.
42+ cabal = "cabal-install";
45+ hackage-tool = { name, ... }@args:
46+ (self.haskell-nix.hackage-package
47+ (args // { name = self.haskell-nix.toolPackageName."${name}" or name; }))
48+ .components.exes."${name}";
50+ tool = name: versionOrArgs:
52+ args = self.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs;
54+ (if self.haskell-nix.custom-tools ? "${name}"
55+ && self.haskell-nix.custom-tools."${name}" ? "${args.version}"
56+ then self.haskell-nix.custom-tools."${name}"."${args.version}"
57+ else self.haskell-nix.hackage-tool) (args // { inherit name; });
59+ tools = lib.mapAttrs self.haskell-nix.tool;
61+ # Like `tools` but allows default ghc to be specified
62+ toolsForGhc = ghc: toolSet:
63+ self.haskell-nix.tools (
64+ lib.mapAttrs (name: versionOrArgs:
65+ # Add default ghc if not specified in the args
67+ // self.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs
71+ # Tools not in hackage yet
73+ ghcide.object-code = args:
74+ (self.haskell-nix.cabalProject (args // {
76+ src = self.fetchFromGitHub {
77+ owner = "mpickering";
79+ rev = "706c59c97c25c66798815c1dc3ee6885a298918a";
80+ sha256 = "0d158xifwvz0y69ah98ckxakzqpz229mq7rpf2bpbmwhnpw3jmm6";
82+ modules = [({config, ...}: {
83+ packages.ghcide.configureFlags = [ "--enable-executable-dynamic" ];
84+ nonReinstallablePkgs = [ "Cabal" "array" "base" "binary" "bytestring" "containers" "deepseq"
85+ "directory" "filepath" "ghc" "ghc-boot" "ghc-boot-th" "ghc-compact"
86+ "ghc-heap" "ghc-prim" "ghci" "haskeline" "hpc" "integer-gmp"
87+ "libiserv" "mtl" "parsec" "pretty" "process" "rts" "stm"
88+ "template-haskell" "terminfo" "text" "time" "transformers" "unix"
95+ "alex" = (((hackage.alex)."3.2.5").revisions).default;
96+ "happy" = (((hackage.happy)."1.19.12").revisions).default;
100+ })).ghcide.components.exes.ghcide;