mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-20 19:37:44 +03:00
5c25ce919f
* Delays cabal configure errors until after evaluation when possible. * Avoids rerunning long `cabal configure` if we already know it will fail. * Provides a way to get a component from a package or project using a `cabal` like reference. Code using the `tool` functions will automatically use `getComponent`. For `(hackage-package {...}).components.library` is also ok. ``` # Consider changing hackage-package use: (pkgs.haskell-nix.hackage-package {...}).components.exes.something (pkgs.haskell-nix.hackage-package {...}).getComponent "exe:something" # For any cabal project: project.hsPkgs.somepackage.components.exes.something project.getComponent "somepackage:exe:something" # or do it in two steps (project.getPackage "somepackage").getComponent "exe:something" ``` The reason for the new function is that we cannot provide the attribute interface without knowing that packages are in the project first. Here is how the `cabal configure` error output is handled: * The `plan-nix` derivation builds even if `cabal configure` fails. * When it fails, it copies `failed-cabal-configure.nix` to the `$out/default.nix` along with a copy of the `cabal configure` output. * When `failed-cabal-configure.nix` is imported and used in any way it writes the `cabal configure` output with `__trace` so it will always be visible. * Instead of a `plan` the imported nix contains a `configurationError` pointing the `cabal configure` output. * The intermediate functions `configurationError` and bubble it up to where it is needed. * `getPackage` returns a mostly empty proxy for a real package when there is a `configurationError` * The `getComponent` function always returns a derivation, but the version in the proxy writes the `cabal configure` output to stdout and calls `exit 1` (so that it will never build). |
||
---|---|---|
.. | ||
spdx | ||
cabal-licenses.nix | ||
cabal-os-arch-comp.nix | ||
cabal-project-parser.nix | ||
call-cabal-project-to-nix.nix | ||
call-stack-to-nix.nix | ||
check.nix | ||
clean-cabal-component.nix | ||
clean-git.nix | ||
clean-source-haskell.nix | ||
clean-source-with.nix | ||
compat.nix | ||
cover-project.nix | ||
cover.nix | ||
default.nix | ||
failed-cabal-configure.nix | ||
fetch-external.nix | ||
fetch-resolver.nix | ||
ghcjs-project.nix | ||
hackageIndex.nix | ||
host-map.nix | ||
import-and-filter-project.nix | ||
make-source-pins.nix | ||
materialize.nix | ||
override-with.nix | ||
pkgconf-nixpkgs-map.nix | ||
stack-cache-generator.nix | ||
system-nixpkgs-map.nix | ||
system-pkgs.nix |