Commit Graph

116 Commits

Author SHA1 Message Date
Felix Buehler
cdb39a86e0 treewide: use optionalString 2023-02-13 21:52:34 +01:00
github-actions[bot]
259fe227c8
Merge master into haskell-updates 2022-12-19 00:12:05 +00:00
figsoda
ec8cb34358 treewide: fix typos 2022-12-17 19:39:44 -05:00
Naïm Favier
264178657f
haskell.packages.ghc902.haskell-language-server: fix 2022-12-13 12:23:03 +01:00
Guillaume Bouchard
d1b6d2d0ab haskellPackages.callHackage: updating all-cabal-hashes do not invalidate callHackage
Packages built with `haskellPackages.callHackage` won't be rebuilt when
updating `all-cabal-hashes`.

The removed comment was keeping a reference to the `cabal2nix` call,
which itself depends on `all-cabal-hashes`, in order to keep this file
during a garbage collection.

The tradeoff is between:

- The current behavior: a mass rebuild, any change of `all-cabal-hashes`
  triggers a rebuild of all the packages built with `callHackage` and
  packages which depend on them. This can take hours, and may happen
  after a "small" unrelated change (i.e. an user is bumping
  `all-cabal-hashes` in order to use a new package from hackage). It
  also have global impacts in a project (long rebuild in CI, new entries
  in cache, developers need to fetch the new entries, ...). In this
  context, `cabal2nix` entries are not garbage collected.
- The new behavior: No mass rebuild, but `cabal2nix` derivations need to
  be recomputed after a garbage collection. This is usually fast (a few
  seconds by call), linear with the number of calls and should not
  happen a lot (i.e. users are not garbage collecting everyday).

See https://github.com/NixOS/nixpkgs/issues/194751 for details.
2022-11-26 19:00:56 +01:00
sternenseemann
ac1f1ad0e0 haskell: support cross in generateOptparseApplicativeCompletions
Deprecate haskell.lib{,.compose}.generateOptparseApplicativeCompletion*
in favor of the newly added
haskell.packages.*.generateOptparseApplicativeCompletions (plural!)
which takes into account whether we are cross-compiling or not. If we
are, generating completions is disabled, since we can't execute software
built for a different platform.

The move is necessary, so we can receive the /same/ stdenv as the
package we are overriding in order to accurately check whether we can
execute produced binaries.

Resolves #174040.
Resolves #49648.
2022-10-07 00:37:53 +02:00
github-actions[bot]
3aa744deb1
Merge master into haskell-updates 2022-08-26 00:15:32 +00:00
Alexander Vieth
f28ab51b54
haskell.lib.makePackageSet: all-cabal-hashes can be a directory (#188203)
* all-cabal-hahses can be a directory

Motivating problem: we want to use the flake.lock for all-cabal-hashes
as a github repository as our revision pin, and then import that to pass
as all-cabal-hashes. To do that we need it to accept a directory rather
than a tarball.

* all-cabal-hashes: add some comments
2022-08-24 20:57:52 -05:00
Robert Hensing
f89dd3dd4a haskellPackages.cabalSdist: Work around cabal#8413
See https://github.com/haskell/cabal/issues/8413
2022-08-22 12:12:09 +02:00
Martin Weinelt
d27e6f2d05
haskellPackages: Unalias RunCommandNoCCLocal 2022-06-29 21:26:45 +02:00
Robert Hensing
cf5e2d5103 haskellPackages: Add buildFromCabalSdist (faster, tested) 2022-05-23 22:28:57 +02:00
Robert Hensing
2e87d165f7 haskellPackages.shellFor: Add extraDependencies
An example use case is when you have Haskell scripts that use
libraries that don't occur in your packages' dependencies.
2022-03-15 20:38:22 +01:00
Robert Hensing
b4524d8eda haskellPackages.haskellSrc2nix: stdenvNoCC.mkDerivation -> runCommand
No need to fuss with phases.
2022-02-26 13:38:11 +01:00
Robert Hensing
46bb6a78db haskellPackages.callCabal2nix: Use stdenvNoCC
Delays C compiler realisation to the actual build, which is more
parallelizable; doesn't block the evaluator.
2022-02-26 13:28:12 +01:00
sternenseemann
fb075fab73 haskellPackages.{ghcWithPackages, ghcWithHoogle}: make overrideable
This is achieved by passing the entire package set to the respective
wrappers and passing the select function as a second attribute. Together
with the new support for callPackage-ing functions this allows for
things like `ghcWithPackages.override { useLLVM = true; } (p: [ … ])`.

To make this possible for `ghcWithHoogle` as well, we need to make the
wrapper a bit more bespoke and inline the hoogle feature as well. The
hoogle wrapper, however, can remain separate and is exposed as
`hoogleWithPackages` additionally, as it can also serve standalone use.
`hoogleLocal` is kept for backwards compatibility (including the old,
suboptimal API), but will inform users about the better alternative via
a warning.
2022-01-06 12:21:45 +01:00
sternenseemann
baaf9459d6 haskellPackages.callPackage: support returning functions
Overrideable functions are possible by wrapping them as functors in an
attribute set first and appending the overrideScope and override
attributes later.
2022-01-06 12:21:45 +01:00
Ellie Hermaszewska
2413ab9e72
haskellPackages.developPackage: Use haskell.lib.compose correctly 2021-11-08 18:34:00 +08:00
Ellie Hermaszewska
15ae25f36c
haskell: switch from haskell.lib to haskell.lib.compose 2021-11-07 20:18:45 +08:00
sternenseemann
5d53087f9b haskellPackages.callCabal2nixWithOptions: don't guess cabal filename
cabal only allows one cabal file per directory and cabal2nix will find
the correct file easily. Thus we don't need to know ahead of time which
cabal file to select. One downside of this is of course that we may
include unnecessary files in subdirectories, which could possibly be
fixed by enforcing depth.
2021-10-27 18:17:10 +02:00
Viacheslav Lotsmanov
707671dae2
haskellPackages.shellFor: Fix typo in the comments
“hpkgs” → “haskellPkgs”
2021-07-12 11:35:09 +09:00
Joe Hermaszewski
a3830da1aa haskell: default name to "" when root isn't a path in developPackage
See https://github.com/NixOS/nixpkgs/issues/103062
2021-05-08 18:22:54 +08:00
Dennis Gosnell
987b80a824
Merge pull request #109059 from jkachmar/haskell-generic-builder-args-modifier
Adds Haskell generic builder argument modifier
2021-01-27 22:37:41 +09:00
Ben Siraphob
2f78ee7e81 pkgs/development: stdenv.lib -> lib 2021-01-24 00:16:29 +07:00
Peter Simons
c3792f6cdd Consistently use 'lib' instead of 'stdenv.lib' in the Haskell infrastructure.
Part of https://github.com/NixOS/nixpkgs/issues/108938.
2021-01-22 20:34:21 +01:00
Joe Kachmar
95d0e6c1b8 Adds Haskell generic args builder documentation 2021-01-14 11:41:31 -05:00
Joe Kachmar
335f1fb25f Adds Haskell generic builder argument modifier
This is a new argument to the Haskell builder's 'shellFor' which allows
the caller to adjust the 'genericBuilderArgs' after they are built.

One immediate application for this is that it allows users to disable
tests, enable benchmarks, etc. for _all_ packages in a given Haskell
package set.

This is often useful when so many of the derivations in the
package set have changed that most of the cache has been invalidated,
and there is no need for the user to run tests on their dependencies,
but they still want these dependencies available in their 'nix-shell'
environment for some package-under-development.
2021-01-11 18:00:21 -05:00
Joe Hermaszewski
49e9758ef3 haskell: Add cabal2nixOptions to developPackage
Also neaten documentation slightly
2020-11-13 21:37:57 +01:00
Joe Hermaszewski
a32c231007 haskell: add withHoogle option to developPackage 2020-11-13 21:37:57 +01:00
Joe Hermaszewski
07e697d22d haskell: improve documentation on ghcWithHoogle and developPackage 2020-11-13 21:37:57 +01:00
(cdep)illabout
d3fb9a25b3 haskellPackages.shellFor: add a doBenchmark argument for enabling benchmarks deps 2020-11-06 21:37:06 +01:00
Dennis Gosnell
d26890fd15 haskellPackages.shellFor: fix spelling and grammar mistakes
Co-authored-by: maralorn <malte.brandy@maralorn.de>
2020-11-06 21:37:05 +01:00
(cdep)illabout
17eee57642 haskellPackages.shellFor: improve documentation 2020-11-06 21:37:05 +01:00
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