1 { buildDhallPackage, fetchFromGitHub, lib }:
3 # This function is used by `dhall-to-nixpkgs` when given a GitHub repository
4 lib.makePackageOverridable
5 ( { # Arguments passed through to `buildDhallPackage`
10 , # The directory containing the Dhall files, if other than the root of the
13 , # The file to import, relative to the above directory
14 file ? "package.dhall"
15 # Set to `true` to generate documentation for the package
18 # Arguments passed through to `fetchFromGitHub`
22 # Extra arguments passed through to `fetchFromGitHub`, such as the hash
23 # or `fetchSubmodules`
28 versionedName = "${name}-${rev}";
30 src = fetchFromGitHub ({
31 name = "${versionedName}-source";
33 inherit owner repo rev;
34 } // removeAttrs args [
46 prefix = lib.optionalString (directory != "") "${directory}/";
50 ( { inherit dependencies source;
54 code = "${src}/${prefix}${file}";
56 // lib.optionalAttrs document
57 { documentationRoot = "${src}/${prefix}"; }