haskellPackages.mkDerivation: Add env argument

Previously, setting environment variables in a Haskell package build
required using `.overrideAttrs`, which (I think?) breaks later
invocations of `haskell.lib.overrideCabal`.

This patch adds an `env` argument to `haskellPackages.mkDerivation`,
which can be used to set environment variables during Haskell package
builds.
This commit is contained in:
Rebecca Turner
2025-07-11 10:46:58 -07:00
parent dbd8150065
commit d3e4f784aa
4 changed files with 112 additions and 20 deletions

View File

@@ -223,6 +223,10 @@ 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`.
`env`
: Extra environment variables to set during the build.
These will also be set inside the [development environment defined by the `passthru.env` attribute in the returned derivation](#haskell-development-environments), but will not be set inside a development environment built with [`shellFor`](#haskell-shellFor) that includes this package.
`configureFlags`
: Extra flags passed when executing the `configure` command of `Setup.hs`.