anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / development / interpreters / dhall / generate-dhall-directory-package.nix
blob8ece89ef4f4857883fe46a3922abd3a4f8c31862
1 { dhall-nixpkgs, lib, stdenv }:
3 # This function calls `dhall-to-nixpkgs directory --fixed-output-derivations`
4 # within a Nix derivation.
6 # This is possible because
7 # `dhall-to-nixpkgs directory --fixed-output-derivations` will turn remote
8 # Dhall imports protected with Dhall integrity checksinto fixed-output
9 # derivations (with the `buildDhallUrl` function), so no unrestricted network
10 # access is necessary.
11 lib.makePackageOverridable
12   ( { src
13     , # The file to import, relative to the root directory
14       file ? "package.dhall"
15     , # Set to `true` to generate documentation for the package
16       document ? false
17     }:
18     stdenv.mkDerivation {
19       name = "dhall-directory-package.nix";
21       buildCommand = ''
22         dhall-to-nixpkgs directory --fixed-output-derivations --file "${file}" "${src}" ${lib.optionalString document "--document"} > $out
23       '';
25       nativeBuildInputs = [ dhall-nixpkgs ];
26     }
27   )