nani.wtf/nix/haskell-overlay.nix

66 lines
1.9 KiB
Nix
Raw Normal View History

2021-06-13 06:02:29 +02:00
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:
2022-03-13 22:34:31 +01:00
rec {
hakyll = pipe hpPrev.hakyll [
2021-06-13 06:02:29 +02:00
doJailbreak
dontCheck
2022-03-13 22:34:31 +01:00
# (withPatch ./hakyll.patch)
(withFlags [ "-f" "watch" ])
2021-06-13 06:02:29 +02:00
];
2022-03-13 22:34:31 +01:00
pandoc = pipe hpPrev.pandoc [
2021-06-13 06:02:29 +02:00
doJailbreak
dontCheck
];
2022-03-13 22:34:31 +01:00
slugger = hpPrev.slugger;
2021-07-31 12:58:54 +02:00
2022-03-13 22:34:31 +01:00
ssg = hpPrev.callCabal2nix "ssg" ../ssg {};
2021-06-13 06:02:29 +02:00
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 [
2022-03-13 22:34:31 +01:00
../.gitignore
"../.git"
"../.github"
] ../.;
2021-06-13 06:02:29 +02:00
# 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 = ''
2022-03-13 22:34:31 +01:00
mkdir -p "$out"
cp -r dist/* "$out"
2021-06-13 06:02:29 +02:00
'';
};
};
};
}