Commit Graph

84 Commits

Author SHA1 Message Date
Georges Dubus
2645e1a1eb cabal2nix: split into a lightweight version and a wrapper
Current, the `cabal2nix` derivation contains both the executable, and a wrapper
that adds `nix` and `nix-prefetch-scripts`, which are required for some
features.

However, when calling `callCabal2nix` to create a derivation from a cabal file
at evaluation time,
these features are not actually used, but the huge closure of
`nix-prefetch-scripts` (which includes multiple vcs, as well as python and perl)
still needs to be fetched.

This commit splits cabal2nix into a lightweight version that is a standalone
static binary (`cabal2nix-unwrapped`), and a wrapper that includes the proper
dependencies in the path for full usage of the command line
utility (`cabal2nix`).

This commit also switches to the default ghc, to reduce the likelyhood of
building a different ghc when calling `callCabal2nix`.
2020-03-13 20:18:14 +01:00
John Ericson
196682b175 Merge remote-tracking branch 'upstream/master' into work-on-multi-shellFor 2020-02-22 17:34:08 -05:00
John Ericson
1c07ee7925 haskell shellFor: Fix hoogle 2020-02-22 13:10:30 -05:00
Matthew Bauer
07db0b248c Merge remote-tracking branch 'obsidiansystems/work-on-multi-shellFor' 2020-01-17 18:00:27 -05:00
Jacquin Mininger
7d67db3919 shellFor: Refactor for consistency and cross
This makes it work like work-on-multi from Reflex Platform. In
particular, rather than making `.env` from `shellFor`, we make `.env`
the primitive, and `shellFor` works by combining together the arguments
of all the packages to `generic-builder` and taking the `.env` of the
resulting mashup-package.

There are 2 benefits of this:

1. The dependency logic is deduplicated. generic builder just concatted
   lists, whereas all the envs until now would sieve apart haskell and
   system build inputs. Now, they both decide haskell vs system the same
   way: according to the argument list and without reflection.
   Consistency is good, especially because it mean that if the build
   works, the shell is more likely to work.

2. Cross is handled better. For native builds, because the
   `ghcWithPackages` calls would shadow, we through both the regular
   component (lib, exe, test, bench) haskell deps and Setup.hs haskell
   deps in the same `ghcWithPackages` call. But for cross builds we use
   `buildPackages.ghcWithPackages` to get the setup deps. This ensures
   everything works correctly.
2020-01-17 10:46:29 -05:00
Jack Kelly
9f41d8a9d0 callHackageDirect: correct type signature 2019-11-20 16:36:33 +10:00
John Ericson
66a9f39817 haskellSrc2nix
Since [1], cabal2nix has been able to parse full platform triples. We
need this for when the system doesn't say enough info (e.g. android).

[1]: 0bb88f0009 (diff-d9172aeec4039eef8cfcc8a2ab6c0677R143)
2019-10-15 11:23:33 -04:00
John Ericson
d6f1e70560 haskell: Speed up cross callHackage by using native source
The extract of code from hackage is the same on all platforms.
2019-10-01 12:46:50 -04:00
volth
f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
Robin Gloster
6cf583cf2f
Merge pull request #60406 from JohnAZoidberg/remove-isnull
treewide: Remove usage of isNull
2019-05-18 09:36:24 +00:00
Bryan Richter
6a74ba96fd
Add minimal docs for callHackage and friends
Specifically haskellSrc2nix, callHackage, and callHackageDirect. Other
functions should probably also be documented, but it's at least a start.
2019-05-14 08:18:02 +03:00
Daniel Schaefer
786f02f7a4 treewide: Remove usage of isNull
isNull "is deprecated; just write e == null instead" says the Nix manual
2019-04-29 14:05:50 +02:00
Matthew Bauer
eaa5e85b35 haskell: add more hackage mirrors, use mirrors in more places
Fixes #58971
2019-04-05 13:51:56 -04:00
Silvan Mosberger
2075b3715b Revert "shellFor: Don't suck in src to compare to deps. [Fixes #51079]" 2019-02-15 12:18:44 +01:00
Will Fancher
24ccaf65df shellFor: Don't suck in src to compare to deps. [Fixes #51079] 2019-01-29 16:29:18 -05:00
Doug Beardsley
0cb5b013c0 Overrides can be passed to callHackageDirect 2019-01-27 12:28:01 -05:00
Doug Beardsley
83624524e2 Add a callHackage variant that doesn't require all-cabal-hashes 2018-12-25 12:19:24 -05:00
Guillaume Bouchard
62882d8cd2 haskellSrc2nix: disallow substitutes
Fix #49818. See the bug for more details.

The work done by haskellSrc2nix is usually lightweight, but needs to
be done each time a cabal file change. This triggers unexpected
network activity for a cache query which results most of the time on a
cache miss.

By disabling substitutes we:

- avoid the, mostly useless, binary cache query
- avoid unexpected network failure when users change a cabal file and
  try to rebuild without connectivity.
2018-11-22 16:24:13 +01:00
Doug Beardsley
c3c82aa675 Update developPackage documentation 2018-10-17 14:44:07 -04:00
Doug Beardsley
d36c55a530 Add name parameter to developPackage 2018-10-16 09:38:57 -04:00
Silvan Mosberger
5067773e39 haskellPackages.*.env: Use shellFor 2018-10-03 18:00:29 +02:00
Silvan Mosberger
56da05d459 haskellPackages.shellFor: Clean and fixup
- Now correctly sets NIX_GHC* env vars
2018-10-03 18:00:29 +02:00
John Ericson
9f768ff43c
Merge pull request #46795 from obsidiansystems/late-bind-buildHaskellPackages
haskell infra: "late bind" `buildHaskellPackages`
2018-09-17 16:20:56 -04:00
John Ericson
8da28de0e8 haskell infra: "late bind" buildHaskellPackages
This way it can be overridden.
2018-09-17 16:01:26 -04:00
Bas van Dijk
d05a8bb410
Merge pull request #44424 from dhess/callCaball2nixWithOption
haskell-modules: add callCabal2nixWithOptions.
2018-09-11 09:00:03 +02:00
Shea Levy
b00b2363b3
haskellPackages.shellFor: fix after recent getHaskellBuildInputs fix.
Fixes #45318
2018-08-19 15:17:35 -04:00
Bas van Dijk
e9b7e73120
Merge pull request #44356 from ElvishJerricco/callcabal2nix-passthru-deriver
callCabal2nix: Passthru deriver
2018-08-11 10:34:06 +02:00
Will Fancher
08b766921d callCabal2nix: Passthru deriver 2018-08-10 11:38:09 -04:00
Drew Hess
4abb8be7ab
haskell-modules: add callCabal2nixWithOptions.
Fixes #44377.
2018-08-03 12:55:29 -07:00
Will Dietz
da5383006d haskell-modules: only include glibc locales when using glibc
Fixes #43665.
Hopefully. :)
2018-07-17 08:44:17 -05:00
John Ericson
f27f491784 Haskell infra: Do callPackage splicing 2018-07-09 16:39:37 -04:00
John Ericson
f379be939c haskell infra: Use self.ghc rather than closing over initial value 2018-06-07 14:27:44 -04:00
John Ericson
ecabdfd12f
Merge pull request #41330 from obsidiansystems/haskellSrc2nix-overriding
haskell infra: Allow overriding `haskellSrc2nix`
2018-05-31 16:42:16 -04:00
John Ericson
58ce59dd96 haskell infra: Allow overriding haskellSrc2nix 2018-05-31 16:29:02 -04:00
Peter Simons
07a045922d
Merge pull request #40710 from ElvishJerricco/overrideCabal-getHaskellBuildInputs
Make getHaskellBuildInputs / shellFor work with overrideCabal (Fixes #40266)
2018-05-22 10:37:26 +02:00
John Wiegley
d33322d449
haskellPackages.developPackage: Add a defaulted provideDrv argument
The purpose of this argument is to allow you to get at the derivation (rather
than it's env) even when in the evaluation context of a nix-shell invocation.
2018-05-18 13:04:18 -07:00
Will Fancher
5523ec8f3c Make getHaskellBuildInputs / shellFor work with overrideCabal 2018-05-17 20:35:53 -04:00
Will Fancher
155dfe385e callHackage: Keep deriver, like callCabal2nix 2018-03-25 03:12:28 -04:00
Ken Micklas
f34e136a04 callCabal2nix: Use host platform rather than build platform for evaluation of Cabal files 2018-03-11 22:02:32 -04:00
Robert Hensing
a90294afe4 haskell.lib.haskellSrc2nix: add extraCabal2nixOptions 2018-03-09 14:52:34 +01:00
Will Fancher
9adb4d25e6 Haskell: Added haskellPackages.shellFor 2018-03-06 16:34:05 -05:00
Shea Levy
62a1abe204
haskellPackages.callCabal2nix: Depend on the expression.
This ensures that as long as the package derivation is alive, its nix
expressions do not need to be regenerated.

Fixes #36190.
2018-03-02 09:37:02 -05:00
Shea Levy
7f623cfa45
callCabal2nix: Fix filtering for non-cleanSourceable sources.
What was here before wasn't correct anyway, and now it works in
restricted mode.

Fixes #35207
2018-02-28 14:22:19 -05:00
Will Fancher
627444cfc2 Use static cabal2nix in callCabal2nix 2018-02-11 18:33:20 -05:00
Shea Levy
943592f698
Add setFunctionArgs lib function.
Among other things, this will allow *2nix tools to output plain data
while still being composable with the traditional
callPackage/.override interfaces.
2018-01-31 14:02:19 -05:00
pjan vandaele
bdffbc775e
Adds modifier option to developPackage 2018-01-30 12:29:59 +09:00
Ben Gamari
bf687907d7 haskell lib: Make Cabal compiler names explicit
Cabal2nix expects a --compiler flag that contains a Cabal Compiler description.
We used to use the compiler's derivation name for this, but this breaks when
cross-compiling due to the target suffix. Instead we add an explicit
haskellCompilerName attribute to Haskell compiler derivations.
2018-01-21 23:31:05 -05:00
John Ericson
81553124cf haskell infra: nativeGhc != ghc.bootPkgs.ghc
There's no reason to wait for non-binary native to *build* cross ghc,
but we want a nix-built GHC for Setup.hs or things won't work.
2018-01-21 23:31:04 -05:00
Will Fancher
9047a7dd33 Move packageSourceOverrides to haskellLib 2018-01-18 16:42:56 -05:00
Shea Levy
4e78aeb441
callCabal2nix: Fix calling with a path in the store. 2018-01-11 10:17:56 -05:00