228 Commits

Author SHA1 Message Date
Moritz Angermann f658d1a32e allow setupBuildFlags on components and packages 2023-03-15 10:55:41 +03:00
shum ad48f6664d Revert "Add THSupport to allow overriding of setupBuildFlags"
This reverts commit c2d7e349cc0d3615e0a89a414bd4db2473f067ca.
2023-03-15 10:37:15 +03:00
Moritz Angermann 56d04066d2 Add THSupport to allow overriding of setupBuildFlags
This is fairly nasty.  We rely on overriding  for TH support, but this then prevents us
from allowing to override  in final flake.nix or similar expressions for the final build
package/component/executable.  This even fails silently and TH just doesn't work.

This seems to be a larger topic around how we deal with TH, and module inheritance. We should not override
existing keys, but namespace them properly, and thus still allow overriding.
2023-03-15 10:36:02 +03:00
shum f3b7c19252 Update comp-builder.nix
Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
2023-03-15 10:34:26 +03:00
Moritz Angermann f6487e28c1 combine 2023-03-15 10:26:52 +03:00
Teo Camarasu 5240aebeac Use ld.gold in dev shells (#1868)
* compiler/ghc: Add useLdGold option
* comp-builder: Remove ld override
* Set CONF_LD_LINKER_OPTS_STAGE2 to ensure gold gets used
* Set LD even if not cross-compiling if we want gold
* set full path of ld.gold
* Don't use ld.gold on musl
* link to musl ld.gold bug
2023-03-07 11:41:02 +08:00
Drew Hess 1ff7093a2e Fix haskell.nix evaluation with recent nixpkgs (#1859)
* final.*Platform -> final.stdenv.*Platform.

* pkgsBuildBuild.system -> pkgsBuildBuild.stdenv.system.

* Remove unused `pkgconfig` argument in builder.

* pkgconfig -> pkg-config.
2023-02-24 12:18:05 +13:00
Andrea Bedini 7075077d46 Support revisions and more (#1775)
* Support revisions

Cabal files are now obtained from the index tarball (as cabal does)
directly. This allows us to always pick the cabal file revision that
cabal would pick, without having to understand or reference hackage.

* Update nix-tools materialised plan for new tooling

* Update materialized files

* Eval on x86_64-linux

* Turn off full materialization check

* Replace pkgs.writeText with passAsFile

Nix derivations are already able to pass a attribute to the builder as a
file. This means we don't need to use pkgs.writeText to turn the
cabalFile attribute into a file, saving one derivation.

* Bump closure size limit to 540

---------

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2023-02-09 12:55:40 +13:00
Hamish Mackenzie 710b2e983d Fix musl TH code using C++ & external interpreter (#1832)
* Fix musl TH code using C++ & external interpreter

This makes the gcc_s.so library available to iserv.

* Pass LD_LIBRARY_PATH as nix attr
2023-02-04 15:29:51 +08:00
Hamish Mackenzie 7573eb34f6 Fix ghc 9.4.3 TH support (#1814) 2023-01-24 11:12:44 +13:00
Hamish Mackenzie 6c992eacf6 Use hadrian to build ghc 9.4 (#1475)
Adds GHC 9.4 and uses hadrian to build it.

This also updates the way iserv-proxy and remote-iserv are built as they now have their own package and gitlab repo.

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
2022-12-08 15:01:05 +13:00
Hamish Mackenzie b90fbaa272 Add shell.allDeps as a fix for #1793 (#1794)
* Add `shell.allDeps` as a fix for #1793

#1769 added all the tool dependencies of the hsPkgs in a project to the shell.  This is great for cabal projects where the set of packages will be limited to those in the plan.  It allows these packages to be rebuilt by cabal.

For stack projects however this set is much larger (all of stackage), likely to include unwanted tools and tools that may be broken.

This change adds `shell.allDeps` and defaults it to `false` for stack projects.

Fixes #1793

* Added comments
2022-12-02 10:50:05 +13:00
Jean-Baptiste G cebbb6d232 shellFor: provide build tools for all packages when exactDeps = false. Fix #1753. (#1769)
* shellFor: provide build tools for all packages when exactDeps = false

 When not using `exactDeps` cabal may try to build arbitrary dependencies
 so in this case we need to provide the build tools for all of hsPkgs.

* comp-builder: exclude hsc2hs from build-tools as it is never used,

 since it is provided by ghc env, which is first in PATH.
 This avoid possible collisions when using eg. devshells, which
 fuse all binaries into a single output directory.
2022-11-08 15:24:01 +13:00
Hamish Mackenzie 69a42f8620 Workaround for Hydra cp corruption (#1766)
See https://github.com/input-output-hk/ouroboros-network/pull/4007
2022-11-02 18:18:33 +13:00
Hamish Mackenzie 582e9ee5db Fix datadir for tests and benchmarks (#1765)
* Fix datadir for tests and benchmarks

Broken by #1732

* Update builder/comp-builder.nix

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>

* Keep stderr on stderr

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
2022-10-31 21:18:08 +13:00
Hamish Mackenzie 57cb1649c9 Use inputMap for soruce of packages in custom repository (#1750)
* Use inputMap for soruce of packages in custom repository

* Include inputMap for hspkg-builder to use

* Use inputMap for soruce of packages in custom repository

* Fix url replacement.

* Check all the urls

* Add comments
2022-10-14 17:03:47 +13:00
Mango The Fourth e49b15fefc Choose proper llvm version for llvm-hs and make stack infra work like stack does (#1724)
* update llvm-hs llvm from 11 to 12

* allow passing version args to build-tools; fix llvm-hs build-tools, pass allRefs to builtins.fetchGit to allow fetching non-standard-refs (to mirror stack behaviour)
2022-10-04 23:20:50 +13:00
Hamish Mackenzie ec0c59e2de Support for packages with only tests (#1732)
* Support for packages with only tests

Fixes #362

* Fix for ghcjs
2022-10-03 15:39:47 +13:00
Hamish Mackenzie 7462e537ef Fix building the stack tool (#1723)
Fixes #218

Tested with:

```
nix-build -E '((import ./. {}).pkgs-unstable.haskell-nix.tool "ghc924" "stack" "2.9.1")'
```
2022-09-30 21:54:38 +13:00
Hamish Mackenzie 6c7f9d0042 Use cabal 3.8 (#1641)
A bug was fixed in cabal 3.8 (https://github.com/haskell/cabal/issues/6771) that haskell.nix relied on for `pkg-config` in support.  To work around this we added a dummy `pkg-config` that `cabal configure` now uses when haskell.nix runs it `cabal configure` internally.  That returns version information for all the `pkg-config` packages in `lib/pkgconfig-nixpkgs-map.nix`.  This mapping has also been expanded based on the results of searching nixpkgs for `*.pc` files.

This update also includes workarounds for:

https://github.com/haskell/cabal/issues/8352
https://github.com/haskell/cabal/issues/8370
https://github.com/haskell/cabal/issues/8455
2022-09-13 12:00:04 +12:00
Alexander Vieth 7f3bf673c9 use Hamish's suggestion for faster dedup 2022-08-25 10:15:15 -04:00
Alexander Vieth 872043aadc use attrsets for deduplication
'name' should be unique for haskell packages; not necessarily so for
other things
2022-08-24 10:38:41 -04:00
Alexander Vieth 839515b97d deduplicate build inputs for the shell
https://github.com/input-output-hk/haskell.nix/issues/1297
2022-08-23 11:32:12 -04:00
Yvan Sraka bc1de42afa Fix #1587: the option shell.buildInputs does not exist ... (#1598) 2022-08-18 16:07:27 +02:00
Hamish Mackenzie 1662092eab Fix for tests broken by cabal update in hackage (#1585) 2022-08-18 14:45:17 +12:00
Hamish Mackenzie ce047883ac Fix tool functions (#1570) 2022-08-01 23:57:29 +12:00
Hamish Mackenzie a443611ecf Add evalSystem and evalPackages project args (#1546)
This adds a way to specify the `evalSystem` or `evalPackages` explicitly when calling the `project` functions.

Currently if we want to make a `flake` that supports multiple systems we have few options:

* Require builders for all the supported systems (even just for `nix flake show`).

* Pass `--impure` so that haskell.nix can see `builtins.currentSystem` to set up `pkgs.evalPackages` to use that.  Unfortunately this prevents nix from caching some of the work it does and often results in it recalculating for each supported system when it would otherwise be cached and take no time at all.

* Add an overlay to replace `evalPackages`.  This works, but it is not straight forward.

* Materialize the nix files for the project.

This change allows `evalSystem = "x86_64-linux";` to be passed telling `haskell.nix` to run `cabal` and `nix-tools` on that system.  The user will have to have a builder for that system, but does not need to have builders for the others (unless building outputs for them).
2022-07-28 20:03:05 +12:00
Hamish Mackenzie 4e01f34543 Add nixpkgs-2205 and update other nixpkgs pins (#1506) 2022-07-17 18:18:19 +12:00
Chua Hou 5d5d471409 Set meta.mainProgram for executable components (#1539)
- This allows nix run to work correctly, so that it knows the correct
  name of the executable, as it would otherwise attempt to execute an
  executable named "project-name-exe-exeName", for example.
- See #1231.
2022-07-06 23:25:58 +12:00
Teo Camarasu 54b86efe7c Avoid duplicated packages in ghc-pkg list (#1530)
Filter out the setup dependencies of `Simple` packages from the shell. Fixes #1518.

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2022-06-30 21:16:35 +12:00
Andrea Ciceri 2c1701b681 Supporting ca-derivations experimental feature (#1494)
* Supporting `ca-derivations` experimental feature

* Improved `contentAddressed.include` option description

* Ensure deterministic output for content addressed components

* Comment transformed into a Nix comment

To avoid possibly useless rebuilds

* Use `modules` arg `contentAddressed` flag

* Tutorial about CA derivations

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2022-06-23 12:39:35 +12:00
Hamish Mackenzie 1eaa396e9c Fix #1507 by running postBuild hook in setup build (#1519)
* Includes very temporary work around for CI issue
2022-06-21 15:38:41 +12:00
Hamish Mackenzie d3ba497b5f Fixes to help building of all packages in stackage (#1503)
These are the less controversial changes from #1251
2022-06-02 22:45:09 +12:00
Hamish Mackenzie fa2fa131fe Add ghc 9.2.3 (#1491)
Also:

* Updates the GHC's built on CI
* Use Cabal 3.6.2.0 for default Setup
* Fixes haskell-language-server and hlint on CI
2022-06-01 19:33:58 +12:00
Hamish Mackenzie 82bc945818 Fix ghc 9 windows cross compilation (#1450)
Fixes Windows cross compilation for GHC 9.0 and 9.2.

Updates wine to use the version that is included with the chosen Nixpkgs (it used to be pinned to an older version).

Moves the configuration of the GHC source into the GHC derivation.  This should make adding Hadrian support easier.

Propagates library dependences (not just pkgconfig ones) on windows so that any DLLs in those libraries can be copied for TH evaluation and to the `/bin` directory of executable components.

Adds gcc and mfcgthreads as library dependencies on Windows so that the DLLs they include will be found.

Use `$pkgsHostTarget` (instead of `ghc-pkg`) to find all the DLLs can copy them to the `/bin` directory of executable components.

Adds support for __int128_t and __uint128_t to language-c to fix aarch64-darwin builds.

Fixed reinstalling packages that come with patched versions in ghcjs.
2022-05-19 20:21:16 +12:00
Shea Levy bfeea3e894 Allow packages to specify external static plugins 2022-05-02 11:08:42 -04:00
Hamish Mackenzie f3ea06dcac Work around for packages in lts that do not install. (#1437)
For ghc 9.0.2 Haskell.nix will use the `stm`and `filepath` source that came with `ghc` when the version desired matches.  This is because 9.0.2 shipped with packages that differ from the same version in hackage.

`reinstallableLibGhc` is fixed for GHC 8.10 and above.  Rather than including a patch file this works by:

* Setting the `subDir` to the `compiler` directory when building.  That way relative paths to other parts of the `ghc` source tree (outside the `compiler` directory) still work.
* Files that are needed, but generated when `ghc` builds are added from the `generated` output of the ghc derivation.

`nonReinstallablePkgs` is now sorted and deduplicated before it is used (this reduces the chance of rebuilds when the list is refactored).
2022-04-20 15:25:21 +12:00
Hamish Mackenzie e9a93540c3 Look for DLLs in /bin directory of pkgconfig deps (#1422)
We include the /bin directory of `component.libs` in `extra-lib-dirs` on windows, but not `components.pkgconfig`.  This causes confusing differences between the behavior depending on how a dependency was specified in the `.cabal` file or added in a module.  If it wounds up in `components.libs` the need for DLLs would propagate correctly, but if it was only in `componets.pkgconfig` DLLs would not be included when building TH code and did not get symlinked to `exe` component output /bin dirs.
2022-04-01 16:35:04 +13:00
Hamish Mackenzie 4b6ee9767d Make DLLs in deps available to wine TH runner (#1405)
This is a better fix to the problem of making DLLs available to the process running in wine that is used to evaluate TH code when cross compiling for Windows.

Also fixes macOS loadArchive in TH for ghc 9

Co-authored-by: Michael Peyton Jones <michael.peyton-jones@iohk.io>
2022-03-25 21:44:02 +13:00
Hamish Mackenzie 864c0aff9c Pass enableDWARF to makeConfigFiles to fix -g3 support in nix-shell (#1385) 2022-02-25 01:52:16 +13:00
Cheng Shao 18ebf60137 Fix libnuma dependency in rts.conf (#1342) 2022-02-15 23:49:45 +13:00
Hamish Mackenzie 41682ea1fd update pins (#1371) 2022-02-15 11:11:34 +13:00
Teo Camarasu 02f34c6f36 fix typo (#1362) 2022-02-04 14:52:37 +00:00
Moritz Angermann eb7e669d63 Enable aarch64 builds (#1316)
* Adds small address space logic

* no numa on android

* Update comp-builder.nix

* Adds android.nix

* host And target.

* Make android remote-iserv static

* Add back mmap_next

* Create rts-android-jemalloc-qemu.patch

* Update bootstrap.nix

* Some android modifications to ghc

* Some modifications to the android overlay.

* disable more hardening flags on android

* Adds stack-protector-symbols.patch

* Adds libraries-prim-os-android.patch

* Adds support for CONDBR relocations

* Adds undef+weak symbol support.

* calloc takes 3 not 2 args :-(

* Adds getauxval

* Needs enable static now

* Fix android cross
2022-01-09 11:36:53 +13:00
Moritz Angermann 001df758bf fix ghcjs (#1311) 2022-01-09 03:11:37 +13:00
Michael Peyton Jones c58c5946eb Don't set LANG and LOCALE_ARCHIVE in shellFor (#1341) 2022-01-07 19:01:07 +08:00
Cheng Shao 65c7172b42 Use fixed ghc version when building hoogle (#1322) 2021-12-28 21:51:16 +08:00
Javier Sagredo 0e2ae928e2 Rename executable-profiling flag as suggested by Cabal (#1136) 2021-12-27 15:28:59 +08:00
Moritz Angermann 59ad2995cc Update ghcjs810-src.json (#1291)
* Update ghcjs810-src.json

* Update ghcjs-project.nix

* Update ghcjs.nix

Use nodejs-12_x, to allow larger strings to be loaded. See https://github.com/nodejs/node/issues/33960

* Update comp-builder.nix

Allow large strings, see https://github.com/nodejs/node/issues/33960

* Update cabal-os-arch-comp.nix

* Update ghcjs-src

* Update ghcjs ref

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2021-11-17 02:17:02 +13:00
Hamish Mackenzie 24b421cbfc Add ghc 9.2.1 and update internal cabal to 3.6.2 (#1286) 2021-11-13 12:43:04 +13:00