From 5a12d1b2ec3bd06ff03064142d805272b3cc3ef0 Mon Sep 17 00:00:00 2001 From: iris Date: Wed, 27 May 2026 12:57:56 +0200 Subject: [PATCH] flake: drop flake-utils, match hyperhive's hand-rolled forAllSystems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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..website` builds the dist; `packages..default` points at it. `devShells..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. --- flake.lock | 61 ----------------------------- flake.nix | 113 +++++++++++++++++++++++++++++++---------------------- 2 files changed, 66 insertions(+), 108 deletions(-) delete mode 100644 flake.lock diff --git a/flake.lock b/flake.lock deleted file mode 100644 index c5e45df..0000000 --- a/flake.lock +++ /dev/null @@ -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 -} diff --git a/flake.nix b/flake.nix index 73ada2c..56fb0eb 100644 --- a/flake.nix +++ b/flake.nix @@ -4,61 +4,80 @@ # `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: - let - pkgs = import nixpkgs { inherit system; }; - in { - packages.website = pkgs.stdenv.mkDerivation { - pname = "hyperhive-website"; - version = self.shortRev or "dev"; + 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 = ./.; + src = ./.; - nativeBuildInputs = [ pkgs.zola ]; + 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 - ''; + # 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 - ''; + installPhase = '' + runHook preInstall + mkdir -p $out + cp -r public/. $out/ + runHook postInstall + ''; - # Static-site dist; no shared libs to patchelf, no executables. - dontFixup = true; - }; + # 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 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.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"; - }; - }); + # `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 ]; + }; + } + ); + }; }