website/flake.nix
iris 5a12d1b2ec flake: drop flake-utils, match hyperhive's hand-rolled forAllSystems
mara on PR #1: \"never use flake utils - look at hyperhive flake\".

Rewrote the flake to mirror hyperhive's pattern:

- Single `nixpkgs` input (no `flake-utils`, no `treefmt-nix`,
  no `naersk` — none apply to a static-site dist).
- Hand-rolled `forAllSystems` over `[aarch64-linux, x86_64-linux]`
  via `lib.genAttrs`. Same shape as `hyperhive/hyperhive`'s flake
  so contributors see consistent ceremony across both repos.
- `packages.<system>.website` builds the dist; `packages.<system>.default`
  points at it. `devShells.<system>.default` exposes `zola` for the
  `zola serve` dev loop.
- Dropped the `apps.default` shortcut — `zola serve` is more usefully
  spelled `nix develop -c zola serve` since dev needs the whole shell
  anyway.

Also dropped the auto-generated flake.lock that the old
flake-utils tree had written; nix will regenerate it on first
`nix build` against the new inputs.
2026-05-27 12:57:56 +02:00

83 lines
2.4 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.
#
# Output shape mirrors `hyperhive/hyperhive`'s flake — hand-rolled
# `forAllSystems` helper instead of `flake-utils`. Less ceremony,
# one source of truth for the systems list, and consistent with the
# rest of the project.
description = "hyperhive marketing landing";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
outputs =
{ self, nixpkgs }:
let
inherit (nixpkgs) lib;
systems = [
"aarch64-linux"
"x86_64-linux"
];
forAllSystems =
f:
lib.genAttrs systems (
system:
f rec {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
}
);
in
{
packages = forAllSystems (
{ pkgs, ... }:
{
# `nix build .#website` → static dist at result/.
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. Build is offline / hermetic — no network access needed
# at build time, 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.
default = self.packages.${pkgs.system}.website;
}
);
# `nix develop` → a shell with zola for local iteration:
# `zola serve` runs the dev server with live reload.
devShells = forAllSystems (
{ pkgs, ... }:
{
default = pkgs.mkShell {
packages = [ pkgs.zola ];
};
}
);
};
}