65 lines
2 KiB
Nix
65 lines
2 KiB
Nix
|
|
{
|
||
|
|
# hyperhive marketing landing — Zola static site build (#502).
|
||
|
|
#
|
||
|
|
# `nix build` → `result/` is the `public/` Zola dist, ready to drop
|
||
|
|
# under any static-file host. No CI runner needed; the flake is the
|
||
|
|
# validation contract.
|
||
|
|
description = "hyperhive marketing landing";
|
||
|
|
|
||
|
|
inputs = {
|
||
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||
|
|
flake-utils.url = "github:numtide/flake-utils";
|
||
|
|
};
|
||
|
|
|
||
|
|
outputs = { self, nixpkgs, flake-utils }:
|
||
|
|
flake-utils.lib.eachDefaultSystem (system:
|
||
|
|
let
|
||
|
|
pkgs = import nixpkgs { inherit system; };
|
||
|
|
in {
|
||
|
|
packages.website = pkgs.stdenv.mkDerivation {
|
||
|
|
pname = "hyperhive-website";
|
||
|
|
version = self.shortRev or "dev";
|
||
|
|
|
||
|
|
src = ./.;
|
||
|
|
|
||
|
|
nativeBuildInputs = [ pkgs.zola ];
|
||
|
|
|
||
|
|
# Zola reads `config.toml` from CWD, writes `public/` next to it,
|
||
|
|
# which we then move to $out. The build is offline / hermetic —
|
||
|
|
# no network access needed at build time, which fits the nix
|
||
|
|
# sandbox without extra fetchurls.
|
||
|
|
buildPhase = ''
|
||
|
|
runHook preBuild
|
||
|
|
zola build --output-dir public
|
||
|
|
runHook postBuild
|
||
|
|
'';
|
||
|
|
|
||
|
|
installPhase = ''
|
||
|
|
runHook preInstall
|
||
|
|
mkdir -p $out
|
||
|
|
cp -r public/. $out/
|
||
|
|
runHook postInstall
|
||
|
|
'';
|
||
|
|
|
||
|
|
# Static-site dist; no shared libs to patchelf, no executables.
|
||
|
|
dontFixup = true;
|
||
|
|
};
|
||
|
|
|
||
|
|
# `nix build` with no attribute → the website dist.
|
||
|
|
packages.default = self.packages.${system}.website;
|
||
|
|
|
||
|
|
# `nix develop` → a shell with zola for local iteration:
|
||
|
|
# `zola serve` runs the dev server with live reload.
|
||
|
|
devShells.default = pkgs.mkShell {
|
||
|
|
packages = [ pkgs.zola ];
|
||
|
|
};
|
||
|
|
|
||
|
|
# `nix run` is the dev-server shortcut: `nix run . -- serve`
|
||
|
|
# boots Zola's hot-reload server on http://127.0.0.1:1111/.
|
||
|
|
apps.default = {
|
||
|
|
type = "app";
|
||
|
|
program = "${pkgs.zola}/bin/zola";
|
||
|
|
};
|
||
|
|
});
|
||
|
|
}
|