{
pkgs,
sysLib,
shell_library,
system,
lf_rename,
...
}: 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 replacementStrings;}}
}}
''; # closes the lf tui
pipe = {
file,
dependencies,
replacementStrings ? null,
...
}: ''
%{{
${functionCall {inherit file dependencies replacementStrings;}}
}}
''; # runs the command in the ui/term bar
async = {
file,
dependencies,
replacementStrings ? null,
...
}: ''
&{{
${functionCall {inherit file dependencies replacementStrings;}}
}}
''; # runs the command in the background
wait = {
file,
dependencies,
replacementStrings ? null,
...
}: ''
!{{
${functionCall {inherit file dependencies replacementStrings;}}
}}
''; # 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;
};
};
mk_dir = pipe {
file = ./scripts/mk_dir;
dependencies = [];
};
mk_file = shell {
file = ./scripts/mk_file;
dependencies = [];
};
mk_file_and_edit = shell {
file = ./scripts/mk_file_and_edit;
dependencies = [];
};
mk_ln = pipe {
file = ./scripts/mk_ln;
dependencies = [];
};
mk_scr_default = shell {
file = ./scripts/mk_scr_default;
dependencies = builtins.attrValues {};
replacementStrings = {
SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}";
};
};
mk_scr_temp = shell {
file = ./scripts/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 {
file = ./scripts/open;
dependencies = builtins.attrValues {inherit (pkgs) file xdg-utils;};
};
go_project_base_directory = async {
file = ./scripts/go_project_root;
dependencies = [];
};
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 = [];
};
/*
FIXME:
The c code fails, when stdout/-in is piped.
rename = ''
%{{
${lf_rename.packages."${system}".default}/bin/rename
}}
'';
*/
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
;
};
};
}