Commit Graph

1469 Commits

Author SHA1 Message Date
Hamish Mackenzie
e5ab3910e7
Check ghc-pkg works before we trust its results (#1069) 2021-03-18 19:54:46 +13:00
Michael Peyton Jones
041435e53e
Add test for using GHC directly (#1049)
I suspect this may be broken on macos due to lack of otool. It's already
suspicious that on Linux we have to add `-L` flags for `numa`
explicitly.
2021-03-18 19:53:17 +13:00
Jun Matsushita
400ad34de0
Add link to install nix-tools section (#1065) 2021-03-18 19:50:55 +13:00
Jun Matsushita
ffd1453ceb
Publish the flaskes documentation in the TOC (#1066) 2021-03-18 19:50:29 +13:00
Jun Matsushita
95e58db9cb
Fix links to cabal docs (#1067) 2021-03-18 19:50:13 +13:00
Hamish Mackenzie
9085d9f44e
Fix cleanGit submodule support performance issue (#1072)
Currently in order to support submodules all the directories are included (but not all files) when building the whitelist.  This is done because we need the `.git` files (or directories) the contain to be present when we run `git ls-files --recurse-submodules`.

Including every directory causes two performance issues:

* Creating a directory in your repo (even empty one not added to git at all) will require the whitelist to be recalculated.

* Recalculation of the whiltelist may be slowed down if there are a large number of directories.  In particular `lstat` is called on every file (probably to get the right `type` to pass to the filter function).

The fix is to use `git submodule status --recursive` to get a list of all the submodule directories.  Then the `.git` files (or directories) in them can be included.  This has to be repeated until all the submodules are known (as `--recursive` will not see the submodules until the parent module is included).
2021-03-18 19:49:10 +13:00
Hamish Mackenzie
dff62ec5bd
Non deterministic failures should not be deferred (#1075)
It looks like `callCabalProjectToNix` can fail in its `cabal` call with the following error:

```
open: permission denied (Permission denied)
```

Then running the same derivation locally works.  If the error is deferred there is no easy way on hydra to retry.

This change makes it so only solvers errors (which should hopefully be deterministic) are deferred.  All other errors will go back to being eval time errors meaning they should be automatically retried at the next hydra eval.
2021-03-18 19:45:52 +13:00
IOHK
962ecfed3a Update Hackage and Stackage 2021-03-18 01:16:36 +00:00
Hamish Mackenzie
c93e03c363
Fix hlint test for ghc 8.6.5 (#1073)
The latest hlint no longer supports ghc 8.6.5.  Test last version that did instead.
2021-03-18 13:08:53 +13:00
IOHK
ebf59e4fc3 Update Hackage and Stackage 2021-03-17 01:15:11 +00:00
IOHK
eb8a7647fd Update Hackage and Stackage 2021-03-16 01:15:12 +00:00
IOHK
3b1fcfaca4 Update Hackage and Stackage 2021-03-15 01:13:17 +00:00
IOHK
08887404bb Update Hackage and Stackage 2021-03-14 01:12:07 +00:00
IOHK
b4132f425e Update Hackage and Stackage 2021-03-13 01:13:00 +00:00
IOHK
d890a8f652 Update Hackage and Stackage 2021-03-12 01:16:04 +00:00
Hamish Mackenzie
4d700cf155
Fixing emcc usage in haskell.nix ghcjs (#1064)
* Use emscripten branch of GHCJS for 8.6

* Adds release-linux-only.nix (for hydra with no mac builders)

* Sets HOME to a temp dir once per derivation to help performance of emcc

* Updates materialization

* Uses symlinks to reduce ghc derivation size for wrapped ghcjs

* Removes compiler-nix-name test
    This test checked that the default compiler was overridden by the
    compiler-nix-name arg.  There is no default any more.

The GHCJS branches used include fixes for:

* hs$ret_1 typo (should be hs$ret1)

* A bignum issue
2021-03-12 12:21:07 +13:00
IOHK
536327105e Update Hackage and Stackage 2021-03-11 01:16:34 +00:00
Hamish Mackenzie
fd07667307
Remove remaining hls hackage workaround (#1070)
This is now fixed in hackage (see https://github.com/haskell/haskell-language-server/issues/1525)
2021-03-10 18:49:23 +13:00
IOHK
6c084e98af Update Hackage and Stackage 2021-03-10 01:19:24 +00:00
IOHK
27fb405a31 Update Hackage and Stackage 2021-03-09 01:14:52 +00:00
Hamish Mackenzie
ec23c34c81
Remove workarounds for HLS hackage issues (#1068)
These constraints have all been added to HLS 0.9.0.0 hackage and having them here also breaks HLS 1.0.0.0
2021-03-09 12:00:24 +13:00
IOHK
3f9e7d7468 Update Hackage and Stackage 2021-03-08 01:13:35 +00:00
IOHK
454a31355f Update Hackage and Stackage 2021-03-07 01:13:19 +00:00
IOHK
a7cfc59f4b Update Hackage and Stackage 2021-03-06 01:12:37 +00:00
IOHK
abe9243c25 Update Hackage and Stackage 2021-03-05 01:13:58 +00:00
Hamish Mackenzie
5c25ce919f
Add getComponent to project and package (#1060)
* Delays cabal configure errors until after evaluation when possible.

* Avoids rerunning long `cabal configure` if we already know it will fail.

* Provides a way to get a component from a package or project using a `cabal` like reference.

Code using the `tool` functions will automatically use `getComponent`.

For `(hackage-package {...}).components.library` is also ok.

```
# Consider changing hackage-package use:
(pkgs.haskell-nix.hackage-package {...}).components.exes.something
(pkgs.haskell-nix.hackage-package {...}).getComponent "exe:something"

# For any cabal project:
project.hsPkgs.somepackage.components.exes.something
project.getComponent "somepackage:exe:something"
# or do it in two steps
(project.getPackage "somepackage").getComponent "exe:something"
```

The reason for the new function is that we cannot provide the attribute interface without knowing that packages are in the project first.

Here is how the `cabal configure` error output is handled:

* The `plan-nix` derivation builds even if `cabal configure` fails.

* When it fails, it copies `failed-cabal-configure.nix` to the `$out/default.nix` along with a copy of the `cabal configure` output.

* When `failed-cabal-configure.nix` is imported and used in any way it writes the `cabal configure` output with `__trace` so it will always be visible.

* Instead of a `plan` the imported nix contains a `configurationError` pointing the `cabal configure` output.

* The intermediate functions `configurationError` and bubble it up to where it is needed.

* `getPackage` returns a mostly empty proxy for a real package when there is a `configurationError`

* The `getComponent` function always returns a derivation, but the version in the proxy writes the `cabal configure` output to stdout and calls `exit 1` (so that it will never build).
2021-03-04 20:10:58 +13:00
Hamish Mackenzie
cb264f6f6a
Add project.plan-nix.freeze (#1055)
Issues with `cabal.project.freeze` files can be tricky to debug.
While it is possible to run without a freeze file and look
at the `plan-nix` or `plan-nix.json` (the `plan.json`) created when
haskell.nix configured the project, it would be nice to
also have the output of `cabal freeze` as it will be in the
correct format and contains a different subset of `plan.json`
than the `plan-nix`.

This might also be useful for automating updating of `.freeze`
files.
2021-03-04 16:46:35 +13:00
IOHK
f9aab92672 Update Hackage and Stackage 2021-03-04 01:17:27 +00:00
Hamish Mackenzie
43cb0fc895
Fix for Haskell Language Server from hackage (#1061) 2021-03-03 17:46:32 +13:00
IOHK
a49ad88985 Update Hackage and Stackage 2021-03-03 01:16:57 +00:00
IOHK
5a565b9d91 Update Hackage and Stackage 2021-03-02 01:16:51 +00:00
Hamish Mackenzie
0d781c04c4
Switch from cabal 3.2 to 3.4 (#1058) 2021-03-01 15:42:23 +13:00
IOHK
81ccb0ac45 Update Hackage and Stackage 2021-03-01 01:12:03 +00:00
IOHK
87c18d81af Update Hackage and Stackage 2021-02-28 01:13:05 +00:00
IOHK
88bf457451 Update Hackage and Stackage 2021-02-27 01:13:08 +00:00
IOHK
355cfb59b5 Update Hackage and Stackage 2021-02-26 01:16:21 +00:00
IOHK
958e9d3e9e Update Hackage and Stackage 2021-02-25 01:18:02 +00:00
Hamish Mackenzie
583acc2219
Fix for postgresql-libpg and musl (fixes #948) (#1056)
This combined with setting the `use-pkg-config` flag on `postgresql-libpq` should get it compiling.  There is still a problem with `openssl` that requires a `module` to fix the linking of executables.

Add the following to the `cabal.project` file or to `cabalProjectLocal`:

```
package postgresql-libpq
  flags: +use-pkg-config
```

Include a module like this one to include `openssl` in the linker arguments:

```nix
{
  modules = [(
   {pkgs, ...}: final.lib.mkIf pkgs.stdenv.hostPlatform.isMusl {
     # The order of -lssl and -lcrypto is important here
     packages.postgrest.configureFlags = [
       "--ghc-option=-optl=-lssl"
       "--ghc-option=-optl=-lcrypto"
       "--ghc-option=-optl=-L${pkgs.openssl.out}/lib"
     ];
  })];
}
```

This PR also adds a "hackage quirk" for `postgrest`  to that makes these changes for `postgrest` automatically when built it as a `tool` or with `hackage-package`.

Unfortunately we do not have a good way to avoid the need make these changes.
2021-02-24 22:49:31 +13:00
IOHK
b82002e3fd Update Hackage and Stackage 2021-02-24 01:16:20 +00:00
IOHK
283f57374e Update Hackage and Stackage 2021-02-23 01:15:19 +00:00
Hamish Mackenzie
c4e5aea19b
Fix changelog entry for .dwarf feature (#1054) 2021-02-23 01:25:56 +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
Alexander Bantyev
fd44431a92
flake: export internal functions for more flexibility (#1017)
As of d014079 (#953), haskell.nix internals (such as unapplied
./overlays, sources, etc) are not exported in flake.nix. This makes
it harder to override things when using haskell.nix as a flake.

The use-case I have in mind is to pin haskell.nix itself to prevent
unnecessary GHC rebuilds/redownloads and update only
hackage&stackage. This could be done with a following overlay:

    (haskell-nix.overlays {
      sourcesOverride = haskell-nix.sources // {
        inherit hackage stackage;
      };
    }).combined-eval-on-build

However, this is not the case as of the aforementioned commit. Now, to
do this one has to import ./nix/sources.json, reimplementing what's
already done in haskell.nix, and also import ./overlays. With this
commit, previous snippet turns into the following:

    (haskell-nix.internal.overlaysOverrideable {
      sourcesOverride = haskell-nix.internal.sources // {
        inherit hackage stackage;
      };
    }).combined-eval-on-build

`nix flake check` will now warn us of "unknown flake output
'internal'", but I think it is fine (e.g. nixpkgs has an unknown flake
output as well)
2021-02-22 19:11:58 +13:00
Hamish Mackenzie
bab2eaea62
Enable debug info on linux targets (#1050)
* Add `.debug` to build any component with DWARF dugug info on linux
  (ghc >=8.10.2).
* Pass `enableDWARF` to `shellFor` for to get a shell where all the
  components are the `.debug` ones.
2021-02-22 18:27:36 +13:00
IOHK
27a5268093 Update Hackage and Stackage 2021-02-22 01:13:49 +00:00
Jun Matsushita
4b8dd307d7
Fix nixpkgs version (#1052) 2021-02-21 18:22:42 +13:00
IOHK
1bd38e0e57 Update Hackage and Stackage 2021-02-21 01:12:50 +00:00
IOHK
be92676989 Update Hackage and Stackage 2021-02-20 01:12:18 +00:00
IOHK
0178d9da97 Update Hackage and Stackage 2021-02-19 01:17:02 +00:00
Hamish Mackenzie
42b10678ff
Add support for setting ghcOptions on all packages (#1046)
`ghcOptions` has been moved from package and is now a list of strings.
    old: packages.x.package.ghcOptions = "someGHCoption";
    new: packages.x.ghcOptions = ["someGHCoption"];
To specify ghcOptions for all packages:
    ghcOptions = ["someGHCoption"];
For a single component:
    packages.x.compoents.library.ghcOptions = ["someGHCoption"];
2021-02-19 00:38:36 +13:00