aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix
index 9303244eb885..039c50f06937 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix
+++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix
@@ -1,4 +1,4 @@
-{ dhall, haskell, lib, lndir, runCommand, writeText }:
+{ dhall, dhall-docs, haskell, lib, lndir, runCommand, writeText }:
{ name
@@ -31,6 +31,12 @@
# space within the Nix store, but if you set the following `source` option to
# `true` then the package will also include `source.dhall`.
, source ? false
+
+ # Directory to generate documentation for (i.e. as the `--input` option to the
+ # `dhall-docs` command.)
+ #
+ # If `null`, then no documentation is generated.
+, documentationRoot ? null
}:
let
@@ -42,8 +48,12 @@ let
cache = ".cache";
+ data = ".local/share";
+
cacheDhall = "${cache}/dhall";
+ dataDhall = "${data}/dhall";
+
sourceFile = "source.dhall";
in
@@ -71,4 +81,10 @@ in
echo "missing $SHA_HASH" > $out/binary.dhall
${lib.optionalString (!source) "rm $out/${sourceFile}"}
+
+ ${lib.optionalString (documentationRoot != null) ''
+ mkdir -p $out/${dataDhall}
+
+ XDG_DATA_HOME=$out/${data} ${dhall-docs}/bin/dhall-docs --input '${documentationRoot}' --output-link $out/docs
+ ''}
''