From f28f4fc1bef6ebabb9c340c3fdfb92eee1423c5c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 24 Nov 2019 20:06:28 +0100 Subject: notmuch-tcp --- nix/default.nix | 1 + nix/notmuch-tcp.nix | 22 ++++++++++++++++++++++ notmuch-tcp | 9 +++++++++ 3 files changed, 32 insertions(+) create mode 100644 nix/notmuch-tcp.nix create mode 100755 notmuch-tcp diff --git a/nix/default.nix b/nix/default.nix index b872f6a..cef8800 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -7,4 +7,5 @@ self: super: monitor-uucp = self.callPackage ./monitor-uucp.nix {}; rolling-directory = self.callPackage ./rolling-directory.nix {}; recv = self.callPackage ./recv.nix {}; + notmuch-tcp = self.callPackage ./notmuch-tcp.nix {}; } diff --git a/nix/notmuch-tcp.nix b/nix/notmuch-tcp.nix new file mode 100644 index 0000000..438a086 --- /dev/null +++ b/nix/notmuch-tcp.nix @@ -0,0 +1,22 @@ +{ stdenv +, zsh, socat, nettools +}: + +stdenv.mkDerivation rec { + pname = "notmuch-tcp"; + version = "0.1"; + src = ../notmuch-tcp; + + phases = [ "buildPhase" "installPhase" ]; + + inherit zsh socat nettools; + + buildPhase = '' + substituteAll $src notmuch-tcp + ''; + + installPhase = '' + install -m 0755 -D -t $out/bin \ + notmuch-tcp + ''; +} diff --git a/notmuch-tcp b/notmuch-tcp new file mode 100755 index 0000000..71680d0 --- /dev/null +++ b/notmuch-tcp @@ -0,0 +1,9 @@ +#!@zsh@/bin/zsh + +NOTMUCH_TCP=${NOTMUCH_TCP:-2010} +HOST=${HOST:-$(@nettools/bin/hostname -s)} +NOTMUCH_HOST=${NOTMUCH_HOST:-odin.asgard.yggdrasil} + +cd ~/.notmuch-tcp + +@socat@/bin/socat STDIO,ignoreeof openssl:${NOTMUCH_HOST}:${NOTMUCH_TCP},verify=1,cafile=ca.pem,certificate=${HOST}.pem,key=${HOST}.key <<(print "${(@q)@}"; inp=$(cat); printf "%d\n" $(wc -c <<<"${inp}"); cat <<<"${inp}") -- cgit v1.2.3