2021-06-13 00:02:29 -04:00
|
|
|
{
|
|
|
|
description = "hakyll-nix-template";
|
|
|
|
|
2023-01-28 14:10:41 +13:00
|
|
|
nixConfig = {
|
|
|
|
allow-import-from-derivation = "true";
|
2023-01-28 20:36:30 +13:00
|
|
|
bash-prompt = "[hakyll-nix]λ ";
|
2023-01-28 14:10:41 +13:00
|
|
|
extra-substituters = [
|
|
|
|
"https://cache.iog.io"
|
|
|
|
];
|
|
|
|
extra-trusted-public-keys = [
|
|
|
|
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
|
|
|
|
];
|
2021-06-13 00:02:29 -04:00
|
|
|
};
|
|
|
|
|
2023-01-28 14:10:41 +13:00
|
|
|
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
|
|
|
|
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
|
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, flake-utils, haskellNix }:
|
2021-06-13 00:02:29 -04:00
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
2023-01-28 14:10:41 +13:00
|
|
|
overlays = [ haskellNix.overlay
|
|
|
|
(final: prev: {
|
2023-01-28 19:15:09 +13:00
|
|
|
hakyllProject = final.haskell-nix.project' {
|
2023-01-28 14:10:41 +13:00
|
|
|
src = ./ssg;
|
2024-01-30 10:37:08 -05:00
|
|
|
compiler-nix-name = "ghc948";
|
2024-01-30 10:52:21 -05:00
|
|
|
modules = [{ doHaddock = false; }];
|
2023-01-28 14:10:41 +13:00
|
|
|
shell.buildInputs = [
|
|
|
|
hakyll-site
|
|
|
|
];
|
|
|
|
shell.tools = {
|
|
|
|
cabal = "latest";
|
|
|
|
hlint = "latest";
|
|
|
|
haskell-language-server = "latest";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2021-06-13 00:02:29 -04:00
|
|
|
|
2023-01-28 14:10:41 +13:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit overlays system;
|
|
|
|
inherit (haskellNix) config;
|
2021-06-13 00:02:29 -04:00
|
|
|
};
|
|
|
|
|
2023-01-28 19:15:09 +13:00
|
|
|
flake = pkgs.hakyllProject.flake {};
|
2023-01-28 14:10:41 +13:00
|
|
|
|
2024-01-30 10:52:21 -05:00
|
|
|
executable = "ssg:exe:hakyll-site";
|
|
|
|
|
|
|
|
hakyll-site = flake.packages.${executable};
|
2021-06-13 00:02:29 -04:00
|
|
|
|
2023-01-28 14:10:41 +13:00
|
|
|
website = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "website";
|
|
|
|
buildInputs = [];
|
|
|
|
src = pkgs.nix-gitignore.gitignoreSourcePure [
|
|
|
|
./.gitignore
|
|
|
|
".git"
|
|
|
|
".github"
|
|
|
|
] ./.;
|
2021-06-13 00:02:29 -04:00
|
|
|
|
2023-01-28 14:10:41 +13: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 = pkgs.lib.optionalString
|
|
|
|
(pkgs.buildPlatform.libc == "glibc")
|
|
|
|
"${pkgs.glibcLocales}/lib/locale/locale-archive";
|
|
|
|
|
|
|
|
buildPhase = ''
|
2024-01-30 10:52:21 -05:00
|
|
|
${flake.packages.${executable}}/bin/hakyll-site build --verbose
|
2023-01-28 14:10:41 +13:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/dist"
|
2023-01-31 23:05:58 +13:00
|
|
|
cp -a dist/. "$out/dist"
|
2023-01-28 14:10:41 +13:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in flake // rec {
|
|
|
|
apps = {
|
|
|
|
default = flake-utils.lib.mkApp {
|
|
|
|
drv = hakyll-site;
|
|
|
|
exePath = "/bin/hakyll-site";
|
|
|
|
};
|
|
|
|
};
|
2021-06-13 00:02:29 -04:00
|
|
|
|
2023-01-28 14:10:41 +13:00
|
|
|
packages = {
|
|
|
|
inherit hakyll-site website;
|
|
|
|
default = website;
|
2021-06-13 00:02:29 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|