From 9dac44846696ccdd9cd60359b8ee864f4a20b3f1 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Fri, 6 May 2022 00:31:48 +0200 Subject: feat(users/Profpatsch/importDhall): print dhall command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: BuildkiteCI --- users/Profpatsch/importDhall.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'users/Profpatsch/importDhall.nix') diff --git a/users/Profpatsch/importDhall.nix b/users/Profpatsch/importDhall.nix index bddfcc5b072e..1947ad1ce123 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 \ -- cgit 1.4.1