54 Commits

Author SHA1 Message Date
Yvan Sraka 8309423b1a Fix #518: examples in documentation need to be tested (#1714) 2022-10-06 10:36:38 +02:00
Deniz Dogan 127e423397 Fix duplicate ${system} in flake tutorial (#1729)
When I followed this tutorial, my default package ended up as `packages.aarch64-darwin.aarch64-darwin.default`. Removing this "extra" `${system}` solves the problem, but admittedly I'm not 100% sure what's going on here.
2022-10-03 11:06:53 +13:00
Thomas Vellekoop 022504e723 Fix use of no longer supported GHC version. (#1618) 2022-08-26 16:22:00 +01:00
Yvan Sraka 3c9acea8fe Fix #1581 & #1586: flake output attribute 'defaultPackage' and 'devShell' are deprecated (#1583)
Using 'packages.<system>.default' and 'devShells.<system>.default' instead
2022-08-18 08:01:52 +00:00
Danila Danko 9c697ee23a [...] explanation (#1589) 2022-08-15 21:10:03 +12:00
Danila Danko 3a292d4a08 Update development.md (#1591) 2022-08-15 19:05:37 +12:00
George Thomas a6ce303abb Fix typo (#1584)
Looks like a copy-paste error from the shell config above.
2022-08-11 00:10:15 +12:00
Hamish Mackenzie 05c0555400 Add flake support to hix (#1572)
This adds support for using nix flakes commands with hix.  This is done by creating a hidden `.hix-flake` directory and passing the source in using `--override-input`.

It also includes a `hix init` command to add a `flake.nix` and `nix/hix.nix` configuration file.
2022-08-05 10:17:16 +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 b1661f08e3 Update cache server in docs to cache.iog.io (#1481) 2022-05-24 17:30:13 +12:00
Daniel Goertzen e4248b3f14 fix binary cache for nixos (#1448)
* fix binary cache for nixos

* Update getting-started.md

add nixos binary cache instruction for both <=21.11 and >21.11
2022-04-21 17:06:28 +01:00
Stefan Frijters b4b6bd387d Fix links to troubleshooting Markdown pages (#1443) 2022-04-19 12:42:34 +12:00
Hamish Mackenzie 97b3a67789 Fix typo & comment out cross comp in eg. flake.nix (#1423) 2022-04-01 18:18:42 +13:00
Ian 9fae2eb97f Replace deprecated NixOS binary cache settings (#1410)
`nix.binaryCachePublicKeys` and `nix.binaryCaches` are now deprecated in NixOS: the current names for these settings are `nix.settings.trusted-public-keys` and `nix.settings.substituters`, respectively
2022-03-21 16:27:36 +00:00
J.R. Hill 355cd3701d Fix minor typo (#1360) 2022-02-04 10:08:10 +00:00
Tom Prince a68a7dda41 Add nixos-21.11 builds. (#1304)
* Add nixos-21.11 builds.

* Remove references to nixpkgs-20.09.
2021-12-07 12:55:20 +13:00
visortelle 8c71436914 Fix getting-started.md for MacOS (#1283) 2021-11-05 11:50:42 +13:00
Sridhar Ratnakumar fbbcda2d21 flakes tutorial: add buildInputs example (#1248)
Often I want to have non-haskell tools, like nixpkgs-fmt (used to format .nix files in IDE context), installed in the nix shell.
2021-09-27 19:12:03 +13:00
Hamish Mackenzie 19052d83fd Expose config.nix for flakes to use (#1238) 2021-09-15 23:00:14 +12:00
Hamish Mackenzie 1f4c2c9b08 Add GHC 8.10.7 (#1220) 2021-09-01 22:43:31 +12:00
Teo Camarasu f624ca5662 Add GHC-8.10.6 (#1214)
Add GHC-8.10.6

Co-authored-by: Peter Becich <peter@simspace.com>
Co-authored-by: Teo Camarasu <teofilcamarasu@gmail.com>
Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2021-08-31 04:19:40 +12:00
Hamish Mackenzie 6b28399864 Add Hix wrappers for Nix tools (#1053)
The `hix` tools are wrappers for the various `nix` tools that
use `haskell.nix` without the need to add any `.nix` files.

This is useful for:

* A quick way to try out haskell.nix for new users.

* Using haskell.nix to work on projects that do not have
  `.nix` files.

* Testing to see if `haskell.nix` can build a project.

* Making `flake` and `non flake` configurations to check `haskell.nix`
  treats them the same.

The configuration arguments for `Hix` can be (from highest precedence to lowest):

* Passed on the command line with `--arg` (or `--argstr` for string args).

* Placed in `nix/hix.nix` file in the project dir.

* Placed in `~/.config/hix/hix.conf`

Boilerplate `default.nix`, `shell.nix` and `flake.nix` files can be added to a
a project with a `nix/hix.nix` file to make it work with the standard `Nix`
tools.
2021-06-26 17:58:06 +12:00
Pierre Penninckx 2e8af6c7b6 Fix wrong default.nix if following instructions blindly (#1148)
When copy-pasting the modified lines to the `default.nix` file, it will produce the following error:
`error: cannot coerce a set to a string, at [...]/default.nix`

Making the changes makes it work. Actually, the lines above (untouched in this PR) `fetchTarball "[...]/master.tar.gz"` were correct alread.
2021-06-24 20:55:10 +12:00
Hamish Mackenzie f279cdef5f Update the project modules and fix missing args param (#1144)
There are now 4 project modules used to check the arguments passed to the various project functions:

* `project-common.nix` - Arguments used by all the project functions
* `stack-project.nix` - Used by the `stackProject` and `stackProject'` functions
* `cabal-project.nix` - Used by the `cabalProject` and `cabalProject'` functions
* `project.nix` - Just the `projectFileName` argument that is used by `project` and `project'` functions to determine whether to call `stackProject` or `cabalProject` function.

This also includes the `rawProject.args` that was mistakenly left out of #1141 causing #1142 and improvements for the docs for the use of the `shell` argument in `flake.nix` files.
2021-06-20 18:00:22 +12:00
Hamish Mackenzie 91adf5f97d Add crossPlatforms arg to shellFor (#1089)
This makes it easier to get cross compilers for a project in a nix shell.
2021-04-16 17:50:10 +12:00
Hamish Mackenzie 18979e4745 Update getting started guide and shellFor (#951) 2021-04-09 00:12:00 +12:00
Arnaud Bailly 6c9facfada Update development.md (#1010)
Remove inheritance from `shell.nix` when defining `hsPkgs`. I tried following the tutorial on a new project and I had errors caused by this.
2021-03-18 20:04:55 +13:00
toonn 637302c647 doc/tutorial: Update materialization examples (#1040)
* doc/tutorial: Fix up materialization tutorial

Capitalize Nix everywhere, use consistent formatting of lists and fix
some typos.

* doc/tutorial: Update materialization examples

Update the practical examples of how to materialize a haskell.nix
project. The examples had aged to the point where they could no longer
be followed.
2021-03-18 20:04:21 +13:00
Jun Matsushita 95e58db9cb Fix links to cabal docs (#1067) 2021-03-18 19:50:13 +13:00
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
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
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 5f80ca910b Add compiler-nix-name arg to stackProject (#897) 2020-10-28 22:11:14 +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
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
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 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 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
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