{ pkgs, sysLib, shell_library, system, ... }: let functionCall = { name, dependencies, replacementStrings, ... }: sysLib.writeShellScript { inherit name; src = ./scripts/${name}.sh; keepPath = true; dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash coreutils;}); inherit replacementStrings; } + "/bin/${name}.sh"; shell = { name, dependencies, replacementStrings ? null, ... }: '' ''${{ ${functionCall {inherit name dependencies replacementStrings;}} }} ''; # closes the lf tui pipe = { name, dependencies, replacementStrings ? null, ... }: '' %{{ ${functionCall {inherit name dependencies replacementStrings;}} }} ''; # runs the command in the ui/term bar async = { name, dependencies, replacementStrings ? null, ... }: '' &{{ ${functionCall {inherit name dependencies replacementStrings;}} }} ''; # runs the command in the background wait = { name, dependencies, replacementStrings ? null, ... }: '' !{{ ${functionCall {inherit name dependencies replacementStrings;}} }} ''; # adds a prompt after the command has run in { archive = shell { name = "archive"; dependencies = builtins.attrValues { inherit (pkgs) fzf gnutar xz p7zip zip ; }; }; broot_jump = shell { name = "broot_jump"; dependencies = builtins.attrValues { inherit (pkgs) broot; }; }; chmod = pipe { name = "chmod"; dependencies = []; }; clear_trash = shell { name = "clear_trash"; dependencies = builtins.attrValues { inherit (pkgs) fzf trashy ; }; }; dl_file = pipe { name = "dl_file"; dependencies = builtins.attrValues { inherit (pkgs) xdragon curl ; }; }; dragon = pipe { name = "dragon"; dependencies = builtins.attrValues { inherit (pkgs) xdragon ; }; }; dragon_individual = pipe { name = "dragon_individual"; dependencies = builtins.attrValues { inherit (pkgs) xdragon ; }; }; dragon_stay = pipe { name = "dragon_stay"; dependencies = builtins.attrValues { inherit (pkgs) xdragon ; }; }; fzf_jump = shell { name = "fzf_jump"; dependencies = builtins.attrValues { inherit (pkgs) fzf lf gnused; }; }; mk_dir = pipe { name = "mk_dir"; dependencies = []; }; mk_file = shell { name = "mk_file"; dependencies = []; }; mk_file_and_edit = shell { name = "mk_file_and_edit"; dependencies = []; }; mk_ln = pipe { name = "mk_ln"; dependencies = []; }; mk_scr_default = shell { name = "mk_scr_default"; dependencies = builtins.attrValues {}; replacementStrings = { SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; }; }; mk_scr_temp = shell { name = "mk_scr_temp"; dependencies = builtins.attrValues {}; replacementStrings = { SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; TO_BE_SHELL_LIBRARY_PATH = "%SHELL_LIBRARY_PATH"; # replacement is not recursive }; }; open = shell { name = "open"; dependencies = builtins.attrValues {inherit (pkgs) file xdg-utils;}; }; go_project_base_directory = async { name = "go_project_root"; dependencies = []; }; open_config = shell { name = "open_config"; dependencies = builtins.attrValues { #inherit #(pkgs) ## TODO: rewrite this: bookmenu, https://github.com/jarun/buku # #buku #; }; }; restore_trash = shell { name = "restore_trash"; dependencies = builtins.attrValues { inherit (pkgs) fzf trashy ; }; }; set_wall_paper = pipe { name = "set_wall_paper"; dependencies = []; }; /* FIXME: The c code fails, when stdout/-in is piped. rename = '' %{{ ${lf_rename.packages."${system}".default}/bin/rename }} ''; */ stripspace = pipe { name = "stripspace"; dependencies = []; }; trash = pipe { name = "trash"; dependencies = builtins.attrValues { inherit (pkgs) trashy trash-cli findutils ; }; }; unarchive = pipe { name = "unarchive"; dependencies = builtins.attrValues { inherit (pkgs) gnutar unzip # TODO: this is unfree! unrar p7zip ; }; }; }