nixpkgs-ml-tools

nixpkgs mailing list tools
git clone git://git.jb55.com/nixpkgs-ml-tools
Log | Files | Refs | README | LICENSE

commit aa458373de07e99baf00dd9f9ffbe71d42097739
Author: William Casarin <jb55@jb55.com>
Date:   Mon,  8 Feb 2021 09:01:13 -0800

Initial commit

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
AMakefile | 6++++++
Adefault.nix | 28++++++++++++++++++++++++++++
Anotmuch-am | 7+++++++
3 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,6 @@ + +BINS=notmuch-am + +install: + mkdir -p $(PREFIX)/bin + cp $(BINS) $(PREFIX)/bin diff --git a/default.nix b/default.nix @@ -0,0 +1,28 @@ +{ pkgs ? import <nixpkgs> {} }: + +let drv = + +{ lib, stdenv, b4, notmuch, makeWrapper }: +let paths = lib.makeBinPath [ b4 notmuch ]; +in +stdenv.mkDerivation { + name = "nixpkgs-ml-tools"; + version = "0.1"; + + src = ./.; + + nativeBuildInputs = [ makeWrapper ]; + + makeFlags = [ "PREFIX=$(out)" ]; + + postInstall = '' + bins="$(find $out/bin -type f -executable -print)" + for bin in $bins + do + patchShebangs "$bin" + wrapProgram "$bin" --prefix PATH : "${paths}" + done + ''; +}; + +in pkgs.callPackage drv {} diff --git a/notmuch-am b/notmuch-am @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +mbox=$(mktemp) +notmuch show --format=mbox "$1" > "$mbox" +msgid=$(grep -i ^message-id "$mbox" | cut -d" " -f2 | head -n1) +b4 am "$msgid" -m "$mbox" +rm -f "$mbox"