···1+{ dhallPackages, dhallPackageToNix}:
2+3+# `dhallDirectoryToNix is a utility function to take a directory of Dhall files
4+# and read them in as a Nix expression.
5+#
6+# This function is similar to `dhallToNix`, but takes a Nixpkgs Dhall package
7+# as input instead of raw Dhall code.
8+#
9+# Note that this uses "import from derivation" (IFD), meaning that Nix will
10+# perform a build during the evaluation phase if you use this
11+# `dhallDirectoryToNix` utility. It is not possible to use
12+# `dhallDirectoryToNix` in Nixpkgs, since the Nixpkgs Hydra doesn't allow IFD.
13+14+{ src
15+, # The file to import, relative to the src root directory
16+ file ? "package.dhall"
17+}@args:
18+19+let
20+ generatedPkg = dhallPackages.generateDhallDirectoryPackage args;
21+22+ builtPkg = dhallPackages.callPackage generatedPkg { };
23+24+in
25+ dhallPackageToNix builtPkg