From e6346989593ed4348f0e297028e21fe388be3e69 Mon Sep 17 00:00:00 2001 From: Pavel Isaev Date: Tue, 3 Nov 2026 16:23:22 +0000 Subject: [PATCH] first commit --- README.md | 43 +++++ examples/desktop-composition.yaml | 31 ++++ examples/host-extensions.yaml | 21 +++ examples/managed-overlay.yaml | 41 +++++ rfc/RFC-0001-architecture.md | 233 ++++++++++++++++++++++++++ rfc/RFC-0002-layers-and-overlays.md | 213 +++++++++++++++++++++++ rfc/RFC-0003-build-and-composition.md | 198 ++++++++++++++++++++++ rfc/RFC-0004-host-extensions.md | 140 ++++++++++++++++ spec/decision-log.md | 29 ++++ spec/open-questions.md | 69 ++++++++ 10 files changed, 1018 insertions(+) create mode 100644 README.md create mode 100644 examples/desktop-composition.yaml create mode 100644 examples/host-extensions.yaml create mode 100644 examples/managed-overlay.yaml create mode 100644 rfc/RFC-0001-architecture.md create mode 100644 rfc/RFC-0002-layers-and-overlays.md create mode 100644 rfc/RFC-0003-build-and-composition.md create mode 100644 rfc/RFC-0004-host-extensions.md create mode 100644 spec/decision-log.md create mode 100644 spec/open-questions.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..fec1d67 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Archipelago — RFC v0 + +**Status:** Initial working baseline +**Version:** 0.0 +**Date:** 2026-11-03 +**Purpose:** Bootstrap the architecture discussion and implementation contract for the Archipelago project. + +> This archive captures decisions and proposals made during the initial RFC Committee discussion. It is an engineering starting point, not a claim that every detail is fully specified or implemented. + +## Documents + +- [`rfc/RFC-0001-architecture.md`](rfc/RFC-0001-architecture.md) — system architecture, boundaries, core invariants. +- [`rfc/RFC-0002-layers-and-overlays.md`](rfc/RFC-0002-layers-and-overlays.md) — OSTree-backed layers, purpose layers, managed overlays and host extensions. +- [`rfc/RFC-0003-build-and-composition.md`](rfc/RFC-0003-build-and-composition.md) — initial build/composition pipeline and filesystem contract. +- [`rfc/RFC-0004-host-extensions.md`](rfc/RFC-0004-host-extensions.md) — unsupported local package injection and update policy. +- [`spec/decision-log.md`](spec/decision-log.md) — accepted decisions and current proposals. +- [`spec/open-questions.md`](spec/open-questions.md) — unresolved design questions. +- [`examples/desktop-composition.yaml`](examples/desktop-composition.yaml) — illustrative composition manifest. +- [`examples/managed-overlay.yaml`](examples/managed-overlay.yaml) — illustrative managed overlay manifest. +- [`examples/host-extensions.yaml`](examples/host-extensions.yaml) — illustrative local host extension state. + +## RFC status vocabulary + +- **Draft** — under discussion. +- **Proposed** — concrete proposal, not yet accepted. +- **Accepted** — approved architectural contract. +- **Rejected** — explicitly declined. +- **Superseded** — replaced by a later decision. + +## Important terminology + +- **Layer commit** — an immutable OSTree commit representing a versioned composition input. +- **Composition** — the deterministic merge of a set of layer commits into a complete filesystem tree. +- **Image commit** — the OSTree commit representing the complete deployable operating-system filesystem. +- **Managed Overlay** — a versioned, registry-published layer with explicitly elevated file replacement permissions. +- **Host Extension** — a local, explicitly unsupported package injection applied to a host deployment through a separate local composition. +- **Purpose** — the system role, initially Desktop, Server, or IoT. + +## Scope note + +Archipelago uses existing Linux mechanisms wherever practical. OSTree is the foundation for filesystem versioning, deployment, update and rollback. `systemd-nspawn`, pacman, makepkg, DKMS, mkinitcpio, depmod, systemd and established bootloader mechanisms are orchestrated rather than reimplemented. + +The exact OSTree representation of a layer, package database strategy, boot integration and filesystem layout remain subject to the detailed contracts listed as open questions. In particular, OSTree does not provide a native semantic layer-merging engine; Archipelago must define and implement deterministic composition. diff --git a/examples/desktop-composition.yaml b/examples/desktop-composition.yaml new file mode 100644 index 0000000..580b28d --- /dev/null +++ b/examples/desktop-composition.yaml @@ -0,0 +1,31 @@ +# Illustrative only. Schema and field names are not frozen. +schema: archipelago.composition/v1 + +metadata: + name: desktop-generic-x86_64 + version: 0.1.0 + architecture: x86_64 + purpose: desktop + channel: testing + +core: + ref: layers/core/arch + commit: "" + +purpose: + ref: layers/purpose/desktop + commit: "" + +overlays: + - ref: layers/overlay/feature-bluetooth + commit: "" + - ref: layers/overlay/feature-virtualization + commit: "" + +build: + package_snapshot: "" + builder: nspawn + reproducibility: pinned-inputs + +output: + image_ref: images/desktop/x86_64/testing diff --git a/examples/host-extensions.yaml b/examples/host-extensions.yaml new file mode 100644 index 0000000..c4419d1 --- /dev/null +++ b/examples/host-extensions.yaml @@ -0,0 +1,21 @@ +# Illustrative local state. Not a published Managed Overlay. +schema: archipelago.host-extensions/v1 + +metadata: + enabled: true + support_status: unsupported + +packages: + - path: ./packages/example-driver-0.1-1-x86_64.pkg.tar.zst + sha256: "" + - path: ./packages/example-tool-2.0-1-any.pkg.tar.zst + sha256: "" + +update_policy: + strategy: best-effort + reapply_as_atomic_set: true + on_failure: + preserve_previous_deployment: true + preserve_local_inputs: true + offer_supported_upstream_deployment: true + silently_drop_packages: false diff --git a/examples/managed-overlay.yaml b/examples/managed-overlay.yaml new file mode 100644 index 0000000..335c3f1 --- /dev/null +++ b/examples/managed-overlay.yaml @@ -0,0 +1,41 @@ +# Illustrative only. Schema and field names are not frozen. +schema: archipelago.layer/v1 + +metadata: + name: hardware/custom-fingerprint + version: 0.1.0 + type: overlay + architecture: + - x86_64 + +compatibility: + core: + commits: + - "" + kernel: + release: + - "" + +packages: + runtime: + - "" + build: + - dkms + - "" + - "" + +overlay: + permissions: + replace: + - path: /usr/lib/udev/rules.d/90-fingerprint.rules + owner_layer: "layers/purpose/desktop" + reason: "Device-specific rule required by the fingerprint sensor" + +build: + environment: arch-nspawn + steps: + - resolve-packages + - build-dkms-modules + - install-modules + - run-depmod + - validate-modules diff --git a/rfc/RFC-0001-architecture.md b/rfc/RFC-0001-architecture.md new file mode 100644 index 0000000..c9e8d5e --- /dev/null +++ b/rfc/RFC-0001-architecture.md @@ -0,0 +1,233 @@ +# RFC-0001: Archipelago System Architecture + +- **Status:** Proposed +- **Version:** 0.0 +- **Date:** 2026-11-03 +- **Scope:** Overall system architecture and component boundaries + +## 1. Summary + +Archipelago is an Arch Linux-based, OSTree-managed generic Linux distribution and operating-system composition platform. + +It provides a declarative way to build, publish, install, update, rebase, roll back and manage operating-system compositions. It also manages selected runtime workloads while preserving the standard Linux filesystem and execution contracts. + +The project must support three execution contexts through one primary `archipelago` CLI/binary: + +1. **Build host** — build packages, layers, compositions, releases and installer artifacts from a supported Linux host. +2. **Installed system** — inspect and manage the local system, compose new deployments, update, rebase, roll back and reconcile runtime workloads. +3. **Installer / live environment** — provision disks and install a published image or OSTree repository onto bare-metal or virtual machines. + +## 2. Goals + +- Build generic Desktop, Server and IoT-purpose distribution images. +- Use OSTree as the central storage and deployment foundation. +- Represent reusable system layers as immutable, versioned OSTree commits. +- Keep all source manifests, composition definitions, RFCs and build recipes in Git. +- Provide registries from the beginning for packages, layers, images and release artifacts. +- Build on generic Linux hosts using isolated Arch Linux build environments. +- Preserve conventional Linux filesystem hierarchy, ELF execution and dynamic linking expectations. +- Prefer existing binary packages over rebuilding software from source. +- Support local and remote builders using the same artifact and manifest contracts. +- Support installation to bare-metal and virtual machines. +- Preserve user data and runtime state across OS updates and purpose changes. +- Clearly separate supported managed composition from explicitly unsupported host modifications. + +## 3. Non-goals + +- Reimplementing OSTree, pacman, systemd, nspawn, DKMS, mkinitcpio, depmod, container runtimes or bootloaders. +- Introducing a Nix-style store-based filesystem or requiring applications to use non-standard binary/library paths. +- Requiring all software to be built from source. +- Making every hardware-specific adaptation part of Arch Core. +- Treating arbitrary host modifications as supported distribution components. +- Building a new init system, package manager or container runtime. + +## 4. Architectural principles + +### 4.1 Reuse existing Linux mechanisms + +Archipelago orchestrates existing tools and defines their contracts and lifecycle. It should not replace mature generic Linux mechanisms without a concrete requirement. + +Initial tool responsibilities: + +| Existing component | Archipelago responsibility | +|---|---| +| OSTree | Content-addressed objects, commits, refs, repository transport, deployments and rollback | +| systemd-nspawn | Isolated Arch build and staging environments | +| pacman / makepkg / repo-add | Package resolution, installation into staging roots, package builds and package repositories | +| Arch Linux Archive | Pinned package repository snapshots | +| DKMS | Build kernel modules for a specific kernel ABI | +| depmod | Generate module dependency metadata | +| mkinitcpio | Generate initramfs images | +| systemd | Service and host lifecycle | +| systemd-boot / BLS or another supported boot integration | Boot deployment selection and startup | + +### 4.2 OSTree is foundational, not the composition engine + +OSTree is the source of truth for immutable filesystem objects, commits, refs and deployments. + +OSTree does not natively define Archipelago's layer dependency resolution, merge semantics, package ownership policy or conflict policy. Those are responsibilities of Archipelago's Composition Engine. + +### 4.3 Conventional Linux compatibility + +The resulting system must remain a conventional Linux filesystem and execution environment: + +- Standard ELF binaries should run without an Archipelago-specific runtime. +- The conventional ELF interpreter path and dynamic linker behavior must be preserved. +- System libraries and binaries use standard locations such as `/usr/lib`, `/usr/bin` and `/usr/share`. +- The distribution follows the selected Arch Linux filesystem layout and its `/usr` merge conventions. +- No mandatory `/nix/store`-style application paths or custom loader semantics are introduced. +- Standard runtime paths and interfaces such as `/etc`, `/var`, `/run`, `/tmp`, `/dev`, `/proc` and `/sys` retain their expected roles. + +### 4.4 Immutable system, persistent state + +The OS deployment is immutable and atomically replaceable. Machine configuration and runtime state remain separate. + +Initial filesystem intent: + +| Path | Intended ownership / behavior | +|---|---| +| `/usr` | Image-owned, immutable system payload | +| `/etc` | Machine configuration, writable and managed with OSTree semantics | +| `/var` | Persistent system and workload state | +| `/home` | Persistent user data | +| `/run` | Volatile runtime state | +| `/tmp` | Temporary writable state | +| `/boot` and ESP | Managed by the selected OSTree/bootloader integration | + +Exact partitioning, symlink layout, `/opt` policy and boot integration are not yet frozen. + +## 5. System components + +### 5.1 Source Registry + +Git is the source of truth for: + +- RFCs and architecture decisions. +- Layer manifests. +- Purpose and composition manifests. +- Package build recipes and patches. +- Build configuration. +- Release definitions and policy. + +A build must record immutable source revision identifiers. + +### 5.2 Package Registry + +A pacman-compatible repository containing binary packages built or curated for Archipelago. Package versions and repository snapshots must be pinned for reproducible composition. + +### 5.3 Layer Registry + +An OSTree repository containing immutable layer commits and metadata. Layer references are discoverable and versioned. A registry may physically share an OSTree repository with image commits while maintaining separate logical namespaces. + +### 5.4 Image Registry + +An OSTree repository/ref namespace containing complete distribution image commits. Each published image must identify its complete composition inputs. + +### 5.5 Release Registry + +Stores distributable artifacts such as installer ISO, RAW and QCOW2 images, repository bundles, checksums, signatures, SBOM and release metadata. + +### 5.6 Build Engine + +Creates isolated Arch build environments, resolves pinned packages, builds packages when required, creates layer trees and publishes layer commits. + +### 5.7 Composition Engine + +Resolves a composition manifest, obtains exact layer commits, applies deterministic filesystem merge rules, validates the result and creates a complete image commit. + +### 5.8 System Manager + +Runs on an installed Archipelago host. It manages desired state, status, update, rebase, deployment preparation, rollback and runtime workload reconciliation. + +### 5.9 Installer + +Runs in a live environment. It provisions storage, initializes the target OSTree repository/deployment, installs a selected image and configures boot integration. + +## 6. Execution contexts + +The `archipelago` binary must expose functionality appropriate to its execution context. + +### Build host + +Must be able to: +- Initialize or provision an Arch build environment. +- Build and publish packages and layer commits. +- Compose and publish image commits. +- Build release and installer artifacts. +- Use local or remote registries/builders. + +The build host itself may be Ubuntu, Fedora, Arch or another supported Linux distribution. The Arch build environment is isolated and controlled by Archipelago. + +### Installed host + +Must be able to: +- Report current deployment and composition. +- Inspect desired and effective state. +- Check and apply updates. +- Rebase to another image/ref. +- Roll back to a prior deployment. +- Add/remove managed layers by changing desired state and building a new deployment. +- Manage Host Extensions under the explicit unsupported policy. +- Reconcile supported runtime workloads. + +### Installer environment + +Must be able to: +- Discover and validate target disks. +- Partition and format according to an installation profile. +- Install from online registry or offline repository/bundle. +- Deploy a selected image. +- Configure bootloader and machine-specific settings. +- Verify installation before reboot. + +## 7. Core invariants + +1. A booted supported system is represented by one complete OSTree image deployment. +2. Layer commits are immutable inputs; composition creates a new complete image commit. +3. No direct pacman mutation of the live host `/usr`. +4. Build and package installation happen in isolated staging environments. +5. Composition is deterministic for fixed inputs and toolchain. +6. Every image records exact layer commit checksums and package inputs. +7. Failed required build or validation steps prevent publication. +8. Persistent user and workload data are not implicitly deleted during update, rollback, rebase or purpose switch. +9. Destructive operations require explicit user intent. +10. Host Extensions do not silently become part of the supported project contract. +11. A Host Extension must not prevent the system from attempting a supported OS update; update behavior is defined in RFC-0004. +12. Local and remote builders produce artifacts conforming to the same schemas. + +## 8. Registry model + +The project starts with registry infrastructure rather than postponing it. + +Logical registries: + +- Git source registry. +- Pacman package registry. +- OSTree layer registry. +- OSTree image registry. +- Release artifact registry. +- Optional OCI registry for build environment images and related build inputs. + +Layer and image registries may share physical OSTree storage. Logical separation is provided by refs, metadata and access policy. + +## 9. Security and trust boundaries + +- Published commits and release artifacts should be signed. +- Registry trust roots and key rotation require a dedicated security RFC. +- Build provenance must identify source revision, builder identity, package snapshot, toolchain and input commits. +- Untrusted AUR or user-supplied package recipes execute only in isolated build environments. +- Host Extensions are an explicit trust downgrade and support boundary, not a privilege escalation mechanism for remote actors. + +## 10. Acceptance criteria for the initial architecture + +- The same `archipelago` program can expose build-host, installed-host and installer workflows. +- A non-Arch Linux build host can create an isolated Arch build environment. +- A base plus purpose composition can produce a complete OSTree image commit. +- The image can be installed into a VM and booted. +- The installed system can report its deployment, update and roll back. +- The source and composition inputs are traceable to Git revisions. +- The resulting system runs ordinary Linux ELF binaries using conventional filesystem and loader contracts. + +## 11. Open questions + +See [`../spec/open-questions.md`](../spec/open-questions.md). diff --git a/rfc/RFC-0002-layers-and-overlays.md b/rfc/RFC-0002-layers-and-overlays.md new file mode 100644 index 0000000..225af3c --- /dev/null +++ b/rfc/RFC-0002-layers-and-overlays.md @@ -0,0 +1,213 @@ +# RFC-0002: Layer, Purpose and Managed Overlay Model + +- **Status:** Proposed +- **Version:** 0.0 +- **Date:** 2026-11-03 +- **Scope:** Reusable OSTree layer commits and composition semantics + +## 1. Summary + +Every managed layer is an independently versioned OSTree commit with a declared semantic position in the composition model. + +Initial layer categories: + +- `core` — Archipelago's generic Arch Linux foundation. +- `purpose` — role-specific distribution payload, initially Desktop, Server and IoT. +- `overlay` — additional managed system payload with explicitly declared composition permissions. + +A Hardware Layer category is intentionally excluded from the initial scope. Generic hardware coverage is provided by Arch Core and its selected kernel(s). Hardware-specific adaptations are represented through Managed Overlays and may be grouped into reusable hardware profile manifests. + +## 2. Terminology + +### Layer + +A versioned composition input stored as an OSTree commit. It has a manifest, metadata, dependencies, compatibility constraints and a filesystem payload. + +### Layer commit + +The immutable OSTree commit identified by its checksum. The commit contains the layer payload tree and associated commit metadata. The exact on-disk payload convention is an implementation detail to be frozen by the artifact format specification. + +Important: an OSTree commit represents a tree. OSTree does not itself provide a native semantic layer merge operation. Archipelago defines how layer payload trees are interpreted and merged into a staging filesystem. + +### Purpose + +A distribution role. Initial values: + +- `desktop` +- `server` +- `iot` + +Purpose is a first-class semantic category, not a separate operating-system implementation. + +### Managed Overlay + +A managed, versioned layer with explicitly granted ability to replace files from lower composition positions. It is published to the Layer Registry and participates in normal compatibility validation and provenance. + +### Hardware profile + +A Git-managed manifest or profile definition that selects one or more Managed Overlays and their configuration. It is not a separate layer category in the initial model. + +### Composition + +The deterministic application of the selected Core, Purpose and Managed Overlay commits into a complete filesystem tree, followed by creation of a complete image OSTree commit. + +## 3. Initial composition order + +The initial logical order is: + +1. Exactly one Arch Core. +2. Exactly one Purpose layer. +3. Zero or more Managed Overlays in a resolved deterministic order. + +Illustrative graph: + +```text +Arch Core + └── Purpose: Desktop + ├── Managed Overlay: hardware/hp-elite-x2 + ├── Managed Overlay: hardware/custom-fingerprint + └── Managed Overlay: feature/virtualization + ↓ + Complete image commit +``` + +A composition may select a different Purpose, but it must still resolve to one complete image commit. + +The ordering is logical and does not imply OSTree has native layer stacking. The Composition Engine performs the merge. + +## 4. Arch Core responsibilities + +Arch Core provides the generic Linux foundation, including: + +- Base userspace and package management foundations. +- Kernel flavor(s) selected by the distribution contract. +- Generic firmware and drivers included in the Core package set. +- systemd and base system services. +- Standard filesystem hierarchy and runtime interfaces. +- Base initramfs and boot integration inputs. + +Initial hardware support is bounded by the hardware support provided by Arch Core and its selected kernels. Hardware-specific expansion is not a separate mandatory Hardware Layer at this stage. + +## 5. Purpose responsibilities + +Purpose layers provide role-specific packages, configuration and services. + +Examples: + +- Desktop: desktop environment, display manager, audio stack, desktop services and related tooling. +- Server: server-oriented tools, services and operational defaults. +- IoT: selected runtime, device/service integration and function-specific packages. + +Purpose layers must not assume that a particular hardware model is present unless that dependency is explicitly expressed through a Managed Overlay or profile. + +## 6. Managed Overlay responsibilities + +Managed Overlays may provide: + +- DKMS modules and other kernel modules. +- Additional firmware. +- Hardware-specific configuration. +- Udev rules. +- Systemd units and drop-ins. +- Kernel parameters and initramfs configuration. +- Feature-specific packages and services. +- Explicit file replacements or adaptations of lower layers. + +Overlays should be as reusable as possible. A hardware profile may compose multiple overlays for a specific machine or device family. + +## 7. Overlay permissions and replacement semantics + +A Managed Overlay has ordinary layer capabilities by default: it may add files where no conflicting owner exists. + +Replacing a file owned by a lower layer requires explicit permission in the overlay manifest. + +The permission must identify: +- The target path or declared path set. +- The lower layer or owner being replaced, unless a narrowly scoped wildcard is explicitly approved. +- The operation type. +- A reason or justification. +- Optional expected content hash/version to guard against stale overrides. + +An unrestricted `replace_lower_layer_files: true` capability may be supported for explicitly trusted overlays, but it must be visible in metadata, review output and build logs. It must never be granted implicitly. + +Persistent machine state is not a normal overlay target. `/var`, `/home`, `/run`, `/tmp`, `/dev`, `/proc` and `/sys` are excluded from ordinary layer payload composition. `/etc` and `/boot` require dedicated integration rules and are not treated as ordinary unrestricted payload paths. + +## 8. Conflict rules + +Default rule: two layers may not silently claim or replace the same path. + +The Composition Engine must: +- Track path ownership across all input layers. +- Detect file/file, file/directory, symlink and type conflicts. +- Fail composition on undeclared conflicts. +- Permit explicitly authorized replacement according to the manifest. +- Record the winning owner and replacement chain in composition metadata. +- Produce a human-readable composition diff before apply/publish. + +Two Managed Overlays that conflict must fail unless the later overlay explicitly declares the replacement relationship. Overlay order must be deterministic and must not depend on incidental registry enumeration or filesystem traversal order. + +## 9. Package database consistency + +Package installation and replacement must be performed in the isolated staging root using pacman-compatible mechanisms. + +The final filesystem and package database must describe a coherent state. File-level replacement that bypasses package ownership must be recorded as an explicit unmanaged file override in provenance and must not silently falsify pacman ownership information. + +The exact package database model across independently built layer commits is an open question. It must be resolved before production implementation of composition. + +## 10. DKMS and kernel compatibility + +A Managed Overlay containing kernel modules must declare compatibility with the exact Core/kernel artifact or an equally strong kernel ABI identity. + +A kernel change invalidates an overlay's module compatibility unless the overlay explicitly supports the new ABI and validation confirms it. + +Required DKMS build failures block publication of the affected overlay and any image depending on it. + +Validation should include: +- Kernel release and ABI match. +- Expected module files exist. +- `depmod` succeeds. +- Module dependencies resolve. +- Required modules are included in initramfs where necessary. +- Module signing is performed when required by the target Secure Boot policy. + +## 11. Layer metadata and provenance + +Every published layer must expose at least: + +- Layer name and immutable version. +- Layer category and semantic position. +- Architecture. +- OSTree commit checksum. +- Manifest schema version. +- Dependencies and compatibility constraints. +- Git source repository and commit. +- Package names, versions and package repository snapshot. +- Build environment identity. +- Build toolchain identity. +- Validation results. +- Overlay permissions, if applicable. +- Signature/provenance reference. + +Semantic versions are human-facing labels. OSTree commit checksums are the immutable content identity. + +## 12. Reuse and compatibility + +A layer can be reused by multiple compositions only when all declared compatibility constraints are satisfied. + +A layer version must never be silently retargeted to different content. A changed payload or manifest creates a new immutable commit and version identity. + +Composition manifests must pin exact commit checksums for reproducible builds. Human-friendly refs/channels may be used for discovery and update selection, but a resolved build lock must record exact checksums. + +## 13. Acceptance criteria + +- Core, Purpose and Overlay commits can be independently published and retrieved. +- A composition can resolve exact commits from the Layer Registry. +- The Composition Engine can deterministically merge them. +- Undeclared file conflicts fail the build. +- Explicitly authorized overlay replacements succeed and are recorded. +- Kernel-bound overlays reject incompatible Core/kernel changes. +- The resulting complete image is an OSTree commit with traceable inputs. + +## 14. Open questions + +See [`../spec/open-questions.md`](../spec/open-questions.md). diff --git a/rfc/RFC-0003-build-and-composition.md b/rfc/RFC-0003-build-and-composition.md new file mode 100644 index 0000000..f2ab684 --- /dev/null +++ b/rfc/RFC-0003-build-and-composition.md @@ -0,0 +1,198 @@ +# RFC-0003: Build Engine, Composition Engine and Linux Filesystem Contract + +- **Status:** Proposed +- **Version:** 0.0 +- **Date:** 2026-11-03 +- **Scope:** Build and composition pipeline, generic Linux compatibility + +## 1. Summary + +Archipelago builds and composes operating-system artifacts using existing Linux and Arch Linux tools in controlled environments. + +The default strategy is binary package reuse. Source builds are performed only when necessary for project-owned software, patches/adaptations, unavailable binary packages or kernel modules such as DKMS. + +## 2. Build host independence + +The build host may be a supported Linux distribution other than Arch Linux. + +Archipelago provisions an isolated Arch Linux build environment, initially using `systemd-nspawn` and a pinned Arch Linux package snapshot. The build host's package manager and host filesystem must not be used to mutate the target system root. + +Non-Linux build hosts are out of initial scope unless they provide a supported Linux VM or remote Linux builder. + +## 3. Build environment + +The initial build environment is an Arch Linux root filesystem created and managed by Archipelago. + +Responsibilities: +- Pin the Arch Linux Archive snapshot or controlled package repository state. +- Install build tools and package dependencies. +- Execute pacman and makepkg operations. +- Provide target architecture and kernel build context. +- Keep build outputs and logs outside the immutable build root where practical. +- Capture toolchain and environment identity. + +`systemd-nspawn` is the initial isolation mechanism. The architecture should not hard-code nspawn-specific behavior into manifests where a future isolated OCI or VM worker could implement the same build contract. + +## 4. Binary-first package policy + +Default package flow: +1. Resolve a package from a pinned binary repository. +2. Verify package identity and integrity. +3. Install it into the staging root. +4. Record package name, version, architecture, repository and checksum. + +Build from source only when needed: +- Archipelago-owned software. +- Required patching or adaptation. +- Missing compatible binary package. +- AUR package selected by a managed profile. +- DKMS or other kernel-ABI-specific module build. + +AUR recipes and user-supplied build inputs are untrusted code and must execute only inside isolated build environments. + +## 5. Composition pipeline + +Initial logical pipeline: + +```text +Git source revision + | + v +Resolve composition manifest + | + v +Resolve exact layer commits and dependencies + | + v +Resolve pinned package/build inputs + | + v +Create isolated Arch staging environment + | + v +Assemble layer payloads into staging filesystem + | + v +Apply deterministic merge and explicit override rules + | + v +Run configuration hooks and validations + | + v +Validate package database and filesystem policy + | + v +Create complete OSTree image commit + | + v +Sign and publish refs + provenance + | + v +Build release artifacts when requested +``` + +This pipeline is a contract-level outline. Exact staging-root implementation and OSTree APIs are to be specified in implementation RFCs. + +## 6. OSTree responsibilities + +OSTree is used for: +- Immutable object storage and deduplication. +- Layer and image commits. +- Refs and channels. +- Repository transport and publication. +- Deployment preparation. +- Atomic update and rollback. + +Archipelago is responsible for: +- Layer semantics and dependency resolution. +- Merge ordering and conflict handling. +- Package database coherence. +- Build hooks and validation. +- Composition provenance. +- Policy enforcement. + +A layer commit is an OSTree commit, but OSTree does not automatically merge multiple commits as semantic layers. The Composition Engine must produce the resulting complete tree and commit it. + +## 7. Conventional filesystem contract + +The resulting distribution follows the conventional Linux filesystem hierarchy and Arch Linux's selected `/usr`-merged layout. + +Requirements: +- Normal executable paths such as `/usr/bin`. +- Normal library paths such as `/usr/lib`. +- Standard ELF interpreter and dynamic linker behavior. +- Standard glibc ABI for the selected Arch base. +- Standard shared data paths such as `/usr/share`. +- No mandatory Nix-style content-addressed application path. +- Ordinary Linux binaries must not require an Archipelago-specific loader or runtime. + +The exact `/bin`, `/sbin`, `/lib` and `/lib64` symlink policy follows the chosen Arch base and must be tested rather than invented independently. + +## 8. Mutable and immutable paths + +Initial intent: + +- `/usr`: image-owned immutable payload. +- `/etc`: machine-specific writable configuration, using OSTree's configuration handling. +- `/var`: persistent state shared across deployments within the installation. +- `/home`: persistent user data. +- `/run`: volatile runtime state. +- `/tmp`: temporary writable state. +- `/boot` and ESP: managed by the chosen boot integration. +- `/opt`: conventional location; ownership and update policy require a separate decision. + +Layer payloads must not directly inject persistent user data. The exact path allowlist/denylist and special handling of `/etc`, `/boot` and `/opt` are open questions. + +## 9. Hooks and scripts + +Hooks may be used for build-time configuration and validation. They must be: +- Declared in the source manifest. +- Executed in a controlled build environment. +- Deterministic where possible. +- Logged and included in provenance. +- Prohibited from modifying the build host. +- Subject to explicit network access policy. + +Runtime first-boot actions are a separate mechanism and must not be confused with build-time hooks. + +## 10. Caching + +The build system should cache: +- Downloaded binary packages. +- Built packages. +- Build environment images/rootfs. +- Layer commits. +- Intermediate staging outputs where safe. + +Cache keys must include all relevant inputs, including source revision, package snapshot, architecture, toolchain, build configuration and dependency commit checksums. + +A cache hit must not bypass signature verification or required validation. + +## 11. Reproducibility and provenance + +For each layer and image, record: +- Git revision. +- Exact input layer commit checksums. +- Package repository snapshot. +- Package checksums and versions. +- Build environment and toolchain identity. +- Build commands/hooks. +- Validation results. +- Output OSTree commit checksum. +- Signature and signing identity. + +Bit-for-bit reproducibility is a target, but the project must distinguish it from traceability and repeatable dependency resolution. Any nondeterministic inputs must be identified. + +## 12. Acceptance criteria + +- Build runs on a supported non-Arch Linux host. +- Build isolation prevents host package/filesystem mutation. +- Binary packages are used by default. +- A composition produces a complete OSTree image commit. +- Standard Linux ELF binaries execute without a custom Archipelago runtime. +- Package and layer provenance is queryable. +- Undeclared filesystem conflicts block publication. + +## 13. Open questions + +See [`../spec/open-questions.md`](../spec/open-questions.md). diff --git a/rfc/RFC-0004-host-extensions.md b/rfc/RFC-0004-host-extensions.md new file mode 100644 index 0000000..df24e0d --- /dev/null +++ b/rfc/RFC-0004-host-extensions.md @@ -0,0 +1,140 @@ +# RFC-0004: Host Extensions and Unsupported Local Modifications + +- **Status:** Proposed; update policy B accepted in discussion +- **Version:** 0.0 +- **Date:** 2026-11-03 +- **Scope:** Local package injection outside the supported managed composition + +## 1. Summary + +Host Extensions provide an explicitly unsupported mechanism for installing local `.pkg.tar.zst` packages into a host-specific composition. + +The feature exists for experimentation, unusual hardware, one-off utilities, patched packages and other modifications that should not become part of the supported Archipelago distribution contract. + +Host Extensions are separate from Managed Overlays: +- Managed Overlays are Git-defined, versioned, registry-published and validated. +- Host Extensions are local, user-controlled and explicitly outside the project's support guarantee. + +## 2. User intent and support boundary + +Enabling or installing the first Host Extension marks the resulting host composition as `unsupported`. + +This status means: +- Archipelago does not guarantee compatibility of the modified composition. +- Issues caused by local packages or their interactions are not project defects. +- The project is not obligated to modify Arch Core, Composition Engine, project source code or RFCs to accommodate a local Host Extension. +- Users remain responsible for package selection, provenance, compatibility and recovery. + +This policy does not prohibit users from reporting bugs in unmodified Archipelago components. The project may investigate issues that can be reproduced without Host Extensions, but no obligation to support the modified composition is created. + +## 3. No direct mutation of the live system + +Host Extensions must not run pacman against the live immutable host `/usr`. + +Instead: +1. User explicitly enables Host Extensions and acknowledges the unsupported status. +2. Archipelago imports or references local `.pkg.tar.zst` packages. +3. Packages are verified and recorded. +4. A staging root is created from the selected base image. +5. pacman installs the local packages into the staging root with a coherent package database. +6. Composition validation runs. +7. A local host-specific OSTree commit is created. +8. A new deployment is prepared. +9. The user activates it through the normal deployment lifecycle. + +The exact implementation may use a local pacman repository or a controlled package file set. It must not simply unpack archives over `/usr`. + +## 4. Local state and history + +Host Extension inputs and state must persist independently of the currently booted deployment. + +Illustrative layout: + +```text +/var/lib/archipelago/host-extensions/ +├── packages/ +├── repository/ +├── manifests/ +├── history/ +└── metadata/ +``` + +The final path is not frozen. The required properties are: +- Inputs survive OS updates and rollback. +- The user can inspect installed local packages and their origins. +- A previous Host Extension set can be restored. +- No package is silently discarded during update. +- Cleanup requires explicit user action. + +## 5. Update policy: best-effort reapplication (Option B) + +**Decision: Option B is selected.** + +When a supported upstream image is updated: +1. Archipelago resolves and verifies the new supported image. +2. It attempts to reapply the current Host Extension package set to the new image in staging. +3. If all packages install and validation passes, Archipelago creates a new unsupported host-specific image commit containing the updated base plus Host Extensions. +4. If reapplication fails, Archipelago must not silently force incompatible packages into the new image. +5. The supported upstream image remains installable and bootable without Host Extensions. +6. The user is informed that the new deployment excludes some or all Host Extensions and is given a clear diff and recovery choice. +7. The previous deployment and local package inputs remain available for rollback or manual repair. + +The exact activation UX must be designed so the user does not accidentally lose access to their previous working deployment. + +### 5.1 Failure handling + +A failed Host Extension reapplication must not: +- Corrupt the upstream image commit. +- Modify the registry's supported image. +- Delete local package inputs. +- Delete the previous deployment. +- Prevent the user from selecting the unmodified supported image. + +Archipelago may offer: +- Boot the updated supported image without Host Extensions. +- Keep the previous deployment. +- Retry after user changes the local package set. +- Export diagnostics. + +### 5.2 Partial reapplication + +The default should be atomic as a set: either the declared Host Extension set is reapplied and validated as a whole, or the resulting deployment is created without that set. Partial application must require an explicit future policy and user-visible declaration. + +## 6. Status model + +Initial statuses: + +- `supported` — no Host Extensions are present in the effective host composition. +- `unsupported` — one or more Host Extensions are applied. +- `recovery` — the user is selecting or restoring a known deployment after a failed transition. + +Status must be queryable through `archipelago status` and visible before update/apply operations. + +## 7. Rollback and removal + +- Rollback must preserve the prior deployment and its Host Extension metadata. +- Removing Host Extensions means composing a new deployment without them; it must not mutate the existing commit. +- Disabling the feature must not delete local package files or history unless the user explicitly requests cleanup. +- A user must be able to return to a supported composition by selecting/rebuilding from a supported image without Host Extensions. + +## 8. Security considerations + +- Local package files are untrusted inputs. +- Package signatures and integrity must be checked according to configured policy. +- Package install scripts execute only in the isolated staging environment. +- Host Extensions must not grant remote actors additional privileges. +- Unsupported status is a support classification, not a sandbox or security boundary. + +## 9. Acceptance criteria + +- A user can install a local `.pkg.tar.zst` without mutating the live `/usr`. +- A new local OSTree deployment is created. +- The system reports `unsupported`. +- Local package inputs survive OS update and rollback. +- On upstream update, Archipelago attempts atomic best-effort reapplication. +- If reapplication fails, the supported upstream image remains deployable and the prior deployment is preserved. +- The user receives actionable diagnostics and an explicit deployment choice. + +## 10. Open questions + +See [`../spec/open-questions.md`](../spec/open-questions.md). diff --git a/spec/decision-log.md b/spec/decision-log.md new file mode 100644 index 0000000..346b7f8 --- /dev/null +++ b/spec/decision-log.md @@ -0,0 +1,29 @@ +# Archipelago Decision Log + +This file is the compact record of architectural decisions discussed by the RFC Committee. + +| ID | Decision | Status | +|---|---|---| +| D-001 | OSTree is the foundation for immutable filesystem storage, commits, refs, deployments, updates and rollback. | Proposed | +| D-002 | Archipelago uses existing Linux mechanisms (nspawn, pacman, DKMS, mkinitcpio, depmod, systemd) rather than reimplementing them. | Proposed | +| D-003 | A managed Layer is an independently versioned OSTree commit. | Proposed | +| D-004 | A composition resolves layer commits and produces one complete image OSTree commit. | Proposed | +| D-005 | Source manifests, RFCs, composition definitions and build recipes are stored in Git. | Proposed | +| D-006 | Registry infrastructure is part of the initial architecture, not a later optional feature. | Proposed | +| D-007 | Initial purpose categories are Desktop, Server and IoT. | Proposed | +| D-008 | A dedicated Hardware Layer category is excluded from the initial scope; generic support comes from Arch Core and its kernel capabilities. | Proposed | +| D-009 | Hardware-specific adaptations can be expressed through Managed Overlays and hardware profile manifests. | Proposed | +| D-010 | Managed Overlays are versioned OSTree commits and may replace lower-layer files only with explicit permissions. | Proposed | +| D-011 | DKMS modules are built against a specific kernel ABI and required build/validation failures block publication. | Proposed | +| D-012 | Binary packages are preferred; source builds are exceptions for adaptation, unavailable packages, project-owned software and DKMS. | Proposed | +| D-013 | The resulting OS preserves conventional Linux filesystem and ELF execution contracts; no Nix-style store model is introduced. | Proposed | +| D-014 | Host Extensions allow explicit local `.pkg.tar.zst` injection outside the supported managed composition. | Proposed | +| D-015 | Applying Host Extensions changes host support status to `unsupported`. | Proposed | +| D-016 | Host Extension failures do not obligate changes to Arch Core, Archipelago source code or RFCs. | Proposed | +| D-017 | Host Extension update behavior uses best-effort reapplication (Option B); on failure, deploy the supported upstream image without extensions as an available choice and preserve the prior deployment and local inputs. | Accepted | +| D-018 | Host Extensions must not directly mutate the live immutable `/usr`; they are applied in staging and materialized as a local OSTree deployment. | Proposed | +| D-019 | Persistent user and runtime state must not be implicitly deleted by update, rollback, rebase or purpose changes. | Proposed | + +## Status guidance + +Only mark a decision `Accepted` after explicit approval in RFC Committee discussion. The initial archive deliberately leaves most decisions as `Proposed` because the broader contracts remain incomplete. diff --git a/spec/open-questions.md b/spec/open-questions.md new file mode 100644 index 0000000..45946e6 --- /dev/null +++ b/spec/open-questions.md @@ -0,0 +1,69 @@ +# Archipelago Open Questions + +This list tracks decisions that must be resolved before the corresponding implementation becomes stable. + +## Layer and composition model + +1. What exact filesystem representation does a Layer OSTree commit use: a root-relative payload tree, a defined namespace inside the commit, or another explicit format? +2. How are Core and Purpose cardinality and compatibility expressed? +3. What dependency solver semantics are required: version ranges, feature constraints, architecture constraints and conflict declarations? +4. How are overlay ordering constraints expressed and made deterministic? +5. What is the exact syntax and authorization model for file replacement? +6. How are directory merges, symlinks, file modes, xattrs, capabilities, hardlinks and ownership represented? +7. How is package database coherence maintained across separately built layer commits? +8. How are `/etc`, `/boot`, `/opt` and generated files handled? +9. Is an overlay allowed to replace package-owned files only through package replacement, or may it use explicit file-level overrides? + +## Kernel and DKMS + +10. What exact kernel identity is pinned: package version, `pkgbase`, `uname -r`, ABI fingerprint or all of these? +11. How are multiple kernel flavors represented in one Core or image? +12. What is the policy for Secure Boot module signing and key enrollment? +13. How are initramfs generation and module inclusion declared? +14. How are kernel updates coordinated with all dependent Managed Overlays? + +## Build and registries + +15. Which Git hosting and CI implementation is targeted first? +16. Which OSTree transport and registry server implementation is selected? +17. How are registry authentication, signing keys, trust roots and key rotation managed? +18. Which package repositories and Arch Linux Archive snapshots are supported? +19. What is the exact package lockfile format? +20. What build cache key and invalidation contract is required? +21. How are OCI build environments represented, if adopted? +22. What is the release artifact storage implementation? + +## System and installer + +23. Which OSTree boot integration is selected initially? +24. Which filesystem and partition layout is the MVP default: ext4 or Btrfs, single root or separate state partitions? +25. How are OSTree `/etc` three-way merges and configuration conflicts surfaced? +26. How are offline installation bundles structured? +27. How are LUKS2, TPM2 and Secure Boot sequenced in the roadmap? +28. What is the recovery workflow if a deployment or bootloader update fails? + +## Host Extensions + +29. Does Host Extension state represent exact package files, a local pacman repository, a package lock, or a combination? +30. Are package signatures mandatory, and what is the policy for unsigned local packages? +31. How is a failed best-effort reapplication presented in CLI and boot UX? +32. Is fallback to the upstream supported image automatic, or must the user explicitly select it? +33. How are package removals and dependency cleanup handled? +34. Can users opt into reapplying only selected Host Extensions, or is the set atomic in MVP? +35. How are local DKMS packages rebuilt after a kernel update? +36. What exact wording and behavior defines the `unsupported` status? + +## Runtime workloads + +37. Which workload managers are in MVP: Flatpak, Distrobox, Podman, Docker, k3s? +38. What is the ownership boundary between immutable binaries/units and persistent workload data? +39. How are workloads reconciled during a Purpose switch? +40. What backup/migration contract is required for `/var` state? + +## CLI and API + +41. What is the stable manifest schema and validation/error model? +42. Which operations require root? +43. Is a background daemon needed, or is a CLI-driven transactional model sufficient initially? +44. How are remote builder selection and job execution represented? +45. What API contract is required for future GUI integration?