blob: 0d6a9bf7059d2f7fb99c25666e43d47044127726 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
{-# LANGUAGE QuasiQuotes #-}
module WWW.Base
( baseConfig
, baseHakyll
, domain
, url
, wwwRoot
, myHakyllReaderOptions
, myHakyllWriterOptions
) where
import Prolog
import Hakyll
import System.Process
import Text.Pandoc.Options
import Network.URI
import Network.URI.Static
-- | mathematicaster.org
domain :: IsString s => s
domain = "mathematicaster.org"
url :: URI
url = [uri|https://mathematicaster.org/|]
-- | /var/www
wwwRoot :: IsString s => s
wwwRoot = "/var/www"
baseConfig :: FilePath -> Configuration
baseConfig p = defaultConfiguration
{ destinationDirectory = "output"
, storeDirectory = ".cache"
, tmpDirectory = ".cache/tmp"
, deploySite = \cfg -> rawSystem "rsync"
[ "-aP"
, "--delete-after"
, "--chown=nginx:nginx"
, destinationDirectory cfg <> "/"
, "root@" <> domain <> ":" <> wwwRoot <> "/" <> p
]
}
baseHakyll :: MonadIO m => FilePath -> Rules a -> m ()
baseHakyll p = liftIO . hakyllWith (baseConfig p)
myHakyllReaderOptions :: ReaderOptions
myHakyllReaderOptions = defaultHakyllReaderOptions
myHakyllWriterOptions :: WriterOptions
myHakyllWriterOptions = defaultHakyllWriterOptions
{ writerHTMLMathMethod = MathJax mempty
}
|