3
0
Fork 0
forked from mirrors/nixpkgs
Commit graph

6 commits

Author SHA1 Message Date
Ellie Hermaszewska 15ae25f36c
haskell: switch from haskell.lib to haskell.lib.compose 2021-11-07 20:18:45 +08:00
Gabriel Gonzalez ef0a42347e
dhall: Use --base-import-url flag for documentation (#128588)
This updates `pkgs.dhallPackages.buildDhallGitHubPackage` to use the
newly added `--base-import-url` `dhall-docs` flag.  This flag is used
by the generated documentation so that paths copied to the clipboard
represent complete URLs that can be imported instead of only the
relative path to the import.
2021-06-29 19:09:29 -07:00
Gabriel Gonzalez 710038a5e6 Fix header for generated Dhall documentation
By default, `dhall-docs` uses the name of the input directory
as the initial component of the documentation header.  However,
since the input directory is built using Nix the header contains
the Nix store hash in the name, which then appears in the
generated documentation.

The fix is to override this default behavior by supplying the
`--package-name` flag to `dhall-docs`.
2021-01-14 09:50:44 +01:00
Gabriel Gonzalez 6dac8e6817 Add buildDhall*Package support for generating documentation
The `buildDhall{Directory,GitHub}Package` utilities now take an
optional `document` argument for generating documentation using
`dhall-docs`.  The documentation is stored underneath the `./docs`
subdirectory of the build product.
2020-12-01 15:30:52 +01:00
Gabriel Gonzalez 9f2dd99705 Upate buildDhallPackage to use default version of Dhall
Now that the default version is sufficiently new we don't need to
pin the Dhall version any longer in `buildDhallPackage`
2020-04-11 09:07:58 -07:00
Gabriel Gonzalez 38f1d70c01 Add Nixpkgs support for Dhall
One of the motivations for this change is the following Discourse
discussion:

https://discourse.dhall-lang.org/t/offline-use-of-prelude/137

Many users have requested Dhall support for "offline" packages
that can be fetched/built/installed using ordinary package
management tools (like Nix) instead of using Dhall's HTTP import system.
I will continue to use the term "offline" to mean Dhall package
builds that do not use Dhall's language support for HTTP imports (and
instead use the package manager's support for HTTP requests, such
as `pkgs.fetchFromGitHub`)

The goal of this change is to document what is the idiomatic way to
implement "offline" Dhall builds by implementing Nixpkgs support
for such builds.  That way when other package management tools ask
me how to package Dhall with their tools I can refer them to how it
is done in Nixpkgs.

This change contains a fully "offline" build for the largest Dhall
package in existence, known as "dhall-packages" (not to be confused
with `dhallPackages`, which is our Nix attribute set containing
Dhall packages).

The trick to implementing offline builds in Dhall is to take
advantage of Dhall's support for semantic integrity checks.  If an
HTTP import is protected by an integrity check and a cached build
product matches the integrity check then the HTTP import is never
resolved and the expression is instead fetched from cache.

By "installing" dependencies in a pre-seeded and isolated cache
we can replace remote HTTP imports with dependencies that have
been built and supplied by Nix instead.

The offline nature of the builds are enforced by compiling the
Haskell interpreter with the `-f-with-http` flag, which disables
the interpreter's support for HTTP imports.  If a user forgets
to supply a necessary dependency as a Nix build product then the
build fails informing them that HTTP imports are disabled.

By default, built packages are "binary distributions", containing
just a cache product and a Dhall expression which can be used to
resolve the corresponding cache product.

Users can also optionally enable a "source distribution" of a package
which already includes the equivalent fully-evaluated Dhall code (for
convenience), but this is disabled by default to keep `/nix/store`
utilization as compact as possible.
2020-02-11 22:02:53 -08:00