about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--machines/profpatsch/shiki.nix4
-rw-r--r--pkgs/profpatsch/execline/e.nix18
2 files changed, 19 insertions, 3 deletions
diff --git a/machines/profpatsch/shiki.nix b/machines/profpatsch/shiki.nix
index e2b563f5..3fc11089 100644
--- a/machines/profpatsch/shiki.nix
+++ b/machines/profpatsch/shiki.nix
@@ -255,6 +255,10 @@ in {
         (texlive.combine { inherit (texlive) scheme-small pdfjam; })
         # move script/nix-cache-binary to here
         cdb
+        (pkgs.vuizvui.profpatsch.binify {
+          exe = pkgs.vuizvui.profpatsch.e;
+          name = "e";
+        })
         myPkgs.zoomboxed
       ];
     in systemPkgs ++ xPkgs ++ guiPkgs
diff --git a/pkgs/profpatsch/execline/e.nix b/pkgs/profpatsch/execline/e.nix
index ca72c6f0..96a8d401 100644
--- a/pkgs/profpatsch/execline/e.nix
+++ b/pkgs/profpatsch/execline/e.nix
@@ -2,23 +2,35 @@
 let
 
   bins = getBins pkgs.rlwrap [ "rlwrap" ]
-    // getBins pkgs.s6-portable-utils [ { use = "s6-cat"; as = "cat"; } ]
+    // getBins pkgs.s6-portable-utils [ { use = "s6-cat"; as = "cat"; } "s6-test" ]
     // getBins pkgs.execline [ "execlineb" ];
 
   # minimal execline shell
-  e =
+  shell =
     let
       prompt = [ "if" [ "printf" ''\e[0;33me>\e[0m '' ] ];
     in
-      writeExecline "e" {} ([
+      writeExecline "execline-shell" {} ([
         bins.rlwrap
           "--remember"
           "--quote-characters" "\""
           "--complete-filenames"
+          "--ansi-colour-aware"
       ] ++ prompt ++ [
         "forstdin" "-d\n" "cmd"
         "importas" "cmd" "cmd"
         "foreground" [ bins.execlineb "-Pc" "$cmd" ]
       ] ++ prompt);
 
+  # TODO: should definitely still pass a command line to rlwrap, because then it keeps the history!
+  e = writeExecline "e" { argMode = "env"; } [
+    # if there is no argument, we start the shell, else we call execlineb directly
+    "ifelse" [ "importas" "#" "#" bins.s6-test "$#" "=" "0" ]
+    [ shell ]
+    # call execlineb with the arguments as script
+    "backtick" "-i" "cmd" [ "dollarat" "-d" " " ]
+    "importas" "-ui" "cmd" "cmd"
+    bins.execlineb "-Pc" "$cmd"
+  ];
+
 in { inherit e; }