about summary refs log tree commit diff
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2022-05-05T22·31+0200
committerProfpatsch <mail@profpatsch.de>2022-05-05T22·43+0000
commit9dac44846696ccdd9cd60359b8ee864f4a20b3f1 (patch)
tree0b2ffff3092d0df6da143dd4ab39fa4ccc479a4e
parent12869cda7dae310ec3ab792873588cefd11f3306 (diff)
feat(users/Profpatsch/importDhall): print dhall command r/4011
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
-rw-r--r--users/Profpatsch/importDhall.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/users/Profpatsch/importDhall.nix b/users/Profpatsch/importDhall.nix
index bddfcc5b07..1947ad1ce1 100644
--- a/users/Profpatsch/importDhall.nix
+++ b/users/Profpatsch/importDhall.nix
@@ -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 \