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.
This commit is contained in:
parent
ec64da8620
commit
5a12d1b2ec
2 changed files with 66 additions and 108 deletions
61
flake.lock
generated
61
flake.lock
generated
|
|
@ -1,61 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1779560665,
|
||||
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
65
flake.nix
65
flake.nix
|
|
@ -4,19 +4,39 @@
|
|||
# `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-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in {
|
||||
packages.website = pkgs.stdenv.mkDerivation {
|
||||
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";
|
||||
|
||||
|
|
@ -24,10 +44,9 @@
|
|||
|
||||
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.
|
||||
# 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
|
||||
|
|
@ -46,19 +65,19 @@
|
|||
};
|
||||
|
||||
# `nix build` with no attribute → the website dist.
|
||||
packages.default = self.packages.${system}.website;
|
||||
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.default = pkgs.mkShell {
|
||||
devShells = forAllSystems (
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
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";
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue