dhallDirectoryToNix: add this utility function
This commit is contained in:
parent
599e3c2e83
commit
69bbd81c62
25
pkgs/build-support/dhall/directory-to-nix.nix
Normal file
25
pkgs/build-support/dhall/directory-to-nix.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ dhallPackages, dhallPackageToNix}:
|
||||
|
||||
# `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.
|
||||
|
||||
{ src
|
||||
, # The file to import, relative to the src root directory
|
||||
file ? "package.dhall"
|
||||
}@args:
|
||||
|
||||
let
|
||||
generatedPkg = dhallPackages.generateDhallDirectoryPackage args;
|
||||
|
||||
builtPkg = dhallPackages.callPackage generatedPkg { };
|
||||
|
||||
in
|
||||
dhallPackageToNix builtPkg
|
|
@ -301,6 +301,8 @@ with pkgs;
|
|||
|
||||
crow-translate = libsForQt5.callPackage ../applications/misc/crow-translate { };
|
||||
|
||||
dhallDirectoryToNix = callPackage ../build-support/dhall/directory-to-nix.nix { };
|
||||
|
||||
dhallPackageToNix = callPackage ../build-support/dhall/package-to-nix.nix { };
|
||||
|
||||
dhallToNix = callPackage ../build-support/dhall/to-nix.nix { };
|
||||
|
|
Loading…
Reference in New Issue
Block a user