{ pkgs, lib, sysLib, config, ... }: let write_script = { name, path, dependencies, keep_path ? false, }: if keep_path then sysLib.writeShellScriptWithLibraryAndKeepPath { inherit name; src = ./scripts/${path}/${name}; dependencies = dependencies ++ [pkgs.dash]; } else sysLib.writeShellScriptWithLibrary { inherit name; src = ./scripts/${path}/${name}; dependencies = dependencies ++ [pkgs.dash]; }; aumo-scr = write_script { name = "aumo"; path = "apps"; dependencies = builtins.attrValues {inherit (pkgs) udisks gawk gnused gnugrep sudo;}; }; con2pdf-scr = sysLib.writeShellScriptWithLibrary { name = "con2pdf"; src = ./scripts/apps/con2pdf; dependencies = builtins.attrValues {inherit (pkgs) sane-backends imagemagick coreutils fd;}; generateCompletions = true; replacementStrings = { DEVICE_FUNCTION = # This is here, because escaping the whole function, to use it in the shell script # directly just isn't possible pkgs.writeText "DEVICE_FUNCTION" /* bash */ '' scanimage -L | awk 'BEGIN { FS = "`" } { gsub(/'.*/, "", $2); print $2 }' ''; }; }; screenshot_persistent-scr = write_script { name = "screenshot_persistent"; path = "small_functions"; keep_path = true; dependencies = builtins.attrValues { inherit (pkgs) grim slurp alacritty rofi libnotify lf # TODO: add llp ; }; }; screenshot_temporary-scr = write_script { name = "screenshot_temporary"; path = "small_functions"; dependencies = builtins.attrValues {inherit (pkgs) grim slurp wl-clipboard;}; }; neorg-scr = sysLib.writeShellScriptWithLibraryAndKeepPath { name = "neorg"; src = ./scripts/specific/neorg/neorg; dependencies = with pkgs; [ cocogitto git-crypt rofi libnotify ]; generateCompletions = true; replacementStrings = { DEFAULT_NEORG_PROJECT_DIR = config.programs.nixvim.plugins.neorg.modules."core.dirman".config.workspaces.projects; HOME_TASKRC = "${config.xdg.configHome}/task/home-manager-taskrc"; ALL_PROJECTS_NEWLINE = "${config.soispha.taskwarrior.projects.projects_newline}"; ALL_PROJECTS_COMMA = "${config.soispha.taskwarrior.projects.projects_comma}"; ALL_PROJECTS_PIPE = "${config.soispha.taskwarrior.projects.projects_pipe}"; ALL_WORKSPACES = "${lib.strings.concatStringsSep "|" (builtins.attrNames config.programs.nixvim.plugins.neorg.modules."core.dirman".config.workspaces)}"; ID_GENERATION_FUNCTION = "${sysLib.writeShellScriptWithLibrary { name = "neorg_id_function"; src = ./scripts/specific/neorg/neorg_id_function.sh; dependencies = with pkgs; [ taskwarrior gawk findutils # xargs ]; }}/bin/neorg_id_function"; # TODO: Replace the hard-coded path here with some reference <2023-10-20> TASK_PROJECT_FILE = "/home/soispha/repos/nix/nixos-config/hm/soispha/conf/taskwarrior/projects/default.nix"; }; }; update-sys-scr = write_script { name = "update-sys"; path = "small_functions"; dependencies = builtins.attrValues {inherit (pkgs) git git-crypt nixos-rebuild sudo openssh coreutils mktemp gnugrep gnused;}; }; fupdate-scr = write_script { name = "fupdate"; path = "apps"; keep_path = true; dependencies = builtins.attrValues { inherit (pkgs) dash nix gnugrep fd coreutils bat # used by batgrep gnused # required by batgrep git # needed to fetch through git git-crypt # needed to unlock git-crypted repos ; inherit (pkgs.bat-extras) batgrep; }; }; hibernate-scr = write_script { name = "hibernate"; path = "wrappers"; dependencies = builtins.attrValues { inherit (pkgs) systemd taskwarrior ; }; }; ll-scr = sysLib.writeShellScriptWithLibraryUnwrapped { name = "ll"; src = ./scripts/wrappers/ll; }; # TODO: this need to be replaced with a wayland alternative # llp-scr = write_script { # name = "llp"; # path = "wrappers"; # dependencies = builtins.attrValues {inherit (pkgs) lf ueberzug;}; # }; lock-scr = write_script { name = "lock"; path = "wrappers"; dependencies = builtins.attrValues { inherit (pkgs) taskwarrior swaylock ; }; }; lyrics-scr = write_script { name = "lyrics"; path = "wrappers"; dependencies = builtins.attrValues { inherit (pkgs) exiftool mpc-cli jq less locale # dependency of less ; }; }; mpc-rm-scr = write_script { name = "mpc-rm"; path = "wrappers"; dependencies = builtins.attrValues { inherit (pkgs) mpc-cli trash-cli ; }; }; spodi-scr = write_script { name = "spodi"; path = "wrappers"; dependencies = builtins.attrValues {inherit (pkgs) gawk expect spotdl fd coreutils;}; }; virsh-del-scr = write_script { name = "virsh-del"; path = "wrappers"; dependencies = builtins.attrValues {inherit (pkgs) libvirt;}; }; ytc-scr = write_script { name = "ytc"; path = "wrappers"; dependencies = builtins.attrValues { inherit (pkgs) jq yt-dlp ytcc csvtool mpv ffmpeg gnused gawk ; }; }; yti-scr = write_script { name = "yti"; path = "wrappers"; dependencies = builtins.attrValues {inherit (pkgs) gawk expect yt-dlp;}; }; yts-scr = write_script { name = "yts"; path = "wrappers"; keep_path = true; # We need neovim dependencies = builtins.attrValues { inherit (pkgs) ytcc jq gawk; inherit ytc-scr; }; }; in [ # llp-scr # TODO: see above aumo-scr con2pdf-scr fupdate-scr hibernate-scr ll-scr lock-scr lyrics-scr mpc-rm-scr neorg-scr screenshot_persistent-scr screenshot_temporary-scr spodi-scr update-sys-scr virsh-del-scr ytc-scr yti-scr yts-scr ]