55 lines
1.3 KiB
Nix
55 lines
1.3 KiB
Nix
{ pkgs, blog-source, web-files, 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 (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;
|
|
})
|
|
];
|
|
};
|
|
}
|