* Delete flake.lock in docs to better catch issues in tests
* Fix#1757: test nix flake init --template "template#haskell-nix"
* Rewrite `buildkite` jobs for GitHub Action
* Fix#1558: add flake template for `nix flake init`
This depends on https://github.com/NixOS/templates/pull/40
This issue makes both `nix run haskell-nix#hix -- init` and
`nix flake init --template haskell-nix#template --impure` do the same
thing!
* Update getting-started-flakes.md
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.
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.
`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
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.
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.
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.
* 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.
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.
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
* 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
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>
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`).
* 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
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.
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.
- 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.