From cbab195e1fd119be75cf81469f46bd0cd8e901c1 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 23 Nov 2021 20:36:54 +0100 Subject: purebred-email: init at 0.4.3 --- krebs/5pkgs/haskell/purebred-email/default.nix | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 krebs/5pkgs/haskell/purebred-email/default.nix (limited to 'krebs/5pkgs/haskell') diff --git a/krebs/5pkgs/haskell/purebred-email/default.nix b/krebs/5pkgs/haskell/purebred-email/default.nix new file mode 100644 index 000000000..f781e820e --- /dev/null +++ b/krebs/5pkgs/haskell/purebred-email/default.nix @@ -0,0 +1,31 @@ +{ mkDerivation, attoparsec, base, base64-bytestring, bytestring +, case-insensitive, concise, deepseq, fetchgit, hedgehog, lens, lib +, QuickCheck, quickcheck-instances, semigroupoids, semigroups +, stringsearch, tasty, tasty-golden, tasty-hedgehog, tasty-hunit +, tasty-quickcheck, text, time +}: +mkDerivation { + pname = "purebred-email"; + version = "0.4.3"; + src = fetchgit { + url = "https://github.com/purebred-mua/purebred-email"; + sha256 = "06xhccavrdzfsvg65mzdnp0a7b1ilk2rqpnyvkr171ir6mqdpb19"; + rev = "769b360643f699c0a8cd6f1c3a3de36cf0479834"; + fetchSubmodules = true; + }; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + attoparsec base base64-bytestring bytestring case-insensitive + concise deepseq lens semigroupoids semigroups stringsearch text + time + ]; + testHaskellDepends = [ + attoparsec base bytestring case-insensitive hedgehog lens + QuickCheck quickcheck-instances semigroups tasty tasty-golden + tasty-hedgehog tasty-hunit tasty-quickcheck text time + ]; + homepage = "https://github.com/purebred-mua/purebred-email"; + description = "types and parser for email messages (including MIME)"; + license = lib.licenses.agpl3Plus; +} -- cgit v1.2.3 From 6cf266885df32090f4df528fb0a14e1676397566 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 23 Nov 2021 20:39:13 +0100 Subject: purebred-email: don't implicitly add MIME-Version --- krebs/5pkgs/haskell/purebred-email/default.nix | 3 + .../untweak-mime-version-header.patch | 65 ++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 krebs/5pkgs/haskell/purebred-email/untweak-mime-version-header.patch (limited to 'krebs/5pkgs/haskell') diff --git a/krebs/5pkgs/haskell/purebred-email/default.nix b/krebs/5pkgs/haskell/purebred-email/default.nix index f781e820e..ebf315388 100644 --- a/krebs/5pkgs/haskell/purebred-email/default.nix +++ b/krebs/5pkgs/haskell/purebred-email/default.nix @@ -13,6 +13,9 @@ mkDerivation { rev = "769b360643f699c0a8cd6f1c3a3de36cf0479834"; fetchSubmodules = true; }; + patches = [ + ./untweak-mime-version-header.patch + ]; isLibrary = true; isExecutable = true; libraryHaskellDepends = [ diff --git a/krebs/5pkgs/haskell/purebred-email/untweak-mime-version-header.patch b/krebs/5pkgs/haskell/purebred-email/untweak-mime-version-header.patch new file mode 100644 index 000000000..97baf7ac1 --- /dev/null +++ b/krebs/5pkgs/haskell/purebred-email/untweak-mime-version-header.patch @@ -0,0 +1,65 @@ +diff --git a/src/Data/MIME.hs b/src/Data/MIME.hs +index 19af53e..be8cbd4 100644 +--- a/src/Data/MIME.hs ++++ b/src/Data/MIME.hs +@@ -810,7 +810,6 @@ multipart takeTillEnd boundary = + -- | Sets the @MIME-Version: 1.0@ header. + -- + instance RenderMessage MIME where +- tweakHeaders = set (headers . at "MIME-Version") (Just "1.0") + buildBody h z = Just $ case z of + Part partbody -> Builder.byteString partbody + Encapsulated msg -> buildMessage msg +diff --git a/tests/Generator.hs b/tests/Generator.hs +index 9e1f166..23bd122 100644 +--- a/tests/Generator.hs ++++ b/tests/Generator.hs +@@ -64,7 +64,7 @@ exampleMailsParseSuccessfully = + textPlain7bit :: MIMEMessage + textPlain7bit = + let m = createTextPlainMessage "This is a simple mail." +- in over headers (\(Headers xs) -> Headers $ (CI.mk "Subject", "Hello there") : xs) m ++ in over headers (\(Headers xs) -> Headers $ (CI.mk "MIME-Version", "1.0") : (CI.mk "Subject", "Hello there") : xs) m + + multiPartMail :: MIMEMessage + multiPartMail = +@@ -72,13 +72,16 @@ multiPartMail = + to' = Single $ Mailbox Nothing (AddrSpec "bar" (DomainDotAtom $ pure "bar.com")) + subject = "Hello there" + p = createTextPlainMessage "This is a simple mail." ++ & set (headers . at "MIME-Version") (Just "1.0") + a = createAttachment + contentTypeApplicationOctetStream + (Just "foo.bin") + "fileContentsASDF" ++ & set (headers . at "MIME-Version") (Just "1.0") + now = UTCTime (ModifiedJulianDay 123) (secondsToDiffTime 123) + in createMultipartMixedMessage "asdf" (fromList [p, a]) +- & set (headers . at "From") (Just $ renderMailboxes [from']) ++ & set (headers . at "MIME-Version") (Just "1.0") ++ . set (headers . at "From") (Just $ renderMailboxes [from']) + . set (headers . at "To") (Just $ renderAddresses [to']) + . set (headers . at "Date") (Just $ renderRFC5422Date now) + . set (headers . at "Subject") (Just $ T.encodeUtf8 subject) +diff --git a/tests/Message.hs b/tests/Message.hs +index 6711519..3e40397 100644 +--- a/tests/Message.hs ++++ b/tests/Message.hs +@@ -29,7 +29,7 @@ import Data.Char (isPrint) + import Data.Foldable (fold) + import Data.List.NonEmpty (NonEmpty(..), intersperse) + +-import Control.Lens (set, view) ++import Control.Lens ((&), at, set, view) + import qualified Data.ByteString as B + import qualified Data.Text as T + +@@ -99,7 +99,7 @@ genMessage = Gen.choice [ genTextPlain, genMultipart, encapsulate <$> genMessage + prop_messageRoundTrip :: Property + prop_messageRoundTrip = property $ do + msg <- forAll genMessage +- parse (message mime) (renderMessage msg) === Right msg ++ parse (message mime) (renderMessage $ msg & set (headers . at "MIME-Version") (Just "1.0")) === Right msg + + prop_messageFromRoundTrip :: Property + prop_messageFromRoundTrip = property $ do -- cgit v1.2.3 From 2b774a4866ad4c0d961b4a6e637027a928bcf500 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 23 Nov 2021 20:02:59 +0100 Subject: mailaids: init from tv --- krebs/5pkgs/haskell/mailaids.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 krebs/5pkgs/haskell/mailaids.nix (limited to 'krebs/5pkgs/haskell') diff --git a/krebs/5pkgs/haskell/mailaids.nix b/krebs/5pkgs/haskell/mailaids.nix new file mode 100644 index 000000000..f152a76f4 --- /dev/null +++ b/krebs/5pkgs/haskell/mailaids.nix @@ -0,0 +1,21 @@ +{ mkDerivation, aeson, aeson-pretty, base, bytestring +, case-insensitive, fetchgit, lens, optparse-applicative +, purebred-email, lib, text, vector, word8 +}: +mkDerivation { + pname = "mailaids"; + version = "1.0.0"; + src = fetchgit { + url = "https://cgit.krebsco.de/mailaids"; + sha256 = "15h0k82czm89gkwhp1rwdy77jz8dmb626qdz7c2narvz9j7169v5"; + rev = "8f11927ea74d6adb332c884502ebd9c486837523"; + fetchSubmodules = true; + }; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + aeson aeson-pretty base bytestring case-insensitive lens + optparse-applicative purebred-email text vector word8 + ]; + license = lib.licenses.mit; +} -- cgit v1.2.3