Home Explore Blog CI



nixpkgs

4th chunk of `doc/languages-frameworks/haskell.section.md`
f3b6227e4b3d84532009063c80bb721e087085352a59dd9d0000000100000fd9
completely incompatible with packages from `haskellPackages`.

<!-- TODO(@maralorn) Link to package set generation docs in the contributors guide below. -->

### GHC Deprecation Policy {#ghc-deprecation-policy}

We remove GHC versions according to the following policy:

#### Major GHC versions {#major-ghc-deprecation}

We keep the following GHC major versions:
1. The current Stackage LTS as the default and all later major versions.
2. The two latest major versions older than our default.
3. The currently recommended GHCup version and all later major versions.

Older GHC versions might be kept longer, if there are in-tree consumers. We will coordinate with the maintainers of those dependencies to find a way forward.

#### Minor GHC versions {#minor-ghc-deprecation}

Every major version has a default minor version. The default minor version will be updated as soon as viable without breakage.

Older minor versions for a supported major version will only be kept, if they are the last supported version of a major Stackage LTS release.

<!-- Policy introduced here: https://discourse.nixos.org/t/nixpkgs-ghc-deprecation-policy-user-feedback-necessary/64153 -->

## `haskellPackages.mkDerivation` {#haskell-mkderivation}

Every haskell package set has its own haskell-aware `mkDerivation` which is used
to build its packages. Generally you won't have to interact with this builder
since [cabal2nix](#haskell-cabal2nix) can generate packages
using it for an arbitrary cabal package definition. Still it is useful to know
the parameters it takes when you need to
[override](#haskell-overriding-haskell-packages) a generated Nix expression.

`haskellPackages.mkDerivation` is a wrapper around `stdenv.mkDerivation` which
re-defines the default phases to be haskell aware and handles dependency
specification, test suites, benchmarks etc. by compiling and invoking the
package's `Setup.hs`. It does *not* use or invoke the `cabal-install` binary,
but uses the underlying `Cabal` library instead.

### General arguments {#haskell-derivation-args}

`pname`
: Package name, assumed to be the same as on Hackage (if applicable)

`version`
: Packaged version, assumed to be the same as on Hackage (if applicable)

`src`
: Source of the package. If omitted, fetch package corresponding to `pname`
and `version` from Hackage.

`sha256`
: Hash to use for the default case of `src`.

`sourceRoot`, `setSourceRoot`
: Passed to `stdenv.mkDerivation`; see [“Variables controlling the unpack
phase”](#variables-controlling-the-unpack-phase).

`revision`
: Revision number of the updated cabal file to fetch from Hackage.
If `null` (which is the default value), the one included in `src` is used.

`editedCabalFile`
: `sha256` hash of the cabal file identified by `revision` or `null`.

`configureFlags`
: Extra flags passed when executing the `configure` command of `Setup.hs`.

`buildFlags`
: Extra flags passed when executing the `build` command of `Setup.hs`.

`haddockFlags`
: Extra flags passed to `Setup.hs haddock` when building the documentation.

`doCheck`
: Whether to execute the package's test suite if it has one. Defaults to `true` unless cross-compiling.

`doBenchmark`
: Whether to execute the package's benchmark if it has one. Defaults to `false`.

`doHoogle`
: Whether to generate an index file for [hoogle][hoogle] as part of
`haddockPhase` by passing the [`--hoogle` option][haddock-hoogle-option].
Defaults to `true`.

`doHaddockQuickjump`
: Whether to generate an index for interactive navigation of the HTML documentation.
Defaults to `true` if supported.

`doInstallIntermediates`
: Whether to install intermediate build products (files written to `dist/build`
by GHC during the build process). With `enableSeparateIntermediatesOutput`,
these files are instead installed to [a separate `intermediates`
output.][multiple-outputs] The output can then be passed into a future build of
the same package with the `previousIntermediates` argument to support
incremental builds. See [“Incremental builds”](#haskell-incremental-builds) for

Title: GHC Deprecation Policy and `haskellPackages.mkDerivation`
Summary
The document outlines the GHC deprecation policy, detailing which major and minor GHC versions are maintained. It also describes `haskellPackages.mkDerivation`, the Haskell-aware derivation function used to build packages, which is a wrapper around `stdenv.mkDerivation` and handles dependency specification and test suites. It also provides a list of general arguments the function takes.