diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2019-11-24 20:06:28 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2019-11-24 20:06:28 +0100 |
commit | f28f4fc1bef6ebabb9c340c3fdfb92eee1423c5c (patch) | |
tree | 866bf3a0b3f0d67d5b3867a75f479018b95e3d0d | |
parent | a7f511e7c9e8099db097d58c4fa6775766850c56 (diff) | |
download | utils-f28f4fc1bef6ebabb9c340c3fdfb92eee1423c5c.tar utils-f28f4fc1bef6ebabb9c340c3fdfb92eee1423c5c.tar.gz utils-f28f4fc1bef6ebabb9c340c3fdfb92eee1423c5c.tar.bz2 utils-f28f4fc1bef6ebabb9c340c3fdfb92eee1423c5c.tar.xz utils-f28f4fc1bef6ebabb9c340c3fdfb92eee1423c5c.zip |
notmuch-tcp
-rw-r--r-- | nix/default.nix | 1 | ||||
-rw-r--r-- | nix/notmuch-tcp.nix | 22 | ||||
-rwxr-xr-x | notmuch-tcp | 9 |
3 files changed, 32 insertions, 0 deletions
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: | |||
7 | monitor-uucp = self.callPackage ./monitor-uucp.nix {}; | 7 | monitor-uucp = self.callPackage ./monitor-uucp.nix {}; |
8 | rolling-directory = self.callPackage ./rolling-directory.nix {}; | 8 | rolling-directory = self.callPackage ./rolling-directory.nix {}; |
9 | recv = self.callPackage ./recv.nix {}; | 9 | recv = self.callPackage ./recv.nix {}; |
10 | notmuch-tcp = self.callPackage ./notmuch-tcp.nix {}; | ||
10 | } | 11 | } |
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 @@ | |||
1 | { stdenv | ||
2 | , zsh, socat, nettools | ||
3 | }: | ||
4 | |||
5 | stdenv.mkDerivation rec { | ||
6 | pname = "notmuch-tcp"; | ||
7 | version = "0.1"; | ||
8 | src = ../notmuch-tcp; | ||
9 | |||
10 | phases = [ "buildPhase" "installPhase" ]; | ||
11 | |||
12 | inherit zsh socat nettools; | ||
13 | |||
14 | buildPhase = '' | ||
15 | substituteAll $src notmuch-tcp | ||
16 | ''; | ||
17 | |||
18 | installPhase = '' | ||
19 | install -m 0755 -D -t $out/bin \ | ||
20 | notmuch-tcp | ||
21 | ''; | ||
22 | } | ||
diff --git a/notmuch-tcp b/notmuch-tcp new file mode 100755 index 0000000..71680d0 --- /dev/null +++ b/notmuch-tcp | |||
@@ -0,0 +1,9 @@ | |||
1 | #!@zsh@/bin/zsh | ||
2 | |||
3 | NOTMUCH_TCP=${NOTMUCH_TCP:-2010} | ||
4 | HOST=${HOST:-$(@nettools/bin/hostname -s)} | ||
5 | NOTMUCH_HOST=${NOTMUCH_HOST:-odin.asgard.yggdrasil} | ||
6 | |||
7 | cd ~/.notmuch-tcp | ||
8 | |||
9 | @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}") | ||