Watch
1
0
Fork
You've already forked souveraine
0

publish: the public projection begins here

This is a projection, not a development branch. The tree above was constructed
from the internal source named below under a manifest that decides which paths
may leave, then scanned as a whole tree rather than as a series of patches, and
only then published.

Public history starts here because the history before it was not admissible,
and neither was the tree. What used to stand in this repository included a
rescue copy of another machine, a directory of phone handoffs, deployment
wired to one house, and a submodule pointing at a forge no stranger can reach.
None of that was ever the product. It stays in the private forge, which is
allowed to hold the whole working organism, and this is what was deliberately
sent out instead.

Three mechanisms produced this tree, in decreasing order of trust. A top-level
path the manifest does not name never arrives at all, which is the one that
catches directories nobody has thought of yet. Named internal files inside
admitted roots are dropped. A short, reviewed table replaces deployment
defaults that a public build must not carry -- an endpoint aimed at one LAN, a
VPN profile belonging to one phone, packaging built from one checkout path.

Everything after this commit is an ordinary publication with the same three
trailers, so a force push stops being routine and starts meaning that
something deliberate happened. The trailers bind the projection to its source
without pretending the public SHA is the private one: same lineage, different
tree, and the record says so.

Source-Sha: 8f27b1e76a8fef560a336aba18e6990713ff1047
Policy-Sha: 6b261d2f3e6e1fb19874846ba4bb1dfe15565d25b8618c1c1afba0419c101d27
Tree-Digest: 18ec3563c5e5ef9a414993a9f6734b251ff9ed3cd56eebdd6cac01e45c6e3067
This commit is contained in:
Fimeg 2026-09-04 15:55:48 -04:00
commit 8f42fc953d
1476 changed files with 238455 additions and 0 deletions

View file

@ -0,0 +1,7 @@
[Login]
# ViewTop reports physical button edges to sessiond, which recognises the
# gesture and owns the resulting lock, panel or power action. Letting logind's
# default short press power the machine off gives the same button a second
# authority and makes a compositor recovery attempt become a shutdown.
HandlePowerKey=ignore
HandlePowerKeyLongPress=ignore

56
packaging/arch/PKGBUILD Normal file
View file

@ -0,0 +1,56 @@
# Maintainer: Fimeg <casey.tunturi@gmail.com>
# Souveraine — sovereign agent substrate. Part of the SouveraineOS layer;
# the phone runs the same server + agents as the desktop.
pkgname=souveraine
pkgver=0.1.0
pkgrel=1
pkgdesc="Sovereign agent substrate — server, TUI, surfaces"
arch=('aarch64' 'x86_64')
url="https://github.com/Fimeg/souveraine"
license=('MIT')
depends=('gcc-libs' 'polkit')
makedepends=('cargo' 'git')
options=('!lto')
# Build from the local checkout synced by deploy-souveraine.sh (or a git
# clone at $HOME/souveraine-src on device). No network fetch — the
# phone builds what the laptop ships. Override with SOUVERAINE_SRCDIR.
_srcdir="${SOUVERAINE_SRCDIR:-$HOME/souveraine-src}"
pkgver() {
cd "$_srcdir"
git describe --tags --always 2>/dev/null | sed 's/^v//;s/-/./g' || echo "$pkgver"
}
build() {
cd "$_srcdir"
cargo build --release --locked
}
package() {
cd "$_srcdir"
install -Dm755 target/release/souveraine "$pkgdir/usr/bin/souveraine"
# repo unit points at ~/.local/bin (desktop dev install); packaged unit
# runs the pacman-owned binary
sed 's|%h/.local/bin/souveraine|/usr/bin/souveraine|' packaging/souveraine.service \
| install -Dm644 /dev/stdin "$pkgdir/usr/lib/systemd/user/souveraine.service"
# System tier: machine identity daemon + its service user. pacman runs
# systemd-sysusers on install, so the `souveraine` user exists before
# anyone runs `souveraine machine init`.
install -Dm755 target/release/souveraine-admit "$pkgdir/usr/bin/souveraine-admit"
install -Dm755 target/release/souveraine-machined "$pkgdir/usr/bin/souveraine-machined"
install -Dm644 packaging/souveraine-machined.service \
"$pkgdir/usr/lib/systemd/system/souveraine-machined.service"
install -Dm644 packaging/arch/souveraine.sysusers \
"$pkgdir/usr/lib/sysusers.d/souveraine.conf"
# Let the active local session power off / reboot / suspend / hibernate
# without an interactive polkit challenge — otherwise the lock surface
# (no agent above session lock) silently no-ops these and every shutdown
# is a fastboot hard-reboot.
install -Dm644 packaging/arch/souveraine-login1.rules \
"$pkgdir/etc/polkit-1/rules.d/49-souveraine-login1.rules"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

View file

@ -0,0 +1,46 @@
# Maintainer: Casey Tunturi
pkgname=souveraine-provision-x86-laptop
pkgver="${SOUVERAINE_PKGVER:?CI must set SOUVERAINE_PKGVER}"
pkgrel=1
pkgdesc='SouveraineOS commissioning and session activation for x86_64 laptops'
arch=('x86_64')
url='https://forge.caseytunturi.com/Fimeg/souveraine'
license=('AGPL-3.0-or-later')
depends=('souveraine' 'souveraine-viewtop' 'souveraine-shell' 'systemd')
source=('souveraine-machine-firstboot.service'
'souveraine-provision-x86-laptop.tmpfiles'
'50-souveraine-power-key.conf'
'LICENSE')
sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP')
package() {
install -Dm644 "$srcdir/souveraine-machine-firstboot.service" \
"$pkgdir/usr/lib/systemd/system/souveraine-machine-firstboot.service"
install -Dm644 "$srcdir/souveraine-provision-x86-laptop.tmpfiles" \
"$pkgdir/usr/lib/tmpfiles.d/souveraine-provision-x86-laptop.conf"
install -Dm644 "$srcdir/50-souveraine-power-key.conf" \
"$pkgdir/usr/lib/systemd/logind.conf.d/50-souveraine-power-key.conf"
# The profile owns activation. Package install lays down the dependency
# graph without running a post-install hook or writing into /etc.
install -dm755 "$pkgdir/usr/lib/systemd/system/multi-user.target.wants"
ln -s ../souveraine-machine-firstboot.service \
"$pkgdir/usr/lib/systemd/system/multi-user.target.wants/souveraine-machine-firstboot.service"
ln -s ../souveraine-machined.service \
"$pkgdir/usr/lib/systemd/system/multi-user.target.wants/souveraine-machined.service"
install -dm755 \
"$pkgdir/usr/lib/systemd/user/graphical-session-pre.target.wants" \
"$pkgdir/usr/lib/systemd/user/graphical-session.target.wants" \
"$pkgdir/usr/lib/systemd/user/souveraine-sessiond.service.wants"
ln -s ../souveraine-sessiond.service \
"$pkgdir/usr/lib/systemd/user/graphical-session-pre.target.wants/souveraine-sessiond.service"
ln -s ../souveraine-shell.service \
"$pkgdir/usr/lib/systemd/user/graphical-session.target.wants/souveraine-shell.service"
ln -s ../souveraine-sensord.service \
"$pkgdir/usr/lib/systemd/user/souveraine-sessiond.service.wants/souveraine-sensord.service"
install -Dm644 "$srcdir/LICENSE" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

247
packaging/arch/publish-version.sh Executable file
View file

@ -0,0 +1,247 @@
#!/usr/bin/env bash
# Build and publish one immutable, signed pacman repository for a version tag.
#
# The tag is the release decision. It must be an annotated signed vMAJOR.MINOR.PATCH
# tag whose commit is already reachable from internal Gitea's public branch. This
# job publishes only to internal Gitea. Publication Rail copies the exact tag and
# these exact bytes to Forge after its independent checks pass.
set -euo pipefail
TAG="${1:?usage: publish-version.sh <tag> <repo-dir> [extra-asset ...]}"
REPO_DIR="${2:?usage: publish-version.sh <tag> <repo-dir> [extra-asset ...]}"
shift 2
EXTRA_ASSETS=("$@")
: "${RELEASE_TOKEN:?RELEASE_TOKEN must be set}"
: "${ARCHIVE_KEY:?ARCHIVE_KEY must be set}"
[[ "$TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] \
|| { echo "FATAL: stable release tag must be vMAJOR.MINOR.PATCH" >&2; exit 1; }
SERVER="${GITHUB_SERVER_URL:?GITHUB_SERVER_URL must be set}"
ARCHIVE_REPO="${ARCHIVE_REPO:-${GITHUB_REPOSITORY:?GITHUB_REPOSITORY must be set}}"
API="$SERVER/api/v1"
AUTH="Authorization: token $RELEASE_TOKEN"
log() { echo "[publish-version] $*"; }
api() { curl -sf -H "$AUTH" "$@"; }
TAG_OBJECT=$(git rev-parse --verify "$TAG^{tag}" 2>/dev/null) \
|| { echo "FATAL: $TAG is not an annotated tag" >&2; exit 1; }
COMMIT=$(git rev-parse --verify "$TAG^{commit}")
if [ "$COMMIT" != "${GITHUB_SHA:?GITHUB_SHA must be set}" ]; then
echo "FATAL: $TAG peels to $COMMIT, workflow is building $GITHUB_SHA" >&2
exit 1
fi
git merge-base --is-ancestor "$COMMIT" refs/remotes/origin/public \
|| { echo "FATAL: $TAG is not reachable from internal public" >&2; exit 1; }
# Trust in the signer is checked by the root-owned boundary service. The product
# job only refuses unsigned/lightweight tags so it cannot accidentally mint a
# release shape the boundary will never accept.
git cat-file tag "$TAG_OBJECT" \
| grep -Eq '^-----BEGIN (PGP|SSH) SIGNATURE-----$' \
|| { echo "FATAL: $TAG has no Git tag signature" >&2; exit 1; }
STAGE=$(mktemp -d)
trap 'rm -rf "$STAGE"' EXIT
ASSETS="$STAGE/assets"
mkdir -p "$ASSETS"
for ARCH_DIR in "$REPO_DIR"/*/; do
[ -d "$ARCH_DIR" ] || continue
ARCH=$(basename "$ARCH_DIR")
shopt -s nullglob
PKGS=("$ARCH_DIR"*.pkg.tar.zst)
shopt -u nullglob
[ ${#PKGS[@]} -gt 0 ] || continue
DB="souveraine-$ARCH"
WORK="$STAGE/$ARCH"
mkdir -p "$WORK"
for package in "${PKGS[@]}"; do
[ -f "$package.sig" ] \
|| { echo "FATAL: unsigned package $(basename "$package")" >&2; exit 1; }
gpg --batch --verify "$package.sig" "$package"
cp "$package" "$package.sig" "$ASSETS/"
done
repo-add --include-sigs --sign --key "$ARCHIVE_KEY" \
"$WORK/$DB.db.tar.zst" "${PKGS[@]}"
gpg --batch --verify "$WORK/$DB.db.tar.zst.sig" "$WORK/$DB.db.tar.zst"
rm -f "$WORK/$DB.db" "$WORK/$DB.db.sig"
cp "$WORK/$DB.db.tar.zst" "$ASSETS/$DB.db.tar.zst"
cp "$WORK/$DB.db.tar.zst.sig" "$ASSETS/$DB.db.tar.zst.sig"
cp "$WORK/$DB.db.tar.zst" "$ASSETS/$DB.db"
cp "$WORK/$DB.db.tar.zst.sig" "$ASSETS/$DB.db.sig"
if [ -f "$WORK/$DB.files.tar.zst" ]; then
cp "$WORK/$DB.files.tar.zst" "$ASSETS/$DB.files.tar.zst"
cp "$WORK/$DB.files.tar.zst" "$ASSETS/$DB.files"
if [ -f "$WORK/$DB.files.tar.zst.sig" ]; then
cp "$WORK/$DB.files.tar.zst.sig" "$ASSETS/$DB.files.tar.zst.sig"
cp "$WORK/$DB.files.tar.zst.sig" "$ASSETS/$DB.files.sig"
fi
fi
done
shopt -s nullglob
BUILT_PACKAGES=("$ASSETS"/*.pkg.tar.zst)
shopt -u nullglob
[ ${#BUILT_PACKAGES[@]} -gt 0 ] \
|| { echo "FATAL: no packages were assembled" >&2; exit 1; }
cp packaging/arch/souveraine-archive-key.asc "$ASSETS/"
cp packaging/arch/souveraine-stable.conf "$ASSETS/"
for asset in "${EXTRA_ASSETS[@]+"${EXTRA_ASSETS[@]}"}"; do
[ -f "$asset" ] || { echo "FATAL: release asset is absent: $asset" >&2; exit 1; }
cp "$asset" "$ASSETS/"
done
python3 - "$ASSETS" "$ARCHIVE_REPO" "$TAG" "$TAG_OBJECT" "$COMMIT" <<'PY'
import hashlib
import json
from pathlib import Path
import sys
assets = Path(sys.argv[1])
entries = []
for path in sorted(assets.iterdir(), key=lambda item: item.name):
if not path.is_file():
continue
digest = hashlib.sha256()
with path.open("rb") as handle:
for block in iter(lambda: handle.read(1024 * 1024), b""):
digest.update(block)
entries.append({"name": path.name, "sha256": digest.hexdigest(), "size": path.stat().st_size})
manifest = {
"schema_version": 1,
"repository": sys.argv[2],
"tag": sys.argv[3],
"tag_object": sys.argv[4],
"commit": sys.argv[5],
"public_ref": "refs/heads/public",
"archive_key_fingerprint": "3CD9E99E222C2A174986FC9AFF4949AA20C8E911",
"assets": entries,
}
(assets / "publication-manifest.json").write_text(
json.dumps(manifest, indent=2, sort_keys=True) + "\n", encoding="utf-8"
)
PY
gpg --batch --yes --local-user "$ARCHIVE_KEY" \
--detach-sign "$ASSETS/publication-manifest.json"
REL_JSON=$(curl -s -H "$AUTH" "$API/repos/$ARCHIVE_REPO/releases/tags/$TAG" || true)
REL_ID=$(printf '%s' "$REL_JSON" | python3 -c '
import json, sys
try:
print(json.load(sys.stdin).get("id", ""))
except Exception:
print("")
')
if [ -z "$REL_ID" ]; then
REL_ID=$(api -X POST -H 'Content-Type: application/json' \
"$API/repos/$ARCHIVE_REPO/releases" \
-d "$(python3 - "$TAG" "$COMMIT" <<'PY'
import json, sys
print(json.dumps({
"tag_name": sys.argv[1],
"target_commitish": sys.argv[2],
"name": sys.argv[1],
"body": "Immutable signed package release built once by internal Gitea.",
"draft": True,
"prerelease": False,
}))
PY
)" | python3 -c 'import json, sys; print(json.load(sys.stdin)["id"])')
log "created draft release $REL_ID for $TAG"
else
LIVE_COMMIT=$(printf '%s' "$REL_JSON" | python3 -c '
import json, sys
body = json.load(sys.stdin)
print(body.get("target_commitish") or body.get("target") or "")
')
[ -z "$LIVE_COMMIT" ] || [ "$LIVE_COMMIT" = "$COMMIT" ] \
|| { echo "FATAL: existing $TAG release targets $LIVE_COMMIT, expected $COMMIT" >&2; exit 1; }
log "resuming release $REL_ID for $TAG"
fi
asset_ids() {
api "$API/repos/$ARCHIVE_REPO/releases/$REL_ID/assets" | python3 -c '
import json, sys
name = sys.argv[1]
for asset in json.load(sys.stdin):
if asset.get("name") == name:
print(asset.get("id", ""))
' "$1"
}
upload_immutable() {
local path="$1" name ids count live
name=$(basename "$path")
ids=$(asset_ids "$name")
count=$(printf '%s\n' "$ids" | sed '/^$/d' | wc -l)
if [ "$count" -gt 1 ]; then
echo "FATAL: existing $TAG release has duplicate asset $name" >&2
exit 1
fi
if [ "$count" -eq 1 ]; then
live="$STAGE/live-$name"
curl -sfL -H "$AUTH" "$SERVER/$ARCHIVE_REPO/releases/download/$TAG/$name" -o "$live"
cmp -s "$path" "$live" \
|| { echo "FATAL: immutable asset $name already exists with different bytes" >&2; exit 1; }
log "kept identical $name"
return
fi
curl -sf -X POST -H "$AUTH" \
"$API/repos/$ARCHIVE_REPO/releases/$REL_ID/assets?name=$name" \
-F "attachment=@$path" -o /dev/null
log "uploaded $name"
}
# Packages and their signatures land before databases. The signed manifest is
# last, so its presence means every byte it names was already accepted.
for path in "$ASSETS"/*.pkg.tar.zst "$ASSETS"/*.pkg.tar.zst.sig; do
[ -f "$path" ] && upload_immutable "$path"
done
for path in "$ASSETS"/*; do
[ -f "$path" ] || continue
case "$(basename "$path")" in
*.pkg.tar.zst|*.pkg.tar.zst.sig|*.db|*.db.sig|*.db.tar.zst|*.db.tar.zst.sig|publication-manifest.json|publication-manifest.json.sig)
continue
;;
esac
upload_immutable "$path"
done
for path in "$ASSETS"/*.db.tar.zst "$ASSETS"/*.db.tar.zst.sig "$ASSETS"/*.db "$ASSETS"/*.db.sig; do
[ -f "$path" ] && upload_immutable "$path"
done
upload_immutable "$ASSETS/publication-manifest.json"
upload_immutable "$ASSETS/publication-manifest.json.sig"
api -X PATCH -H 'Content-Type: application/json' \
"$API/repos/$ARCHIVE_REPO/releases/$REL_ID" \
-d "$(python3 - "$TAG" <<'PY'
import json, sys
print(json.dumps({
"name": sys.argv[1],
"body": "Immutable signed package release built once by internal Gitea.",
"draft": False,
"prerelease": False,
}))
PY
)" -o /dev/null
for path in "$ASSETS"/*; do
[ -f "$path" ] || continue
live="$STAGE/verify-$(basename "$path")"
curl -sfL -H "$AUTH" \
"$SERVER/$ARCHIVE_REPO/releases/download/$TAG/$(basename "$path")" -o "$live"
cmp -s "$path" "$live" \
|| { echo "FATAL: read-back differs for $(basename "$path")" >&2; exit 1; }
done
log "$TAG published internally at $COMMIT with ${#BUILT_PACKAGES[@]} packages"

View file

@ -0,0 +1,10 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEalQ47RYJKwYBBAHaRw8BAQdAr8Qx2Czxw1qJNp7Io9usd9P1ayqHYuuHCzNm
9k6ocYO0NlNvdXZlcmFpbmUgUGFja2FnZSBBcmNoaXZlIDxwYWNrYWdlc0Bzb3V2
ZXJhaW5lLmxvY2FsPoiWBBMWCgA+FiEEPNnpniIsKhdJhvya/0lJqiDI6REFAmpU
OO0CGwMFCQPCZwAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQ/0lJqiDI6RHb
lgD9E8WBlE4agkW2bXq9X6Hz86lRWdlWOHkxUCnCZN3HMS8A/1WE8gL8U5A2grDD
bWms5/iphtrh2S1Up031H9a+bvEL
=/YGc
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -0,0 +1,31 @@
// Souveraine — let the active local session power off, reboot, suspend, and
// hibernate without an interactive polkit challenge.
//
// Without this, login1 returns 'challenge' for CanPowerOff/CanReboot on
// every call, and the session has no usable polkit agent on the lock
// surface, so power off / reboot silently no-op'd and every shutdown was a
// fastboot hard-reboot.
//
// Doctrine boundary: this grants every process in the authenticated active
// local seat0 session unchallenged power state. That authority remains while
// the session is screen-locked; a Wayland lock is not a new logind session.
// Config.options.lock.security.allowPowerFromLock (default false, opt-in)
// gates only Souveraine's lock-surface buttons, and requirePasswordToPower can
// arm those buttons for PIN confirmation. They do not constrain arbitrary
// local D-Bus clients. Remote/SSH sessions are NOT granted.
//
// Mirrors the default rule every desktop (GNOME/KDE/Phosh) ships.
polkit.addRule(function(action, subject) {
if ((action.id === "org.freedesktop.login1.power-off" ||
action.id === "org.freedesktop.login1.power-off-multiple-sessions" ||
action.id === "org.freedesktop.login1.reboot" ||
action.id === "org.freedesktop.login1.reboot-multiple-sessions" ||
action.id === "org.freedesktop.login1.suspend" ||
action.id === "org.freedesktop.login1.suspend-multiple-sessions" ||
action.id === "org.freedesktop.login1.hibernate" ||
action.id === "org.freedesktop.login1.hibernate-multiple-sessions") &&
subject.active && subject.local && subject.seat === "seat0") {
return polkit.Result.YES;
}
});

View file

@ -0,0 +1 @@
d /var/lib/souveraine 0700 souveraine souveraine -

View file

@ -0,0 +1,13 @@
# Public stable releases. Each update is an immutable version tag already
# accepted on internal Gitea's public branch; Publication Rail advances this
# feed only after it copies and anonymously verifies the signed release bytes.
#
# Install this file as /etc/pacman.d/souveraine-stable.conf, replace __ARCH__
# with the machine architecture, import souveraine-archive-key.asc, then add:
#
# Include = /etc/pacman.d/souveraine-stable.conf
#
# to /etc/pacman.conf.
[souveraine-__ARCH__]
SigLevel = Required DatabaseRequired
Server = https://forge.caseytunturi.com/Fimeg/souveraine/releases/download/stable

View file

@ -0,0 +1,18 @@
# The `souveraine` system user owns the machine's system tier: the machine
# seed (/var/lib/souveraine) and the machined socket (/run/souveraine).
# Session users join the group to talk to the daemon:
# usermod -aG souveraine <user>
u souveraine - "SouveraineOS system tier" /var/lib/souveraine -
# The lock authority's principal. Declared here because it is machine-tier —
# one per install, like `souveraine`, and not an agent. sessiond is still a
# user unit with no User=; moving it here without first proving the Wayland
# lock handshake, PAM path, crash retake, and key-eviction order would only
# relocate the black screen. See souveraine/saf/authority/01-session.md.
u souveraine-session - "SouveraineOS lock authority" /var/lib/souveraine-session -
# Agent principals (souvie, annie, vanguard, …) are deliberately NOT here.
# sysusers is per-install; admission is per-agent and per-node, keyed to an
# agent ID rather than a display name, and must refuse collisions. A line
# here would mint accounts on every device the package ever touches.
# See souveraine/saf/identity/02-agent-principal.md.