From ff9e4bce32b35ab6fc61e8ad64e5b91c0624c5b4 Mon Sep 17 00:00:00 2001 From: Thomas Miedema Date: Mon, 17 Mar 2025 08:16:53 +0100 Subject: [PATCH 1/2] haskell: fix shellFor test In #296645, envFunc (and thus shellFor) was changed from `mkDerivation {phases=[..]}` to `runCommand ..`. So since then, the derivation of shellFor contains a `buildCommand` ("echo $nativeBuildInputs $buildInputs > $out"), and as a result the custom phases defined in shellFor's test were ignored. --- pkgs/test/haskell/shellFor/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/test/haskell/shellFor/default.nix b/pkgs/test/haskell/shellFor/default.nix index 3e0f3ed74934..87671f4bc798 100644 --- a/pkgs/test/haskell/shellFor/default.nix +++ b/pkgs/test/haskell/shellFor/default.nix @@ -68,4 +68,8 @@ maintainers = allMaintainers; inherit (cabal-install.meta) platforms; }; + # `shellFor` adds a `buildCommand` (via `envFunc -> runCommandCC`), which + # overrides custom phases. To ensure this test's phases run, we remove + # that `buildCommand` from the derivation. + buildCommand = null; }) From 5386852b574767e215bae38984fa1bfef7d68a0e Mon Sep 17 00:00:00 2001 From: Thomas Miedema Date: Mon, 17 Mar 2025 10:24:55 +0100 Subject: [PATCH 2/2] haskell: document shellFor extraDependencies --- doc/languages-frameworks/haskell.section.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/languages-frameworks/haskell.section.md b/doc/languages-frameworks/haskell.section.md index d9bbca300286..35682ff7cd7b 100644 --- a/doc/languages-frameworks/haskell.section.md +++ b/doc/languages-frameworks/haskell.section.md @@ -619,6 +619,12 @@ environment. This means you can reuse Nix expressions of packages included in nixpkgs, but also use local Nix expressions like this: `hpkgs: [ (hpkgs.callPackage ./my-project.nix { }) ]`. +`extraDependencies` +: Extra dependencies, in the form of cabal2nix build attributes. An example use +case is when you have Haskell scripts that use libraries that don't occur in +your packages' dependencies. Example: `hpkgs: {libraryHaskellDepends = +[ hpkgs.releaser ]}`. Defaults to `hpkgs: { }`. + `nativeBuildInputs` : Expects a list of derivations to add as build tools to the build environment. This is the place to add packages like `cabal-install`, `doctest` or `hlint`.