diff --git a/buildAndWatch b/buildAndWatch index bd140b0..6372065 100755 --- a/buildAndWatch +++ b/buildAndWatch @@ -12,7 +12,6 @@ function buildAndWatchWithNix() { exit 1 fi - export LC_ALL=C.UTF-8 # fix locale error with Hakyll (see #29) nix-build -A builder && \ ./result/bin/haskell-org-site clean && \ ./result/bin/haskell-org-site build && \ diff --git a/builder/site.hs b/builder/site.hs index c5869dd..45ac43b 100644 --- a/builder/site.hs +++ b/builder/site.hs @@ -1,11 +1,12 @@ -------------------------------------------------------------------------------- -{-# LANGUAGE TypeApplications #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} import Data.Aeson import qualified Data.ByteString.Lazy as BL import Data.Monoid ((<>)) import Data.Time.Calendar import Data.Time.Clock +import qualified GHC.IO.Encoding as Encoding import Hakyll import Hakyll.Core.Compiler import Hakyll.Core.Compiler.Internal @@ -13,56 +14,58 @@ import Hakyll.Core.Provider import System.FilePath.Posix import Testimonial - -------------------------------------------------------------------------------- main :: IO () -main = mkContext >>= \ctx -> hakyllWith configuration $ do - match "testimonials/logos/*" $ do - route idRoute - compile copyFileCompiler - - match "testimonials/*.yaml" $ do - compile parseTestimonialCompiler - - create ["testimonials.json"] $ do - route idRoute - compile $ do - testimonials <- loadAll @Testimonial "testimonials/*.yaml" - item <- (makeItem . BL.unpack . encode . map itemBody) testimonials - saveSnapshot "_final" item - pure item - - match "img/*" $ do - route idRoute - compile copyFileCompiler - - match "css/*" $ do - route idRoute - compile compressCssCompiler - - match "js/*" $ do - route idRoute - compile copyFileCompiler - - match "index.html" $ do - route idRoute - compile $ do - testimonials <- loadAll @Testimonial "testimonials/*.yaml" - let - indexCtx = listField "testimonials" testimonialContext (pure testimonials) `mappend` - ctx - defCompiler indexCtx - - match ("**/*.markdown" .||. "*.markdown") $ do - route cleanRoute - compile $ mdCompiler ctx - - match "*.pdf" $ do - route idRoute - compile copyFileCompiler - - match "templates/*" $ - compile templateCompiler +main = do + Encoding.setLocaleEncoding Encoding.utf8 + ctx <- mkContext + hakyllWith configuration $ do + match "testimonials/logos/*" $ do + route idRoute + compile copyFileCompiler + + match "testimonials/*.yaml" $ do + compile parseTestimonialCompiler + + create ["testimonials.json"] $ do + route idRoute + compile $ do + testimonials <- loadAll @Testimonial "testimonials/*.yaml" + item <- (makeItem . BL.unpack . encode . map itemBody) testimonials + saveSnapshot "_final" item + pure item + + match "img/*" $ do + route idRoute + compile copyFileCompiler + + match "css/*" $ do + route idRoute + compile compressCssCompiler + + match "js/*" $ do + route idRoute + compile copyFileCompiler + + match "index.html" $ do + route idRoute + compile $ do + testimonials <- loadAll @Testimonial "testimonials/*.yaml" + let + indexCtx = listField "testimonials" testimonialContext (pure testimonials) `mappend` + ctx + defCompiler indexCtx + + match ("**/*.markdown" .||. "*.markdown") $ do + route cleanRoute + compile $ mdCompiler ctx + + match "*.pdf" $ do + route idRoute + compile copyFileCompiler + + match "templates/*" $ + compile templateCompiler configuration :: Configuration diff --git a/default.nix b/default.nix index b60c3ac..10ac686 100644 --- a/default.nix +++ b/default.nix @@ -18,9 +18,6 @@ let ] ./.; buildInputs = [ builder pkgs.linkchecker ]; - LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; - LC_ALL = "C.UTF-8"; - buildPhase = '' ${builder}/bin/haskell-org-site build '';