diff options
author | sterni <sternenseemann@systemli.org> | 2022-06-01T10·27+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-06-01T10·32+0000 |
commit | 89f3f0a5dc710c891a422d530c18a58aa2d336fb (patch) | |
tree | feb9e95a6c3e9ea6ca8dd7d94e3757ca0787564a | |
parent | ae422c13534d62aae68f06e5e02028dbe6884e33 (diff) |
feat(tools/magrathea): add repl command r/4199
`mg repl` is essentially a shortcut for nix repl $(mg path //) which comes up often enough for me. Launching a repl only really makes sense in the repository root with how readTree works at the moment, so I think this is a convenient addition. Change-Id: I32b695885c2e6eaecdcc656c7249afa504439913 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5822 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
-rw-r--r-- | tools/magrathea/mg.scm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/magrathea/mg.scm b/tools/magrathea/mg.scm index cbbcfc69dd57..ab8e5bb77e02 100644 --- a/tools/magrathea/mg.scm +++ b/tools/magrathea/mg.scm @@ -39,6 +39,7 @@ commands: build - build a target shell - enter a shell with the target's build dependencies path - print source folder for the target + repl - start a nix repl in the repository root run - build a target and execute its output file all feedback on b.tvl.fyi @@ -289,6 +290,9 @@ if you meant to pass these arguments to nix, please separate them with (guarantee-success (parse-target arg)))] [other (print "not yet implemented")])) +(define (repl args) + (process-execute "nix" (append (list "repl" "--show-trace" (repository-root)) args))) + (define (execute-run t #!optional cmd-args) (fprintf (current-error-port) "[mg] building target ~A~%" t) (let* ((expr (nix-expr-for t)) @@ -352,6 +356,7 @@ if you meant to pass these arguments to nix, please separate them with [("build" . _) (build (cdr args))] [("shell" . _) (shell (cdr args))] [("path" . _) (path (cdr args))] + [("repl" . _) (repl (cdr args))] [("run" . _) (run (cdr args))] [other (begin (print "unknown command: mg " args) (print usage))])) |