91fee245b8
Every CI build is now a derivation in nix/ci.nix, so the self-hosted runners substitute it from titan's harmonia cache instead of rebuilding: - checks.clippy, checks.test (with the --check-evidence gate, which needs the compiled tests), checks.wasm-check (per crate, no feature unification), checks.harness-lint (opfs-contract fmt + clippy) - packages.web: harness/build.sh unchanged -> the three wasm bundles and harness/serve; packages.site re-assembles with the commit as the cache-bust token - packages.ci-deps: the crane dependency builds, for titan's cache timer to keep rooted Dependencies are separate buildDepsOnly derivations keyed on the lock, so a PR that leaves Cargo.lock alone rebuilds only the workspace. The script-only checks (node, kb, checkers, comment/CI-graph gates, fmt) stay dev-shell steps: they compile nothing, and their enforced `#!/usr/bin/env bash` cannot run in the build sandbox. ci.yml's build, test, wasm and harness-lint jobs now run `nix build` on these; rust-cache and the PATH workaround for it are gone. Job names and the deploy graph are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
144 lines
5.2 KiB
Nix
144 lines
5.2 KiB
Nix
{
|
|
description = "Improvise — Multi-Dimensional Data Modeling Terminal Application";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
beads.url = "github:gastownhall/beads/v1.3.0";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
};
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
crate2nix.url = "github:nix-community/crate2nix";
|
|
crane.url = "github:ipetkov/crane";
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
beads,
|
|
nixpkgs,
|
|
rust-overlay,
|
|
flake-utils,
|
|
crate2nix,
|
|
crane,
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [(import rust-overlay)];
|
|
};
|
|
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
extensions = ["rust-src" "clippy" "rustfmt" "llvm-tools-preview"];
|
|
# The browser deployment targets wasm; without this, the wasm audit
|
|
# (improvise-ywd) and the OPFS backend (improvise-i34) cannot even be
|
|
# checked, let alone fixed.
|
|
targets = ["wasm32-unknown-unknown"];
|
|
};
|
|
|
|
cargoNix = import ./Cargo.nix {
|
|
inherit nixpkgs pkgs;
|
|
};
|
|
# wasm-pack downloads wasm-bindgen and binaryen from GitHub releases
|
|
# unless they are on PATH, and its downloader ignores SSL_CERT_FILE, so
|
|
# behind the runners' TLS-auditing proxy those downloads fail (binaryen
|
|
# with no fallback). On PATH, it downloads nothing. wasm-pack only takes
|
|
# a PATH wasm-bindgen whose version equals Cargo.lock's `wasm-bindgen`,
|
|
# so this pin moves with the lock; CI checks that it does.
|
|
wasmBindgenCli = pkgs.buildWasmBindgenCli rec {
|
|
src = pkgs.fetchCrate {
|
|
pname = "wasm-bindgen-cli";
|
|
version = "0.2.128";
|
|
hash = "sha256-a7lcXJnnZkYReja+iUO7NqqrWyv3toxnUgQb8s4IS5s=";
|
|
};
|
|
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
|
|
inherit src;
|
|
inherit (src) pname version;
|
|
hash = "sha256-R1Tas33Ursy8kqsxguAkG0ZhNed2n5uFTAhw1l2qlLY=";
|
|
};
|
|
};
|
|
|
|
# Everything CI runs, and nothing else: `devShells.ci` is exactly this,
|
|
# and the default shell is this plus editor and release tooling, so a
|
|
# local `nix develop` runs the toolchain the checks run.
|
|
ciInputs = [
|
|
rustToolchain
|
|
pkgs.pkg-config
|
|
|
|
# `scripts/kb` and the CI knowledge-base check both run trealla. It
|
|
# was reached through `nix shell nixpkgs#trealla` per invocation,
|
|
# which cost more than the work: the tool's first real use took past
|
|
# two minutes for a write that takes half a second on PATH.
|
|
pkgs.trealla
|
|
|
|
# `web/build.sh` — and so the Pages job's local dry run — needs this.
|
|
# The `wasm` CI job only runs `cargo check`, which does not, so the
|
|
# shell was missing the one tool that turns a passing check into a
|
|
# loadable page (improvise-d31). Must match WASM_PACK_VERSION in
|
|
# scripts/web-toolchain-versions.env; CI checks that it does.
|
|
pkgs.wasm-pack
|
|
wasmBindgenCli
|
|
pkgs.binaryen
|
|
|
|
# NODE_VERSION's major, same check. The js and browser jobs ran 22
|
|
# while `build` ran the pinned 24; one shell means one node.
|
|
pkgs.nodejs_24
|
|
pkgs.python3
|
|
pkgs.jq
|
|
];
|
|
|
|
# Playwright's downloaded browsers are generic-Linux builds that cannot
|
|
# start on NixOS, so nixpkgs' build is used. harness/package.json pins
|
|
# @playwright/test to this playwright-driver's version: they must match.
|
|
craneLib = (crane.mkLib pkgs).overrideToolchain (_: rustToolchain);
|
|
ci = import ./nix/ci.nix {
|
|
inherit pkgs craneLib wasmBindgenCli;
|
|
src = self;
|
|
# What the site's cache-bust token names; CI checks out a clean tree.
|
|
rev = self.rev or "dirty";
|
|
};
|
|
|
|
playwrightEnv = {
|
|
PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}";
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
|
|
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = "true";
|
|
RUST_BACKTRACE = "1";
|
|
};
|
|
in {
|
|
inherit cargoNix;
|
|
devShells.ci = pkgs.mkShell (playwrightEnv // {nativeBuildInputs = ciInputs;});
|
|
devShells.default = pkgs.mkShell (playwrightEnv // {
|
|
nativeBuildInputs = ciInputs ++ [
|
|
pkgs.rust-analyzer
|
|
crate2nix.packages.${system}.default
|
|
pkgs.cargo-expand
|
|
pkgs.cargo-llvm-cov
|
|
pkgs.global
|
|
pkgs.universal-ctags
|
|
beads.packages.${system}.default
|
|
|
|
# Demo recording and release tooling
|
|
pkgs.asciinema
|
|
pkgs.vhs
|
|
pkgs.cargo-dist
|
|
# nixpkgs cargo-dist installs as "dist"; alias so `cargo dist` works
|
|
(pkgs.writeShellScriptBin "cargo-dist" ''exec ${pkgs.cargo-dist}/bin/dist "$@"'')
|
|
];
|
|
});
|
|
|
|
packages =
|
|
ci.packages
|
|
// {
|
|
improvise = cargoNix.workspaceMembers.improvise.build;
|
|
default = self.packages.${system}.improvise;
|
|
};
|
|
|
|
# `nix flake check` builds every CI build: crane's checks plus the
|
|
# crate2nix package and the bundles.
|
|
checks =
|
|
ci.checks
|
|
// {
|
|
inherit (self.packages.${system}) improvise web;
|
|
};
|
|
});
|
|
}
|