nandi/frqpublic Fork 0
4dfc71908cc3f12174bb0d6dd8688ff3164879c3
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

container.toml · 142 lines · 6.8 KBTOML Blame HistoryRaw
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago1[container]
Six verbs, and the last of the nix 2e24e64 nandi 17h ago2name = "frq-web"
Three tarballs where a devShell was 5ce66d5 nandi yesterday3description = "the Flutter web build, incremental, from a pinned toolchain"
4# `debian:13-slim` and not `arch-nix`: there is no nix in this container any
5# more. The build is `tools/build-web.sh`, which fetches its own Flutter, JDK
6# and Clojure CLI by pinned sha256, so what the image owes it is curl, git,
A compiler in the web container 32aed8b nandi 16h ago7# tar and a C compiler — and the smallest image that has them is the right one.
8#
9# gcc for the `cc` that `require_host_tools` gates on. This container never
10# compiles Nim, but the check is one gate for every toolchain user rather than
11# one per subcommand, and a web build without a compiler is what failed CI:
12# `toolchain: this needs cc on PATH and cannot fetch them`, and then flutter
13# not found, because the gate exits before anything is fetched.
Three tarballs where a devShell was 5ce66d5 nandi yesterday14registry = "debian:13-slim"
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago15# A Sandbox, not a Function: it runs on a real VM, the command is the
16# sandbox's own process so it dies when the command does, and only a Sandbox
17# can hold open a tunnel -- which is the whole of `serve`.
18runtime = "sandbox"
19
20[build]
21# The container lives inside the repo it builds, so the copy is rooted two
22# levels up and `.` is the whole tree.
23context = "../.."
24include = ["."]
Three tarballs where a devShell was 5ce66d5 nandi yesterday25# The whole image build, and it is one apt line. What used to be here -- a
26# nix store to populate, a devShell to print, a closure to warm before the
27# source arrived so an edit would not invalidate it -- is gone with the nix
28# it was for. There is no `warm` list any more either: this step reads
29# nothing out of the tree, so nothing in the tree can invalidate it.
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago30#
Three tarballs where a devShell was 5ce66d5 nandi yesterday31# git, because Flutter shells out to it against its own SDK checkout and
32# refuses to run without one; unzip and xz-utils, because that is what the
33# SDK and the toolchain tarballs arrive as; rsync for the sync below;
34# ca-certificates so curl can verify what it fetches.
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago35setup = [
A compiler in the web container 32aed8b nandi 16h ago36 "apt-get update && apt-get install -y --no-install-recommends ca-certificates curl gcc git rsync tar unzip xz-utils && rm -rf /var/lib/apt/lists/*",
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago37]
38# The build state a local checkout carries, wanted by nothing out here: this
One frontend where there were three, and a core that is not Clojure 438b247 nandi 21h ago39# container builds into a volume of its own, and the clojure caches
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago40# are the laptop's.
41ignore = [
42 "flutter/build", "flutter/.home", "flutter/.dart_tool",
43 "flutter/.clojuredart", "flutter/.cpcache",
Three tarballs where a devShell was 5ce66d5 nandi yesterday44 # The ClojureDart compiler's output, gitignored and -- until now --
45 # uploaded anyway, because this list is explicit and does not read
46 # .gitignore. It is megabytes of generated Dart per run, and worse than
47 # the upload is what happened on arrival: the rsync below overwrote the
48 # volume's copy, the one the last container compiled, with a laptop's.
49 # Every file whose content differed then looked new to the compiler and
50 # to Flutter, which is the incremental build undone by the thing that was
51 # meant to feed it. It belongs to the volume, like flutter/build.
52 "flutter/lib/cljd-out",
53 # The toolchain, which is a gigabyte of Flutter SDK and lives on the
54 # volume out here.
55 ".toolchain",
One frontend where there were three, and a core that is not Clojure 438b247 nandi 21h ago56 ".cpcache", "result", "build", ".git",
Pictures a browser will accept, through the one origin that vouches for them 1a1f153 nandi 2d ago57 # An editor's linter rewrites this while the upload is reading it, and
58 # Modal fails the whole run with "was modified during build process".
59 # Nothing out here reads it.
60 ".clj-kondo",
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago61]
62
Three tarballs where a devShell was 5ce66d5 nandi yesterday63# One volume now, where there were two: the nix binary cache went with nix.
64# `devshell` is the working state of an incremental loop, shared by every
65# container that has one -- each gets its own directory under it, named for
Six verbs, and the last of the nix 2e24e64 nandi 17h ago66# what it belongs to, so `web` and `flutter-desktop` never write the
Three tarballs where a devShell was 5ce66d5 nandi yesterday67# same tree. Modal Volumes have no locking, so those directory names are the
68# only thing keeping them apart, and two runs of the *same* container must
69# not overlap.
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago70[volumes]
Three tarballs where a devShell was 5ce66d5 nandi yesterday71devshell = "/devshell"
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago72
73[resources]
74cpu = 8
75memory = 16384
76timeout = 3600
77
Three tarballs where a devShell was 5ce66d5 nandi yesterday78# The port `tools/build-web.sh serve` listens on, tunnelled out. Nothing is
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago79# served unless the command asks for it -- a plain build exits and the tunnel
80# closes with the sandbox -- but the port has to be declared at create time,
81# so it is declared once here and `modal run --command` decides whether
82# anything ever binds it.
83[network]
84ports = [8080]
85
86[run]
87workdir = "/app"
Three tarballs where a devShell was 5ce66d5 nandi yesterday88# Source in, toolchain out of the volume, build in place. Three steps, and
89# none of them evaluates anything: the old command spent its first minutes
90# entering a devShell, printing an environment, caching that environment
91# against flake.lock and copying a nix closure back afterwards, all to arrive
92# at a PATH. A PATH is what `tools/toolchain.sh env` prints, out of a
93# directory that is already on the volume.
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago94command = """
95set -e
Six verbs, and the last of the nix 2e24e64 nandi 17h ago96SHELL_DIR=/devshell/frq-web
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago97
Three tarballs where a devShell was 5ce66d5 nandi yesterday98# Beside the working tree and NOT inside it: the rsync below runs with
99# --delete, so anything under $SHELL_DIR that is not in /app is removed on
100# every run. A cache kept in there would be deleted moments before it was
101# consulted -- which is what happened to the last one that tried.
Six verbs, and the last of the nix 2e24e64 nandi 17h ago102export FRQ_TOOLCHAIN=/devshell/frq-web.toolchain
Three tarballs where a devShell was 5ce66d5 nandi yesterday103mkdir -p "$SHELL_DIR" "$FRQ_TOOLCHAIN"
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago104
105echo "sync: /app -> $SHELL_DIR"
106# rsync and not cp, with --checksum and not mtimes: Modal copies the source in
107# with fresh timestamps every run, so a plain copy looks entirely new to
108# Flutter and rebuilds the lot. --checksum compares content and leaves the
109# unchanged files' timestamps alone, which is the whole basis of the
110# incremental build.
111#
112# The excludes are the state we are here to keep -- overwriting them from /app
Three tarballs where a devShell was 5ce66d5 nandi yesterday113# would defeat the volume. `flutter/web/` is NOT on the list: it is committed,
114# because the OAuth client keeps a script there, so it has to arrive from
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago115# /app like any other source.
Three tarballs where a devShell was 5ce66d5 nandi yesterday116rsync -a --checksum --delete \
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago117 --exclude 'flutter/.home/' \
118 --exclude 'flutter/.clojuredart/' \
119 --exclude 'flutter/build/' \
Three tarballs where a devShell was 5ce66d5 nandi yesterday120 --exclude 'flutter/lib/cljd-out/' \
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago121 --exclude 'flutter/.dart_tool/' \
Three tarballs where a devShell was 5ce66d5 nandi yesterday122 --exclude '.toolchain/' \
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago123 --exclude '.git' \
124 /app/ "$SHELL_DIR/"
125
126cd "$SHELL_DIR"
Three tarballs where a devShell was 5ce66d5 nandi yesterday127# What survived from the last run, by presence and not by size: `du` here
128# walked the pub cache, the toolchain and every object of the last build over
129# a network volume, for numbers nobody acts on.
130for d in "$FRQ_TOOLCHAIN" flutter/.clojuredart flutter/lib/cljd-out flutter/build; do
131 [ -d "$d" ] && echo " carried over: $d"
132done
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago133
Six verbs, and the last of the nix 2e24e64 nandi 17h ago134# The same script `just build web` runs, with the same single build mode:
Three tarballs where a devShell was 5ce66d5 nandi yesterday135# what is served and what a laptop compiles are the same bundle.
136tools/build-web.sh build
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago137"""
Three tarballs where a devShell was 5ce66d5 nandi yesterday138# Flutter keeps its settings -- `--enable-web` among them -- under
139# XDG_CONFIG_HOME, and its own caches under XDG_CACHE_HOME. Both point into
140# the volume so a second run finds what the first one decided. Set here
141# rather than in the command so a shell into this container gets them too.
Six verbs, and the last of the nix 2e24e64 nandi 17h ago142env = { XDG_CACHE_HOME = "/devshell/frq-web.toolchain/.cache", XDG_CONFIG_HOME = "/devshell/frq-web.toolchain/.config", FRQ_TOOLCHAIN = "/devshell/frq-web.toolchain" }