about summary refs log tree commit diff stats
path: root/home-manager/config/lf/commands/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--home-manager/config/lf/commands/default.nix21
1 files changed, 17 insertions, 4 deletions
diff --git a/home-manager/config/lf/commands/default.nix b/home-manager/config/lf/commands/default.nix
index a44db5ac..27bf01db 100644
--- a/home-manager/config/lf/commands/default.nix
+++ b/home-manager/config/lf/commands/default.nix
@@ -1,53 +1,61 @@
 {
   pkgs,
   sysLib,
+  shell_library,
+  system,
   ...
 }: let
   functionCall = {
     file,
     dependencies,
+    replacementStrings,
     ...
   }:
     sysLib.writeShellScriptWithLibraryAndKeepPath {
       name = "${builtins.baseNameOf file}";
       src = file;
       dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash coreutils;});
+      inherit replacementStrings;
     }
     + "/bin/${builtins.baseNameOf file}";
   shell = {
     file,
     dependencies,
+    replacementStrings ? null,
     ...
   }: ''
     ''${{
-      ${functionCall {inherit file dependencies;}}
+      ${functionCall {inherit file dependencies replacementStrings;}}
     }}
   ''; # closes the lf tui
   pipe = {
     file,
     dependencies,
+    replacementStrings ? null,
     ...
   }: ''
     %{{
-      ${functionCall {inherit file dependencies;}}
+      ${functionCall {inherit file dependencies replacementStrings;}}
     }}
   ''; # runs the command in the ui/term bar
   async = {
     file,
     dependencies,
+    replacementStrings ? null,
     ...
   }: ''
     &{{
-      ${functionCall {inherit file dependencies;}}
+      ${functionCall {inherit file dependencies replacementStrings;}}
     }}
   ''; # runs the command in the background
   wait = {
     file,
     dependencies,
+    replacementStrings ? null,
     ...
   }: ''
     !{{
-      ${functionCall {inherit file dependencies;}}
+      ${functionCall {inherit file dependencies replacementStrings;}}
     }}
   ''; # adds a prompt after the command has run
 in {
@@ -142,6 +150,9 @@ in {
   mk_scr = shell {
     file = ./scripts/mk_scr;
     dependencies = builtins.attrValues {inherit (pkgs) neovim;};
+    replacementStrings = {
+      SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}";
+    };
   };
   open = shell {
     file = ./scripts/open;
@@ -201,3 +212,5 @@ in {
     };
   };
 }
+# vim: ts=2
+