nixpkgs/pkgs/tools/text/mb2md/default.nix
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00

40 lines
904 B
Nix

{ lib, stdenv, fetchurl, makeWrapper, perlPackages }:
let
perlDeps = with perlPackages; [ TimeDate ];
in
stdenv.mkDerivation rec {
version = "3.20";
pname = "mb2md";
src = fetchurl {
url = "http://batleth.sapienti-sat.org/projects/mb2md/mb2md-${version}.pl.gz";
sha256 = "0bvkky3c90738h3skd2f1b2yy5xzhl25cbh9w2dy97rs86ssjidg";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ perlPackages.perl ];
unpackPhase = ''
sourceRoot=.
gzip -d < $src > mb2md.pl
'';
installPhase = ''
install -D $sourceRoot/mb2md.pl $out/bin/mb2md
'';
postFixup = ''
wrapProgram $out/bin/mb2md \
--set PERL5LIB "${perlPackages.makePerlPath perlDeps}"
'';
meta = with lib; {
description = "mbox to maildir tool";
mainProgram = "mb2md";
license = licenses.publicDomain;
platforms = platforms.all;
maintainers = [ maintainers.jb55 ];
};
}