haskell-flake

haskell-flake scans your flake files for Haskell projects and turns them into packages using the Nixpkgs Haskell infrastructure.

It also provides checks and devShells

Multiple projects can be declared to represent each package set, which is great for GHCJS frontends.

Installation

To use these options, add to your flake inputs:

haskell-flake.url = "github:srid/haskell-flake";

and inside the mkFlake:

imports = [
  inputs.haskell-flake.flakeModule
];

Run nix flake lock and you're set.

Options

perSystem.haskellProjects

perSystem.haskellProjects.<name>.packages

perSystem.haskellProjects.<name>.packages.<name>.root

perSystem.haskellProjects.<name>.buildTools

perSystem.haskellProjects.<name>.haskellPackages

perSystem.haskellProjects.<name>.hlintCheck

perSystem.haskellProjects.<name>.hlintCheck.enable

perSystem.haskellProjects.<name>.hlintCheck.dirs

perSystem.haskellProjects.<name>.hlsCheck

perSystem.haskellProjects.<name>.hlsCheck.enable

perSystem.haskellProjects.<name>.overrides

perSystem.haskellProjects.<name>.source-overrides

perSystem.haskellProjects

Haskell projects

Type: attribute set of (submodule)

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.packages

Attrset of local packages in the project repository.

Autodetected by default by looking for .cabal files in sub-directories.

Type: lazy attribute set of (submodule)

Default: autodiscovered by reading self files.

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.packages.<name>.root

Path to Haskell package where the .cabal file lives

Type: path

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.buildTools

Build tools for your Haskell package (available only in nix shell).

Type: function that evaluates to a(n) attribute set of (null or package)

Default: "Build tools useful for Haskell development are included by default."

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.haskellPackages

Which Haskell package set / compiler to use.

You can effectively select the GHC version here.

To get the appropriate value, run:

nix-env -f "<nixpkgs>" -qaP -A haskell.compiler

And then, use that in pkgs.haskell.packages.ghc<version>

Type: attribute set of raw value

Default: pkgs.haskellPackages

Example: "pkgs.haskell.packages.ghc924"

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.hlintCheck

A check that runs hlint.

Type: submodule

Default: { }

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.hlintCheck.enable

Whether to add a flake check to run hlint

Type: boolean

Default: false

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.hlintCheck.dirs

Relative path strings from root to directories that should be checked with hlint

Type: list of string

Default:

[
  "."
]

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.hlsCheck

A check to make sure that your IDE will work.

Type: submodule

Default: { }

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.hlsCheck.enable

Whether to enable a flake check to verify that HLS works.

This is equivalent to nix develop -i -c haskell-language-server.

Note that, HLS will try to access the network through Cabal (see https://github.com/haskell/haskell-language-server/issues/3128), therefore sandboxing must be disabled when evaluating this check.

Type: boolean

Default: false

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.overrides

Overrides for the Cabal project

For handy functions, see https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib/compose.nix

Type: function that evaluates to a(n) function that evaluates to a(n) lazy attribute set of raw value

Default: self: super: { }

Declared by:

haskell-flake/flake-module.nix

perSystem.haskellProjects.<name>.source-overrides

Package overrides given new source path

Type: attribute set of path

Default: { }

Declared by:

haskell-flake/flake-module.nix