feat(users/Profpatsch/importDhall): print dhall command

It’s often not obvious what dhall command to run to (type)-check the
dhall files directly without the nix roundtrip.

Now we just print the command, easy to copy.

Change-Id: I704a647bff13f73d5a1b1d33b00a46bcb1a9de4e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5528
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
This commit is contained in:
Profpatsch 2022-05-06 00:31:48 +02:00
parent 12869cda7d
commit 9dac448466

View file

@ -24,15 +24,13 @@ let
type ? null
}:
let
absRoot = path: toString root + "/" + path;
src =
depot.users.Profpatsch.exactSource
root
# exactSource wants nix paths, but I think relative paths
# as strings are more intuitive.
(
let abs = path: toString root + "/" + path;
in ([ (abs main) ] ++ (map abs files))
);
([ (absRoot main) ] ++ (map absRoot files));
cache = ".cache";
cacheDhall = "${cache}/dhall";
@ -50,6 +48,12 @@ let
# go into the source directory, so that the type can import files.
# TODO: This is a bit of a hack hrm.
cd "${src}"
printf 'Generating dhall nix code. Run
%s --file %s
to reproduce
' \
${pkgs.dhall}/bin/dhall \
${absRoot main}
${if hadTypeAnnot then ''
printf '%s' ${lib.escapeShellArg "${src}/${main} ${typeAnnot}"} \
| ${pkgs.dhall-nix}/bin/dhall-to-nix \