Commit Graph

104 Commits

Author SHA1 Message Date
Hamish Mackenzie 172d402394 Add more flakes support and getting started guide (#972)
This PR adds a `flake` function to haskell.nix projects.  It can
be used to transform the outputs of project into a flattened structure
that can be used to make a `flake.nix` file for your project.

Because the nix code and commands used are different a lot of stuff in
the getting-started.md will not work with a `flake.nix`.  So instead
of trying to add a flake section to that guide this PR adds a new
version for Nix Flake users.
2021-02-22 20:42:33 +13:00
Jun Matsushita 4b8dd307d7 Fix nixpkgs version (#1052) 2021-02-21 18:22:42 +13:00
Hamish Mackenzie 89f50a96dd Use pkgs.lib instead of stdenv.lib (#1031)
Fixes:

Warning: `stdenv.lib` is deprecated and will be removed in the next release. Please use `pkgs.lib` instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938
2021-02-11 01:07:16 +13:00
Hamish Mackenzie cd91692380 GHC 8.10.4 (#1033)
* Adds GHC 8.10.4 support

* Drops GHC 8.8.3, 8.10.2 and 8.10.3 from CI

* Adds warning to encourage people to use less buggy ghc
2021-02-09 14:30:32 +13:00
Michael Peyton Jones 928bdb5449 Update and simplify version support table (#1028)
Only include stuff that is positively supported, makes it easier to
read.
2021-02-03 11:17:07 +00:00
Marek Fajkus 62bb4dfd3a fix link to troubleshooting section (#1016) 2021-01-25 11:27:24 +13:00
Bill Ewanick 0c3689b028 Update Getting Started for NixOS users (#998)
* Update getting started for NixOS users

Based on the file that writes nix.conf, and visual inspection, these settings update the nix.conf on NixOS as specified.

* Better tutorial structure

responding to feedback
2021-01-19 09:39:11 +08:00
paumr a045d79264 Updated system-nixpkgs-map.nix and a default for X11 package (fixes #984) (#988)
After investigating adding a project argument to override the
mapping of libs to packages we realised we could fix the X11
package by updating `modules/configuration-nix.nix`.

We also updated `system-nixpkgs-map.nix` to allow multiple
packages to be mapped for a single library (turned out not
to be necessary for X11).

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2021-01-08 13:10:00 +13:00
Michael Peyton Jones 738af22ce9 Move more CI to 20.09 (attempt 2) (#975)
* Update default nixpkgs to 20.09

* Move more CI to work on 20.09 by default

* IFD level 1

* Use nixpkgs 20.03 emscripten (needed for ghcjs)

* Add missing materialized files

* Add missing materialized files

* Fix for ghc 8.8 build on darwin

* Fix for ghcjs 8.8 build on darwin

* Fix hls stack test eval for ghc810220201118

* ifdLevel 2

* Oops: accidentally turned on tests for experimental GHC

* Revert "Fix hls stack test eval for ghc810220201118"

This reverts commit b405cd7ee8bd62214bd2d0a61e0317673b5bf1b5.

* ifdLevel 3

* Disable GHC 8.6.5 windows cross on nixpkgs 20.09

* Update supported GHC doc with a table

* Add emscripten comment

Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2020-12-17 15:57:09 +00:00
Rodney Lorrimar d6e47d8b50 Bump nix-tools to latest master (#955)
* Bump nix-tools to latest master

* Add docs for checking nix-tools materialization

Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2020-12-03 22:53:15 +13:00
Hamish Mackenzie a9584f36e2 Add projectCross to projects (like pkgsCross) (#946)
This change adds a `projectCross` attribute to the return value of
the project functions.  It is similar to `pkgs.pkgsCross` and makes
it easier to build cross compiled versions of project (or get
a cross compile with `p.projectCross.${platform}.shellFor`).
2020-11-30 15:42:05 +13:00
Michael Peyton Jones 20b6629205 Drop 19.09 support (#947)
* Drop 19.09 support

This is a year old. NixOS doesn't even support the last stable release,
let alone the one before that.

Also cuts our CI size by a third, which is always nice.

* Remove 19.09 compatibility pieces
2020-11-27 10:34:31 +13:00
Hamish Mackenzie c0931c9a56 Replace otherShells with mkShell inputsFrom (#939)
It turns out the `otherShells` arg we added to `shellFor` is very
similar to the `inputsFrom` argument of `mkShell`.  We can use
`inputsFrom` instead having `otherShells` by replacing the use of
`mkDerivation` with `mkShell` in `shellFor`.
2020-11-26 21:15:27 +13:00
Hamish Mackenzie 5df5be0d08 Remove pj.hsPkgs.${n} functions in favour of pj.${n} (#938)
Applies to:

 * makeConfigFiles
 * ghcWithHoogle
 * ghcWithPackages
 * shellFor
2020-11-26 19:20:10 +13:00
Hamish Mackenzie e729389f32 Add otherShells arg to shellFor (#937)
Makes it easier to include cross compilation shells.  The
buildInputs and nativeBuildInputs of the shells are added.
2020-11-24 16:28:45 +13:00
Artem Pelenitsyn 61546a5770 Fix broken link to official nixpkgs guide to Haskell infrastructure (#923) 2020-11-11 15:01:00 +13:00
Eric Wolf 0c3abc8a6d Allow for hoogle to be materialized in shellFor (#902)
Allow for hoogle to be materialized in `shellFor` by using `tools.hoogle` when passed in.

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@googlemail.com>
2020-10-31 20:46:54 +13:00
Michael Peyton Jones 134b60e48e Troubleshooting: add a small section about stripping (#900) 2020-10-30 17:40:04 +13:00
Hamish Mackenzie 5f80ca910b Add compiler-nix-name arg to stackProject (#897) 2020-10-28 22:11:14 +13:00
Michael Peyton Jones 21e3527e7a Troubleshooting: add a note about missing files (#894)
This is another common issue.
2020-10-27 12:45:47 +13:00
Michael Peyton Jones 1250f0449d Improve binary caching documentation, make more salient (#875)
People constantly ask about this, clearly without having found the
documentation that we do have about this. So we need to make it more
obvious:
- Simplify the setup documentation to emphasize the Hydra cache (which
is the only working one currently).
- Move the cache troubleshooting section to the top to make it more
obvious.
- Highlight a link to the troubleshooting section of the docs in the
README.
- Emphasize that there is more documentation than is linked in the
README.
- Add a section to the README that explicitly mentions cache issues, and
links to the corresponding sections of the docs.
2020-10-13 15:37:04 +13:00
Joe Kachmar 12bac17df7 Fixes adding new GHC documentation link (#873)
Also makes capitalization a bit more consistent.
2020-10-11 09:55:55 +10:00
Toon Nolten 7545dc496b Update specific package building tutorial (#867)
Haskell.nix's `default.nix` is now a function that needs to be called
and `hackage-package` can no longer rely on the default internal GHC so
`compiler-nix-name` needs to be specified explicitly.
2020-10-07 12:18:44 +13:00
Samuel Evans-Powell 48b8674f5f Add support for coverage (#762)
- Added the ability to generate coverage reports for packages and
  projects.
  - Outputs mix and tix information, as well as a HTML report.
- Added the "doCoverage" module option that allows users to choose
  packages to enable coverage for.
- Added a "doCoverage" flag to the component builder that outputs HPC
  information when coverage is enabled.
- Added the "overrideModules" library function to make it more
  ergonomic fo users to enable coverage on existing projects.
- Modified the "check" builder to also output ".tix" files (if they
  exist). This information is required to generate the coverage
  report.
- Added a test for coverage.
2020-09-29 11:56:24 +08:00
Michael Peyton Jones bd45da822d Link 'supported GHC versions' and 'adding a new GHC version' into the doc structure (#841) 2020-09-10 14:03:03 +10:00
Asad Saeeduddin 3250b6cc7b Suggest adding Hydra substituter in docs (#823)
It seems [Hercules CI](https://hercules-ci.com/github/input-output-hk/haskell.nix) is having some problems, which means build outputs might not be available via the Cachix substituter.
2020-08-31 21:06:40 +12:00
John A. Lotoski 09526c8555 Spelling, typo and whitespace fixes (#833)
* Spelling and typo fixes in doc and code comments
* Trailing whitespace or whitespace only truncation
* readTheDocs formatting corrections
2020-08-31 11:08:25 +12:00
Hamish Mackenzie b368a5dfb4 Cache ghc883 and ghc8101 again (without tests) (#821)
When ghc 8.8.4 and ghc 8.10.2 were added we stopped building the older
versions on ci.  This changes adds them back but does not run all
the tests on them.
2020-08-15 00:34:32 +12:00
Hamish Mackenzie b6de6ef3b8 Remove components.all (#776)
It causes a lot of issues. To make this work:

* `shellFor` is updated to use `getAllComponents` instead of `.all`.
* `getAllComponents` is updated to work on the package rather than
  the package config.
* Tests updated to not use `.library` or `.exes.X` where appropriate.
* Documentation updated.
* Out of date examples removed.

As a bonus `shellFor` now takes a `components` argument that might be
useful for limiting the dependencies of the shell to just the ones
needed for the components you intend to work on.
2020-07-21 16:06:54 +12:00
Hamish Mackenzie cacfba0b45 Replace ghc 8.8.3 with 8.8.4 (#766)
Also adds some tooling/docs for adding new ghc versions (see `docs/adding-new-ghc.md`)
2020-07-21 14:10:23 +12:00
Hamish Mackenzie dddef063af Fix #758 (#759) 2020-07-10 19:04:33 +12:00
Domen Kožar 8b79a284e7 more typos (#757) 2020-07-10 11:46:08 +08:00
Domen Kožar 1d6ad76ffe fix internal links for *project reference (#756) 2020-07-09 11:48:22 +12:00
Hamish Mackenzie 4cac8bd00f Remove internal deps on default ghc and stackage (#738)
Changes to the interface of haskell.nix (from the changelog.md file):

* Removed `sources.nixpkgs-default`, use `sources.nixpkgs` instead.
* Removed `./nixpkgs` directory, use  `(import ./. {}).sources`
  or `./nix/sources.nix` instead.
* Removes V1 interface for details on how to fix old code see:
    https://github.com/input-output-hk/haskell.nix/issues/709
* Removed defaultCompilerNixName.
* cabalProject, cabalProject', hackage-project and hackage-package
  now require a `compiler-nix-name` argument.
* `haskell-nix.tool` and `.tools` now require a `compiler-nix-name` argument.
  New functions `p.tool` and `p.tools` (where p is a project) do not.
  Like `shellFor { tools = ... }` they will use the compiler nix name
  from the project (including stack projects where it is derived from
  the resolver).
* `haskell-nix.alex` and `haskell-nix.happy` have been removed. Use
  `p.tool "alex" "3.2.5"` or `shellFor { tools = { alex = "3.2.5"; } }`.
* `haskell-nix.nix-tools` -> `haskell-nix.nix-tools.ghc883` (it includes
  the hpack exe now).
* `haskell-nix.cabal-install` -> 
  `p.tool "cabal" "3.2.0.0"` or `shellFor { tools = { cabal = "3.2.0.0"; } }`
* `haskell-nix.haskellNixRoots` -> `haskell-nix.roots ghc883` or `p.roots`

Other changes:

Adds hpack executable to the nix-tools derivations.

Adds a `cabal-hpack` test to make sure `hpack` works with
`cabalProject`.

Reduces the number of calls to `cabalProject` (particularly when
checking materialization), by giving internal tools a per-compiler
attribute.

Uses happy 1.19.12 when building newer ghc versions.

Updates cabal-install 3.2.0.0 to use the source from github that
is compatible with ghc 8.10.1.

Updates the docs for callCabalProjectToNix.

Adds a license mapping to fix a common warning.
2020-07-08 22:54:01 +12:00
Domen Kožar 33445e4fb9 Add project, cabalProject, stackProject references (#753)
* Add project, cabalProject, stackProject references

* Update docs/reference/library.md

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

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
2020-07-08 21:25:24 +12:00
Arian van Putten 76e13925b1 Note that on Cabal 3.0 you can just use "cabal build" (#744) 2020-07-03 10:18:35 +12:00
Michael Peyton Jones f590b792b5 Add troubleshooting section to docs (#733) 2020-07-01 00:43:01 +12:00
Toon Nolten 5c4a0de2a1 Minor documentation fixes (#722)
* Make the haskell.nix import in the examples explicit

The examples used `import ./. {}` without explaining the commands should
be run from the haskell.nix repo root. To avoid confusion like this I
added fetching a tarball of the repo. This is less efficient when run
from the repo but works when run from anywhere and makes it clear we're
importing haskell.nix.

Added a couple urls and removed the urls on the lens component so as not
to confuse components with packages.

* Fix rephrase

The phrasing was left in a partially-rewritten state.

* Change wording and fix typo

* Minor fixes for consistency
2020-06-23 08:10:41 +10:00
Domen Kožar 1383a63ff6 fix getting started example and simplify (#711) 2020-06-19 21:15:07 +12:00
Domen Kožar a814a425f4 Expose handling of git repos in tutorial (#713) 2020-06-19 21:14:14 +12:00
Domen Kožar e56bbb39d1 Promote materialization and demote manual generation (#712) 2020-06-19 20:27:52 +12:00
Hamish Mackenzie 9e6820cc71 Add haskell-nix.project (and project') (#703)
Generalized version of the `cabalProject` and `stackProject`
functions.

Automatically selects the correct project type based on the
`projectFileName` argument if provided or what files exist in
the `src` directory if no `projectFileName` was specified.

If it cannot be determined which it should use the following
error message is given:

```
error: haskell-nix.project : both `stack.yaml` and `cabal.project` files exist set `projectFileName = "stack.yaml;"` or `projectFileName = "cabal.project";`
```
2020-06-19 20:07:19 +12:00
Domen Kožar 2852a9521f Reorganize tutorials (#702)
* fix hackage and stackage to work

* user-guides -> tutorials

* Restructure tutorials

* getting-started: clarify on packages and components

* Update docs/tutorials/development.md

Co-authored-by: Rodney Lorrimar <dev@rodney.id.au>

* getting-started: bail out if cabal.project and stack.yaml are present

* hackage-stackage: delete duplicated content

Co-authored-by: Rodney Lorrimar <dev@rodney.id.au>
2020-06-19 13:37:02 +12:00
Domen Kožar 59cf05606e module: generate using markdown template (#693)
The main motivation is that each option now is a heading and
such a link!
2020-06-16 17:13:04 +08:00
Hamish Mackenzie 8cbf979538 Add nix-tools to niv and update docs to fix #675 (#678)
* Updates docs/user-guide.md

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
2020-06-15 14:36:05 +12:00
Michael Peyton Jones da9c5b93a9 Improve docs, mention pinning Hackage and Stackage (#668)
Fixes #536.
2020-06-10 18:31:54 +08:00
Shao Cheng 208cd20ac9 Improve nix-tools installation guide (#639) 2020-05-31 11:07:39 +08:00
Domen Kožar 138695d0a2 Split out introdocution into motivation, add features, prepare getting started (#634) 2020-05-31 11:06:02 +08:00
Ben Gamari f66f6cb7c8 docs/cross-compilation: Mention emuation for splices (#629)
The fact that this happens automatically was non-obvious to me.
2020-05-29 11:26:08 +08:00
Hamish Mackenzie ecc72c1949 Add cleanGits and support it incabalProject (#631)
Some times it is handy to temporarily use a relative path between git
repos.  If the repos are individually cleaned this is not possible
(since the cleaned version of one repo will never include the files
of the other).

`cleanGits` allows us to specify a root directory and any number of
sub directories containing git repos.
2020-05-28 21:59:36 +12:00