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.nix207
1 files changed, 207 insertions, 0 deletions
diff --git a/home-manager/config/lf/commands/default.nix b/home-manager/config/lf/commands/default.nix
new file mode 100644
index 00000000..446466be
--- /dev/null
+++ b/home-manager/config/lf/commands/default.nix
@@ -0,0 +1,207 @@
+{
+  pkgs,
+  sysLib,
+  ...
+}: let
+  functionCall = {
+    file,
+    dependencies,
+    ...
+  }:
+    sysLib.makeShellScriptWithLibraryAndKeepPath {
+      name = "${builtins.baseNameOf file}";
+      script = file;
+      dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash coreutils;});
+    }
+    + "/bin/${builtins.baseNameOf file}";
+  shell = {
+    file,
+    dependencies,
+    ...
+  }: ''
+    ''${{
+      ${functionCall {inherit file dependencies;}}
+    }}
+  ''; # closes the lf tui
+  pipe = {
+    file,
+    dependencies,
+    ...
+  }: ''
+    %{{
+      ${functionCall {inherit file dependencies;}}
+    }}
+  ''; # runs the command in the ui/term bar
+  async = {
+    file,
+    dependencies,
+    ...
+  }: ''
+    &{{
+      ${functionCall {inherit file dependencies;}}
+    }}
+  ''; # runs the command in the background
+  wait = {
+    file,
+    dependencies,
+    ...
+  }: ''
+    !{{
+      ${functionCall {inherit file dependencies;}}
+    }}
+  ''; # adds a prompt after the command has run
+in {
+  archive = shell {
+    file = ./scripts/archive;
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        fzf
+        gnutar
+        xz
+        p7zip
+        zip
+        ;
+    };
+  };
+  broot_jump = shell {
+    file = ./scripts/broot_jump;
+    dependencies = builtins.attrValues {
+      inherit (pkgs) broot;
+    };
+  };
+  chmod = pipe {
+    file = ./scripts/chmod;
+    dependencies = [];
+  };
+  clear_trash = shell {
+    file = ./scripts/clear_trash;
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        fzf
+        trashy
+        ;
+    };
+  };
+  dl_file = pipe {
+    file = ./scripts/dl_file;
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        xdragon
+        curl
+        ;
+    };
+  };
+  dragon = pipe {
+    file = ./scripts/dragon;
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        xdragon
+        ;
+    };
+  };
+  dragon_individual = pipe {
+    file = ./scripts/dragon_individual;
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        xdragon
+        ;
+    };
+  };
+  dragon_stay = pipe {
+    file = ./scripts/dragon_stay;
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        xdragon
+        ;
+    };
+  };
+  fzf_jump = shell {
+    file = ./scripts/fzf_jump;
+    dependencies = builtins.attrValues {
+      inherit (pkgs) fzf lf gnused;
+    };
+  };
+  help = shell {
+    file = ./scripts/help;
+    dependencies = [];
+  };
+  mk_dir = pipe {
+    file = ./scripts/mk_dir;
+    dependencies = [];
+  };
+  mk_file = shell {
+    file = ./scripts/mk_file;
+    dependencies = [];
+  };
+  mk_ln = pipe {
+    file = ./scripts/mk_ln;
+    dependencies = [];
+  };
+  mk_scr = shell {
+    file = ./scripts/mk_scr;
+    dependencies = builtins.attrValues {inherit (pkgs) neovim;};
+  };
+  open = shell {
+    file = ./scripts/open;
+    dependencies = builtins.attrValues {inherit (pkgs) file xdg-utils neovim git;};
+  };
+  open_config = shell {
+    file = ./scripts/open_config;
+    dependencies = builtins.attrValues {
+      #inherit
+      #(pkgs)
+      ## TODO rewrite this:  bookmenu, https://github.com/jarun/buku
+      #
+      #buku
+      #;
+    };
+  };
+  restore_trash = shell {
+    file = ./scripts/restore_trash;
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        fzf
+        trashy
+        ;
+    };
+  };
+  set_wall_paper = pipe {
+    file = ./scripts/set_wall_paper;
+    dependencies = [];
+  };
+  stripspace = pipe {
+    file = ./scripts/stripspace;
+    dependencies = [];
+  };
+  trash = pipe {
+    file = ./scripts/trash;
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        trashy
+        trash-cli
+        findutils
+        ;
+    };
+  };
+  unarchive = pipe {
+    file = ./scripts/unarchive;
+    dependencies = builtins.attrValues {
+      inherit
+        (pkgs)
+        gnutar
+        unzip
+        # TODO this is unfree! unrar
+        
+        p7zip
+        ;
+    };
+  };
+}