nani.wtf/nix/haskell-overlay.nix

66 lines
1.9 KiB
Nix

final: prev:
let
inherit (prev.stdenv) mkDerivation;
inherit (prev.lib.trivial) flip pipe;
inherit (prev.haskell.lib)
appendPatch
appendConfigureFlags
dontCheck
doJailbreak;
withPatch = flip appendPatch;
withFlags = flip appendConfigureFlags;
haskellCompiler = "ghc884";
in {
myHaskellPackages = prev.haskell.packages.${haskellCompiler}.override {
overrides = hpFinal: hpPrev:
rec {
hakyll = pipe hpPrev.hakyll [
doJailbreak
dontCheck
# (withPatch ./hakyll.patch)
(withFlags [ "-f" "watch" ])
];
pandoc = pipe hpPrev.pandoc [
doJailbreak
dontCheck
];
slugger = hpPrev.slugger;
ssg = hpPrev.callCabal2nix "ssg" ../ssg {};
website = prev.stdenv.mkDerivation {
#__contentAddressed = true; # uncomment if using cas: https://www.tweag.io/blog/2020-09-10-nix-cas/
name = "website";
buildInputs = [ ssg ];
src = prev.nix-gitignore.gitignoreSourcePure [
../.gitignore
"../.git"
"../.github"
] ../.;
# LANG and LOCALE_ARCHIVE are fixes pulled from the community:
# https://github.com/jaspervdj/hakyll/issues/614#issuecomment-411520691
# https://github.com/NixOS/nix/issues/318#issuecomment-52986702
# https://github.com/MaxDaten/brutal-recipes/blob/source/default.nix#L24
LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = prev.lib.optionalString
(prev.buildPlatform.libc == "glibc")
"${prev.glibcLocales}/lib/locale/locale-archive";
buildPhase = ''
hakyll-site build --verbose
'';
installPhase = ''
mkdir -p "$out"
cp -r dist/* "$out"
'';
};
};
};
}