summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ymir/mlmmj-expose.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/ymir/mlmmj-expose.nix b/ymir/mlmmj-expose.nix
index 2158cd35..6dc808e3 100644
--- a/ymir/mlmmj-expose.nix
+++ b/ymir/mlmmj-expose.nix
@@ -26,6 +26,7 @@ let
26 import qualified Data.ByteString.Lazy as LBS 26 import qualified Data.ByteString.Lazy as LBS
27 import qualified Data.ByteString.Lazy.Char8 as CLBS 27 import qualified Data.ByteString.Lazy.Char8 as CLBS
28 import qualified Data.ByteString as BS 28 import qualified Data.ByteString as BS
29 import qualified Data.ByteString.Char8 as CBS
29 30
30 import qualified Data.ByteString.Base64 as Base64 31 import qualified Data.ByteString.Base64 as Base64
31 32
@@ -36,7 +37,7 @@ let
36 "mlmmj-exposed" -> do 37 "mlmmj-exposed" -> do
37 args <- getArgs 38 args <- getArgs
38 case args of 39 case args of
39 [listDir, (Base64.decodeLenient -> extension)] -> do 40 [listDir, (LBS.fromStrict . Base64.decodeLenient . CBS.pack -> extension)] -> do
40 setCurrentDirectory listDir 41 setCurrentDirectory listDir
41 key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e) 42 key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e)
42 let ((map toLower -> ident), (map toLower -> recipient)) = read . CLBS.unpack $ decryptMsg CBC key extension 43 let ((map toLower -> ident), (map toLower -> recipient)) = read . CLBS.unpack $ decryptMsg CBC key extension
@@ -74,7 +75,7 @@ let
74 getSubscribers :: IO [String] 75 getSubscribers :: IO [String]
75 getSubscribers = map (map toLower) . concat <$> mapM (flip catchIOError (\e -> if isDoesNotExistError e then return [] else ioError e) . readDir) ["subscribers.d", "digesters.d"] 76 getSubscribers = map (map toLower) . concat <$> mapM (flip catchIOError (\e -> if isDoesNotExistError e then return [] else ioError e) . readDir) ["subscribers.d", "digesters.d"]
76 where 77 where
77 readDir dir = concat <$> mapM (fmap lines . readFile) =<< (getDirectoryContents dir) 78 readDir dir = concat <$> (mapM (fmap lines . readFile) =<< (getDirectoryContents dir))
78 ''; 79 '';
79 buildCommand = '' 80 buildCommand = ''
80 mkdir -p $out/bin 81 mkdir -p $out/bin