Commit Graph

11 Commits

Author SHA1 Message Date
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
180779b7f5
Fix issue with self. in flake (#959) 2020-12-04 20:13:56 +13:00
Hamish Mackenzie
790c3f9124
Fix issue with self.sources in flake (#958) 2020-12-04 19:09:30 +13:00
Hamish Mackenzie
d014079cce
Fix nix flake check warnings (#953) 2020-12-02 22:31:09 +13:00
Ninjatrappeur
36649ab403
flake: remove outdated edition field. (#912)
The flake edition attribute has been deprecated and removed from Nix.

See:
- e5ea01c1a8
- b875b8f45c
2020-11-06 17:18:43 +00:00
Julien Moutinho
a8f5fed74b
Fix #824 (#824) (#832)
Co-authored-by: Julien Moutinho <julm+haskell.nix@sourcephile.fr>
2020-08-31 21:05:09 +12:00
Alexander Bantyev
afbb245fa8
Fix flake by importing sources correctly (#797) 2020-08-04 17:26:56 +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
Tony O
c7e6531d2c
Fix flake overlay attr (#684)
Fix flake overlay attr

Solves the following error:

while evaluating the attribute 'overlays.combined-eval-on-build' at /nix/store/0gg5rsi7nvwlk2ky1w595qyjgwpqj35g-source/flake.nix:11:5:
value is a function while a set was expected, at /nix/store/0gg5rsi7nvwlk2ky1w595qyjgwpqj35g-source/flake.nix:10:15
2020-06-14 18:30:30 +08:00
Hamish Mackenzie
099d830db1
Update ghc 8.4.4 based tools to ghc 8.6.5 (#618)
Although the default ghc used by haskell.nix is ghc 8.6.5 many of
the tools used in haskell.nix are still built with the boot compiler
ghc 8.4.4.  These include

  * haskell-nix.cabal-install
  * haskell-nix.alex
  * haskell-nix.happy

This change updates those to ghc 8.6.5 and includes materializations
for the new versions.

When cabal-install is built it is careful to disable materialization
checks on the version of itself used during the build to avoid
infinite recursion.

There was a version of nix-tools built with the boot ghc which was
only used when `checkMaterialization = true`.  It was used for
the boot versions of alex, happy and hscolour.  These have been update
to use the default (ghc 8.6.5) version of nix-tools and
checkMaterialization is forced off when they are being used to build
ghc.  This means the materialization will only be checked for these
when they are built independently (they are included in the test set
via haskellNixRoots).

Three new arguments are added to `default.nix`:

* `defaultCompilerNixName` if not specified "ghc865" is used
* `checkMaterialization` makes it easier to switch on materialization checks
* `system` defaults to `builtins.currentSystem`

This change also moves the work needed for hydra eval to the eval
system using a new `evalPackages` feature.  This includes:

* Fetching from git with `fetchgit`
* Building scripts with `runCommand` and `writeTextFile`
* `git ls-files` in `cleanGit`
* running `cabal v2-configure`
* copying materialized files (we are not sure why this is necessary but
  if we do not `cp -r` the files nix will not load them on hydra)

Reduce size of `make-config-files.nix` strings by around 80%.
These are unlikely to be the cause of hydra eval time memory
issues in the GB range, but were still quite large (around 10MB for the
`cabal-simple` test case).

There was issue causing excessive builds of the `git` package when
cross compiling.  Gory details are a comment in `lib/defaults.nix`
but in short if you use `git` you need an extra `.buildPackages`
one is not enough because it depends on `gdb` and that will
be different in `buildPackages` compared to
`buildPackages.buildPackages`.

Adds missing materialization files for ghc 8.4.4 (only needed
when `checkMaterialization` is on because of other
materialiazations, but good to have).
2020-05-21 11:31:26 +12:00
Hamish Mackenzie
a2d97bd9ad
Flake (#589 and #567)
Allows haskell.nix to be used as a nix flake.

Authored-by: Alexander Bantyev <balsoft@balsoft.ru>
2020-05-07 11:16:38 +12:00