Commit Graph

30 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
Hamish Mackenzie 884ef3aa37 Fix test/tests.sh for other ghc versions (#1719)
Fixes #1482
2022-09-30 01:22:37 +13:00
Hamish Mackenzie c683efad28 Bump nixpkgs pin used in default.nix (#1649)
* Bump nixpkgs pin used in default.nix

Making it match the current 22.05 pin in flake.lock.

Was going to do this because of #1648, but might save some people a nixpkgs download so let's do it anyway.

* Fix test issue

* Use flake.lock

* Use flake.lock
2022-09-09 18:23:46 +12:00
Hamish Mackenzie 5968c65cdb Fix test.sh (#1645) 2022-09-07 13:48:10 +12:00
Yvan Sraka d457723ac6 Split calls to test/test.sh into several buildkite jobs (#1629) 2022-08-30 09:48:20 +00:00
Yvan Sraka cc8f2c6f24 Fix #1600: add end-2-end test of hix project initialization and flakes development shell (#1601) 2022-08-30 20:24:02 +12:00
Yvan Sraka a2a29bd368 Use nix --accept-flake-config option rather than yes | in CI tests (#1626)
https://nixos.org/manual/nix/unstable/command-ref/conf-file.html#conf-accept-flake-config
2022-08-30 11:30:09 +12:00
Yvan Sraka 18c1b768ad Fix a typo in warning message of test/tests.sh CLI usage (#1609) 2022-08-23 11:59:06 +12:00
Yvan Sraka ca5e07e4f0 Make test logs more verbose using bash -x option (#1610) 2022-08-23 11:58:27 +12:00
Yvan Sraka 3b5d165368 Add a custom nix.conf file for CI tests (#1611)
This should unstuck both #1579 and #1601 ...

n.b. This is enabled only when `CI` env variable is set, to not bother
normal users in their interactive tests ;)
2022-08-23 11:56:54 +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
Shea Levy 8aa77fdbd8 Update nixpkgs unstable. (#1196)
* Update nixpkgs unstable.

Plutus needs NixOS/nixpkgs#127239.

* Don't include stack tests that use ghc 8.6.5 when testing ghc 8.10.5

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2021-08-18 00:44:03 +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
Moritz Angermann 642b2b12bf Update tests.sh 2020-05-02 19:06:54 +08:00
Maxim Koltsov 07031ee224 External hackages (#535)
* Add support for external Hackage repositories

Currently haskell.nix is not able to build Cabal projects that depend on
packages from private Hackage repositories, as it make only main Hackage
available to cabal. This is unfortunate.

This commit adds this functionality, by allowing the user to pass
`extra-hackages` and `extra-hackage-tarballs` to `mkPkgSet` and
`callCabalToNix` respectively, to add as much extra repositories as
needed.

This repositories are first made available to Cabal when calling
`v2-configure`, resulting in correct plans. Later they are combined with
global Hackage when building dependencies of the local packages.

* Use cabal.project.freeze if available

Currently callCabalProjectToNix does not copy `cabal.project.freeze`
from source directory, leading to different build plans when building
components with nix and when building project with `cabal new-build`
inside `nix-shell`.

This behavior is undesired, so this commits fixes it.

* Add tests for extra-hackages functionality

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
2020-05-02 18:16:34 +08:00
Rodney Lorrimar 686fa37877 shellFor: Fix bug where packages were not excluded from the env (#285)
* tests: Add regression test for shellFor build-tools bug

* tests: Fix regen script

* Regenerate nix expressions for tests

* tests: ghc 8.4.4 -> 8.6.5

* shellFor: Fix bug where packages were not excluded from the env

If a multi-package project had an build-tools dependency between
packages, they would not be correctly removed from the shell's inputs.
2019-11-01 20:08:31 +10:00
Rodney Lorrimar 53c0498ec4 Add tests for benchmarks and hspec-discover (#181)
* tests: Add benchmarks and hspec-discover to cabal-22 test
2019-10-01 10:01:49 +08:00
Hamish Mackenzie 6be886644f Cross comp. & callCabalProjectToNix/callStackToNix (#202)
* Cross comp. & callCabalProjectToNix/callStackToNix

This fixes an issue where the these IFD functions fail because they try
to build and run a cross compiled nix-tools on the build system.

It may also help if there are cross compilation issues with
setup-depends (they also access the buildPackages).

* Align stack-to-nix ifd with plan-to-nix ifd

This also fixes the restricted/pure eval issues with callStackToNix.

I've also made the tests run in restricted mode to catch these kinds of
issues.
2019-07-13 22:13:15 +08:00
Rodney Lorrimar 097852792d Fix daily Hackage update (#177)
Hackage hasn't been updated for a week because of a build error.
2019-06-15 07:16:52 +02:00
Rodney Lorrimar 8512832c32 Fix evaluation on Hydra (#153)
* Fix eval on Hydra

* Bump nixpkgs to latest 19.03

* Change unit tests into a derivation

Prevents Hydra from complaining about them.

* Add unpacked source pins to Hydra jobset

So that they are cached.
2019-06-02 07:21:21 +10:00
Jean-Baptiste Giraudeau 3fb220334f Fix name of shellFor derivation for a single package. (#155) 2019-05-30 22:46:39 +02:00
Rodney Lorrimar 2cbfbac176 tests: Add a test case for the shellFor hoogle index 2019-05-28 10:53:05 +10:00
Rodney Lorrimar b060ea5576 tests: Add tests for the shellFor function 2019-05-28 09:34:58 +10:00
Edward Amsden 390771849a Add callStackToNix function (#116)
Allow building a stack project directly without needing to generate the scaffolding.

```nix
{ mkStackPkgSet, callStackToNix, ... }:
let
  pkgSet = mkStackPkgSet {
    stack-pkgs = callStackToNix { src = ./.; };
    pkg-def-extras = [];
    modules = [];
  };
in pkgSet.config.hsPkgs
```
2019-05-17 15:49:40 +08:00
Rodney Lorrimar 2d2aacf4e8 tests: Clean build directories, etc, before running 2019-02-12 09:38:14 +10:00
Rodney Lorrimar 33e8d115f7 tests: Add more tests for "all" component merging
- Make the cabal-simple executable depend on the library component --
  a better exercise for the merged all component build.

- Test building cabal-simple with "cabal new-build" in nix-shell.

- Check the contents of components.all.depends for the with-packages test.
2019-02-07 09:39:12 +08:00
Rodney Lorrimar 57049091b3 Fix dependency merging of "all" component 2019-01-31 13:17:45 +10:00
Rodney Lorrimar a8adc34e27 tests: add shell script which runs all tests 2019-01-30 15:38:38 +10:00