luv

Workshop wiki

urbit.lisp

luvcraft/urbit.lisp

system luvcraft/core · 9 definitions · on GitHub

A real urbit on a wall.

The urbit material is not a picture of a computer. Activating a wall of it attaches the actual vere runtime to the wall's PTY: the first activation boots a comet into a pier under build/urbit/ -- vere finds a sponsor over the network and takes its minutes, all of it visible on the wall -- and every later activation resumes the same pier, so the ship is as durable as the checkout. The dojo is the wall.

A comet is the ship that needs no keys. Named ships -- a star like ~nodfur under the galaxies ~fur and ~lev -- boot from a keyfile instead, which is a later adventure; urbit-boot-arguments is where that choice will land when it arrives.

in-package#:luvcraft
defparameter*urbit-pier-root*#P"build/urbit/""Where piers live, relative to the checkout the game runs in."
defparameter*urbit-default-pier*

comet

"The pier a bare urbit wall runs."
defunfind-program-in-path
name

Return the full name of executable name on PATH, or NIL.

loopfordirectoryin
uiop:split-string
or
uiop:getenv"PATH"
""
:separator":"
forcandidate=
unless
string=directory""
merge-pathnamesname
uiop:ensure-directory-pathnamedirectory
when
andcandidate
uiop:file-exists-pcandidate
return
namestringcandidate
defunurbit-executable

The vere runtime this environment provides, or NIL.

The nix dev shell names its own copy as luv_URBIT; anywhere else, whatever urbit or vere the PATH offers is the one that runs.

or
uiop:getenv"LUV_URBIT"
defunurbit-pier-pathname

The directory of the pier called name, under the checkout's pier root.

merge-pathnames
make-pathname:directory
list:relativename
merge-pathnames*urbit-pier-root*
uiop:getcwd
defunurbit-pier-exists-p
pier

Whether pier has been booted: a pier is a directory vere made an .urb in.

and
uiop:directory-exists-p
merge-pathnames#P".urb/"pier
t
defunurbit-boot-arguments
pier

The vere argument list that resumes pier, or boots it as a comet first.

let
namestring
namestringpier
if
listnamestring
list"-c"namestring
defunattach-terminal-display-urbit
display&key

Attach the real urbit runtime to display: the dojo on the wall.

Booting and resuming both happen in the PTY where the player can watch; vere checkpoints the pier when the display goes away and takes its process with it.

let
unlessprogram
error"No urbit runtime: set LUV_URBIT or put urbit on PATH."
ensure-directories-exist
merge-pathnames*urbit-pier-root*
uiop:getcwd
attach-terminal-display-ptydisplay:programprogram:arguments:directory
uiop:getcwd
:environment
copy-list
sb-ext:posix-environ