Skip to content

Add tool documentation #1917

Open
Open
@hamishmack

Description

@hamishmack

The tool and tools features (haskell-nix.tool(s), the shellFor.tools argument and shell.tools) are not well covered by the documentation. However there is a comment in the code. We should update the documentation to cover this and also discuss alternatives (using haskell-nix.hackage-package, haskell-nix.hackage-project and haskell-nix.cabalPackage directly).

# This overlay helps accessing common executable components.
# Typically we want to make these available in a nix-shell
# created with shellFor. In most cases the package name
# will be the same as the executable, but we have a
# `toolPackageName` and `packageToolName` mapping to help
# when it is not.
#
# To get a single tool:
# haskell-nix.tool "ghc884" "cabal" "3.2.0.0"
#
# This does the same thing as:
# (haskell-nix.hackage-package {
# compiler-nix-name = "ghc884";
# name = "cabal-install"
# version = "3.2.0.0"
# }).components.exes.cabal
#
# To get an attr set containing multiple tools:
# haskell-nix.tools "ghc884" { cabal = "3.2.0.0"; hlint = "2.2.11"; }
#
# To add tools to a shell:
# shellFor { tools = { cabal = "3.2.0.0"; hlint = "2.2.11"; }; }
#
# When used in shellFor the tools will be compiled with the same version
# of ghc used in the shell (the build ghc in the case of cross compilation).
#
# To get tools for use with project `p` without using shellFor:
# p.tool "cabal" "3.2.0.0"
# p.tools { cabal = "3.2.0.0"; hlint = "2.2.11"; }
# (the ghc version used to build it will match the one used in the project)
#
# Instead of a version string we can use an attr set containing
# arguments that will be passed to `cabalProject`.
#
# For instance to add haskell.nix modules. Use:
# haskell-nix.tool "ghc884" "cabal" {
# version = "3.2.0.0";
# modules = [ ... ];
# }
.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions