depot/packages/websites/landing/project.nix

56 lines
1.5 KiB
Nix
Raw Permalink Normal View History

2022-07-31 16:48:55 +03:00
{
perSystem = { builders, lib, pkgs, self', ... }: let
configFile = pkgs.writeText "hugo-config.json" (builtins.toJSON {
title = "Private Void | Zero-maintenance perfection";
baseURL = "https://www.privatevoid.net/";
languageCode = "en-us";
disableKinds = [
"page"
"RSS"
"section"
"sitemap"
"taxonomy"
"taxonomyTerm"
];
});
hugoArgs = [
"--config" configFile
2022-08-05 21:53:37 +03:00
];
hugoArgsStr = lib.concatStringsSep " " hugoArgs;
in
{
projectShells.landing = {
commands.hugo = {
help = pkgs.hugo.meta.description;
command = "exec ${pkgs.hugo}/bin/hugo ${hugoArgsStr} \"$@\"";
};
tools = with self'.packages; [
dvc
2022-07-31 17:56:08 +03:00
];
};
packages.landing = with pkgs; let
site = stdenvNoCC.mkDerivation rec {
pname = "private-void-landing-page";
version = "0.0.0";
src = builders.hydrateAssetDirectory ./.;
nativeBuildInputs = [
hugo
];
buildCommand = ''
unpackPhase
mkdir -p $out/share/www
hugo ${hugoArgsStr} -s $sourceRoot -d $out/share/www/${pname}
'';
passthru = {
webroot = "${site}/share/www/${site.pname}";
serve = writeShellScriptBin "serve-site" ''
command -v xdg-open >/dev/null && xdg-open http://127.0.0.1:1314 || true
${darkhttpd}/bin/darkhttpd ${site.webroot} --addr 127.0.0.1 --port 1314
'';
};
};
in site;
};
2022-07-31 16:48:55 +03:00
}