diff --git a/packages/scripts/default.nix b/packages/scripts/default.nix index 6e248bc..921392c 100644 --- a/packages/scripts/default.nix +++ b/packages/scripts/default.nix @@ -42,20 +42,30 @@ in rec { ${pkgs.coreutils}/bin/printf '%s\n' 'nameserver 1.1.1.1' 'options edns0' > /etc/resolv.conf ''; - much-scripts = pkgs.symlinkJoin { + much-scripts = let + much-current-query = wrapScript { + packages = [ pkgs.curl ]; + name = "much-current-query"; + script = ./much-current-query.sh; + }; + mail-send = wrapScript { + packages = [ pkgs.notmuch pkgs.msmtp pkgs.jq ]; + name = "mail-send"; + script = ./mail-send.sh; + }; + mail-reply = wrapScript { + packages = [ much-current-query pkgs.notmuch pkgs.gnused pkgs.jq ]; + name = "mail-reply"; + script = ./mail-reply.sh; + }; + mail-kill = wrapScript { + name = "mail-kill"; + script = ./mail-kill.sh; + packages = [ pkgs.notmuch ]; + }; + in pkgs.symlinkJoin { name = "much-scripts"; - paths = [ - (wrapScript { - packages = [ pkgs.notmuch pkgs.msmtp pkgs.jq ]; - name = "mail-send"; - script = ./mail-send.sh; - }) - (wrapScript { - name = "mail-kill"; - script = ./mail-kill.sh; - packages = [ pkgs.notmuch ]; - }) - ]; + paths = [ mail-send much-current-query mail-reply mail-kill ]; }; showkeys-toggle = pkgs.writers.writeDashBin "showkeys-toggle" '' diff --git a/.bin/mail-reply b/packages/scripts/mail-reply.sh similarity index 97% rename from .bin/mail-reply rename to packages/scripts/mail-reply.sh index 2e3d2b7..220e1de 100755 --- a/.bin/mail-reply +++ b/packages/scripts/mail-reply.sh @@ -1,7 +1,7 @@ #! /bin/sh set -efu -reply_to=$(mail-current-query) +reply_to=$(much-current-query) if ! test "$(notmuch search --output=messages "$reply_to" | wc -l)" = 1; then echo "current query doesn't point to exactly one message. abort." >&2 diff --git a/packages/scripts/mail-send.sh b/packages/scripts/mail-send.sh index 1edbe6b..3507300 100755 --- a/packages/scripts/mail-send.sh +++ b/packages/scripts/mail-send.sh @@ -41,8 +41,7 @@ mail=$( printf %s "$mail" | msmtpq --read-recipients --read-envelope-from -# insertion is done upstream (by gmail, posteo, and the like) -# printf %s "$mail" | notmuch insert +printf %s "$mail" | notmuch insert if in_reply_to=$(printf %s "$mail" | get_in_reply_to); then if test "$(notmuch search --output=messages "id:$in_reply_to")" != "id:$in_reply_to"; then diff --git a/.bin/mail-current-query b/packages/scripts/much-current-query.sh similarity index 100% rename from .bin/mail-current-query rename to packages/scripts/much-current-query.sh