0002-an-app-is-a-folder-on-an-image-base.md (4578B)
1 # 0002. An app is a folder, run on a base image named by digest 2 3 Date: 2026-10-15 4 5 ## Status 6 7 Proposed; amended by ADR-0005: an app's base is the small Patina platform, and a system 8 image only for apps that can't bring their own (the folder itself stands). 9 10 ## Context 11 12 On Linux the line between the system's packages and the user's is blurred: running a user's 13 app often means installing something system-wide first (a library, a runtime, FUSE for an 14 AppImage). Patina OS locks the system in an image (ADR-0001), so the user's apps have to live 15 in their home folder and must never need the system changed. 16 17 What the existing answers are underneath: 18 19 - **AppImage**: a SquashFS image with an ELF runtime in front. Run, it mounts itself with FUSE 20 and runs `AppRun` inside an AppDir (a folder: AppRun, a .desktop file, an icon, `usr/`). So 21 it's a folder packed into one file, and it needs libfuse on the system to unpack: a user 22 package that needs a system package. 23 - **macOS's .app**: just a folder of a known shape (Info.plist, the binary, resources), found 24 where apps are expected. It works because Apple guarantees the base it runs on (libSystem, 25 AppKit, Metal) and keeps it stable. 26 - **Earlier folder apps on Linux** (NeXTSTEP's heirs: GNUstep's .app, ROX's AppDirs) didn't 27 fail for being folders. They failed because Linux has no guaranteed base: which glibc, which 28 Mesa, whether PipeWire is there. Every format since makes up for it with its own world: 29 Flatpak's runtimes, AppImage bundling everything, snap's bases. 30 31 Patina OS has a guaranteed base already: the image the machine boots is an OCI image, versioned 32 by digest, the same for everyone who runs it. 33 34 ## Decision 35 36 - **An app is a folder** in `~/Apps`, named `Name.app`. Copying it in installs it, 37 deleting it uninstalls it, and the app can update itself by writing to its own folder. 38 `~/Apps`, not `~/Applications`: "apps" is the word people use, and it's short, like `~/bin`. 39 The `.app` ending stays, so the launcher can tell an app from any other folder there. 40 Nothing is installed anywhere else and nothing needs root. 41 - **`app.toml` says how to run it**: its name, the binary to run (`exec`, relative to the 42 folder), its icon, categories, the file types and URL schemes it opens, the commands it 43 offers on the command line, and its base. Anyone can package any binary by putting it in a 44 folder and writing those few lines. 45 - **The base is an OCI image named by digest**: `base = "patina-os:1@sha256:..."`, a Patina OS 46 release. That digest *is* the contract: the app is promised exactly the base it was built on, 47 for as long as it's kept, rather than a hand-written list of libraries promised forever. 48 What isn't in the base, the app carries in its folder (libraries found through `$ORIGIN`). 49 - **The launcher reads `app.toml`.** The Patina desktop's launcher already reads .desktop files 50 (patina-desktop ADR-0010); this grows there (patina-desktop ADR-0027), it isn't a new place. 51 - To start with, only Patina OS bases may be named. The format allows any image, so other bases 52 can be allowed later. 53 54 ``` 55 ~/Apps/Teleprinter.app/ 56 app.toml # name, exec = "bin/teleprinter", icon, categories, 57 # file types, URL schemes, commands, base 58 bin/teleprinter 59 lib/ # its own libraries, found through $ORIGIN 60 icon.svg 61 ``` 62 63 ## Consequences 64 65 - The system and the user's apps are separate: the system changes only by booting another 66 image, and never knows which apps there are; an app never changes the system. 67 - The system can move on (patina-os:2) without breaking apps built on :1: they keep their base 68 (ADR-0003 runs them on it). 69 - One format, one registry and one set of build tools for both the system and the bases apps 70 run on. 71 - Something has to do what macOS's Launch Services does: know which app opens which files and 72 links, from the `app.toml` files. Without it apps feel bolted on. 73 - Commands an app offers need putting on PATH (linked into `~/.local/bin`, or added by the 74 session). 75 - A downloaded folder runs as the user. Whether to say anything the first time one runs (macOS 76 marks downloads as quarantined and checks signatures) is still to decide. 77 - Flatpak and .desktop files can still work beside it, since the launcher reads them; the 78 folder is the native and simplest way, not the only one. 79 - An app's binaries are for one platform. For FreeBSD (ADR-0003), `app.toml` should allow more 80 than one, as a macOS app can carry Intel and Arm binaries together: 81 `bin/linux-x86_64/`, `bin/freebsd-amd64/`.