blog-static-flake/lib.nix
Danila Fedorin ee116b138f Add building and linking Agda as build step
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-23 07:37:52 +00:00

55 lines
1.3 KiB
Nix

{ pkgs, blog-source, web-files, katex-html, resume }:
with pkgs;
with lib;
let
protocol = ssl: if ssl then "https://" else "http://";
gems = bundlerEnv {
inherit ruby;
name = "blog-static-flake";
gemfile = "${blog-source}/Gemfile";
lockfile = "${blog-source}/Gemfile.lock";
gemset = ./gemset.nix;
};
website = settings: stdenv.mkDerivation {
inherit (settings) src ssl host;
inherit resume gems ruby;
name = "blog-static";
version = settings.src.rev or "dirty";
publicPath = settings.path;
hugoFlags = concatStringsSep " " (
optionals settings.drafts (singleton "-D") ++
[ "--baseURL=${protocol settings.ssl + settings.host}" ]
);
builder = ./build/builder.sh;
webFiles = web-files;
buildInputs = [
hugo ruby stork katex-html (agda.withPackages [ agdaPackages.standard-library ])
];
};
in
{
english = settings: website {
inherit (settings) host;
ssl = settings.ssl or false;
drafts = settings.drafts or false;
src = blog-source;
path = ".";
};
virtualHostFor = package:
{
"${package.host}" = mkMerge [
{
root = package;
}
(mkIf (package.ssl) {
forceSSL = true;
enableACME = true;
})
];
};
}