2024-06-30 08:12:46 +00:00
|
|
|
{ dhallPackages, dhallPackageToNix }:
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
# `dhallDirectoryToNix is a utility function to take a directory of Dhall files
|
|
|
|
# and read them in as a Nix expression.
|
|
|
|
#
|
|
|
|
# This function is similar to `dhallToNix`, but takes a Nixpkgs Dhall package
|
|
|
|
# as input instead of raw Dhall code.
|
|
|
|
#
|
|
|
|
# Note that this uses "import from derivation" (IFD), meaning that Nix will
|
|
|
|
# perform a build during the evaluation phase if you use this
|
|
|
|
# `dhallDirectoryToNix` utility. It is not possible to use
|
|
|
|
# `dhallDirectoryToNix` in Nixpkgs, since the Nixpkgs Hydra doesn't allow IFD.
|
|
|
|
|
2024-06-30 08:12:46 +00:00
|
|
|
{
|
|
|
|
src,
|
|
|
|
# The file to import, relative to the src root directory
|
|
|
|
file ? "package.dhall",
|
2024-05-02 00:46:19 +00:00
|
|
|
}@args:
|
|
|
|
|
|
|
|
let
|
|
|
|
generatedPkg = dhallPackages.generateDhallDirectoryPackage args;
|
|
|
|
|
|
|
|
builtPkg = dhallPackages.callPackage generatedPkg { };
|
|
|
|
|
|
|
|
in
|
2024-06-30 08:12:46 +00:00
|
|
|
dhallPackageToNix builtPkg
|