Disable ormolu for hakyll DSL-y code; only bring in a stylesheet if we have one
This commit is contained in:
parent
9244c2e20f
commit
8cec937b86
9 changed files with 70 additions and 56 deletions
|
@ -1,3 +1,3 @@
|
|||
{ pkgs }:
|
||||
|
||||
(pkgs.callPackage ./hpkgs.nix {}).my-site
|
||||
(pkgs.callPackage ./hpkgs.nix { }).hakyll-nix-template
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
cabal-version: 2.4
|
||||
|
||||
name: my-site
|
||||
name: hakyll-nix-template
|
||||
version: 0.1.0.0
|
||||
build-type: Simple
|
||||
license: BSD-3-Clause
|
|
@ -1,7 +1,6 @@
|
|||
{ compiler ? "ghc884"
|
||||
, pkgs
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs.lib.trivial) flip pipe;
|
||||
inherit (pkgs.haskell.lib) appendPatch appendConfigureFlags dontCheck;
|
||||
|
@ -18,13 +17,15 @@ let
|
|||
(flip appendConfigureFlags hakyllFlags)
|
||||
];
|
||||
|
||||
my-site = hpNew.callCabal2nix "my-site" ./. {};
|
||||
hakyll-nix-template = hpNew.callCabal2nix "hakyll-nix-template" ./. { };
|
||||
|
||||
# because hakyll is marked as broken in nixpkgs
|
||||
hslua = dontCheck (hpNew.callHackage "hslua" "1.0.3.2" {});
|
||||
jira-wiki-markup = dontCheck (hpNew.callHackage "jira-wiki-markup" "1.1.4" {});
|
||||
pandoc = dontCheck (hpNew.callHackage "pandoc" "2.9.2.1" {});
|
||||
pandoc-types = dontCheck (hpNew.callHackage "pandoc-types" "1.20" {});
|
||||
# when hakyll is marked as broken in nixpkgs
|
||||
# because of version issues, fix them here:
|
||||
|
||||
hslua = dontCheck (hpNew.callHackage "hslua" "1.0.3.2" { });
|
||||
jira-wiki-markup = dontCheck (hpNew.callHackage "jira-wiki-markup" "1.1.4" { });
|
||||
pandoc = dontCheck (hpNew.callHackage "pandoc" "2.9.2.1" { });
|
||||
pandoc-types = dontCheck (hpNew.callHackage "pandoc-types" "1.20" { });
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
let
|
||||
cfg = import ../nix/default.nix {};
|
||||
cfg = import ../nix/default.nix { };
|
||||
hp = cfg.haskellPackages;
|
||||
in
|
||||
{}:
|
||||
|
||||
hp.shellFor {
|
||||
packages = p: [
|
||||
p.my-site
|
||||
];
|
||||
hp.shellFor {
|
||||
packages = p: [
|
||||
p.hakyll-nix-template
|
||||
];
|
||||
|
||||
buildInputs = with hp; [
|
||||
cabal-install
|
||||
ghcid
|
||||
hlint
|
||||
hp.my-site
|
||||
ormolu
|
||||
];
|
||||
buildInputs = with hp; [
|
||||
cabal-install
|
||||
ghcid
|
||||
hlint
|
||||
hp.hakyll-nix-template
|
||||
ormolu
|
||||
];
|
||||
|
||||
withHoogle = true;
|
||||
}
|
||||
withHoogle = true;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ config =
|
|||
|
||||
-- BUILD
|
||||
|
||||
{- ORMOLU_DISABLE -}
|
||||
|
||||
main :: IO ()
|
||||
main = hakyllWith config $ do
|
||||
forM_
|
||||
|
@ -57,6 +59,7 @@ main = hakyllWith config $ do
|
|||
match "css/*" $ do
|
||||
route idRoute
|
||||
compile compressCssCompiler
|
||||
|
||||
match "posts/*" $ do
|
||||
let ctx = constField "type" "article" <> postCtx
|
||||
route $ metadataRoute titleRoute
|
||||
|
@ -65,6 +68,7 @@ main = hakyllWith config $ do
|
|||
>>= loadAndApplyTemplate "templates/post.html" ctx
|
||||
>>= saveSnapshot "content"
|
||||
>>= loadAndApplyTemplate "templates/default.html" ctx
|
||||
|
||||
match "index.html" $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
|
@ -77,7 +81,10 @@ main = hakyllWith config $ do
|
|||
getResourceBody
|
||||
>>= applyAsTemplate indexCtx
|
||||
>>= loadAndApplyTemplate "templates/default.html" indexCtx
|
||||
match "templates/*" $ compile templateBodyCompiler
|
||||
|
||||
match "templates/*" $
|
||||
compile templateBodyCompiler
|
||||
|
||||
create ["sitemap.xml"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
|
@ -89,13 +96,17 @@ main = hakyllWith config $ do
|
|||
<> listField "pages" postCtx (return pages)
|
||||
makeItem ("" :: String)
|
||||
>>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx
|
||||
|
||||
create ["rss.xml"] $ do
|
||||
route idRoute
|
||||
compile (feedCompiler renderRss)
|
||||
|
||||
create ["atom.xml"] $ do
|
||||
route idRoute
|
||||
compile (feedCompiler renderAtom)
|
||||
|
||||
{- ORMOLU_ENABLE -}
|
||||
|
||||
-- CONTEXT
|
||||
|
||||
feedCtx :: Context String
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue