sector-f-linux

Sector F Linux
git clone https://git.sectorflabs.com/sector-f-linux.git
Log | Files | Refs | README | LICENSE

commit ef6f087d5f1b1f4cb44a1fb2c69446d49f233198
parent f17d44113d03ed7b6a4619e7c502b18009f787da
Author: Divan Visagie <me@divanv.com>
Date:   Fri, 16 Oct 2026 11:40:32 +0200

Files in the image: the file manager, the session's file chooser, folders

desktop/build.sh builds Files beside patina-desktop, both vendored, and
lays out its binary, launcher and icon, the portal's D-Bus service and
config (Files' ADR-0004), and etc/xdg/patina-mimeapps.list so folders open
in Files in the Patina session only. The image gains xdg-desktop-portal
with the GTK backend for everything but files, shared-mime-info and
xdg-utils. Built; the image itself isn't rebuilt yet.

Diffstat:
Mlinux/Containerfile | 8++++++--
Mlinux/desktop/build.sh | 106+++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
2 files changed, 75 insertions(+), 39 deletions(-)

diff --git a/linux/Containerfile b/linux/Containerfile @@ -45,7 +45,10 @@ COPY --from=bootc /output / # Then what the desktop needs: GDM to log in, NetworkManager (patina-wifi), # PipeWire and WirePlumber (wpctl, for the volume keys), Mesa (EGL, GBM), # libinput, libseat, xkb's layouts, fonts, and foot as a terminal. The -# libraries are what the binaries link or load (see desktop/build.sh). +# libraries are what the binaries link or load (see desktop/build.sh). For +# Files: the desktop portal, whose file chooser it is in the Patina session +# (GTK's backend answers the rest, as patina-portals.conf says), file types +# from shared-mime-info, and xdg-open for opening files in their apps. # # And ZFS's tools, for the pool /home lives on (ADR-0001); the module comes # with Ubuntu's kernel. A pool belongs to its machine, so the image holds @@ -71,6 +74,7 @@ RUN mkdir -p /var/cache/apt/archives/partial /var/lib/apt/lists/partial /var/log libinput10 libseat1 libxkbcommon0 xkb-data libpixman-1-0 libdrm2 \ fonts-dejavu-core fonts-ubuntu hicolor-icon-theme adwaita-icon-theme \ xdg-user-dirs foot \ + xdg-desktop-portal xdg-desktop-portal-gtk shared-mime-info xdg-utils \ zfsutils-linux zfs-zed && \ rm -f /etc/hostid /etc/zfs/zpool.cache && \ apt-get clean && \ @@ -79,7 +83,7 @@ RUN mkdir -p /var/cache/apt/archives/partial /var/lib/apt/lists/partial /var/log # Files the system adds to the base, as laid out under system/. COPY system/ / -# The Patina desktop, and "Patina" as GDM's session. +# The Patina desktop and Files, and "Patina" as GDM's session. COPY build/desktop/ / RUN systemctl enable gdm.service NetworkManager.service \ diff --git a/linux/desktop/build.sh b/linux/desktop/build.sh @@ -1,62 +1,77 @@ #!/usr/bin/env bash -# Builds the Patina desktop for the image, from patina-desktop's last commit -# (not its working tree, so stray changes don't ship), and lays out what the -# image adds in build/desktop/, as it goes under /: +# Builds the Patina desktop for the image, from the last commits of +# patina-desktop and Files (not their working trees, so stray changes don't +# ship), and lays out what the image adds in build/desktop/, as it goes +# under /: # -# usr/bin/patina-* the binaries +# usr/bin/patina-* the desktop's binaries # usr/share/wayland-sessions/patina.desktop "Patina" at the login screen # etc/pam.d/patina-lock the lock screen's PAM service -# usr/lib/patina-os/desktop which commit it was built from +# usr/bin/files, usr/share/applications/... Files, the file manager +# usr/share/dbus-1/services/...portal.desktop.patina.service, +# usr/share/xdg-desktop-portal/... Files as the session's file chooser +# etc/xdg/patina-mimeapps.list folders open in Files, in Patina +# usr/lib/patina-os/{desktop,files} which commits they were built from # -# PATINA_DESKTOP is the checkout (default: patina-desktop beside patina-os). -# PATINA_DESKTOP_WORKTREE=1 builds its working tree instead, uncommitted -# changes and all, to try them in the VM; the image then says "+dirty". +# PATINA_DESKTOP and PATINA_FILES are the checkouts (default: beside +# patina-os). PATINA_DESKTOP_WORKTREE=1 builds their working trees instead, +# uncommitted changes and all, to try them in the VM; the image then says +# "+dirty". set -euo pipefail ROOT=$(cd "$(dirname "$0")/.." && pwd) SRC=${PATINA_DESKTOP:-$ROOT/../../patina-desktop} +FILES=${PATINA_FILES:-$ROOT/../../files} BUILD="$ROOT/build" STAGE="$BUILD/desktop" BUILDER=patina-os-desktop-builder say() { printf '==> %s\n' "$*"; } -[[ -d "$SRC/.git" ]] || { echo "error: no patina-desktop checkout at $SRC" >&2; exit 1; } -commit=$(git -C "$SRC" rev-parse HEAD) worktree=${PATINA_DESKTOP_WORKTREE:-} -dirty=$(git -C "$SRC" status --porcelain) -if [[ -n "$worktree" ]]; then - [[ -z "$dirty" ]] || commit="$commit+dirty" -elif [[ -n "$dirty" ]]; then - say "patina-desktop has uncommitted changes; building its last commit, $commit" -fi + +# Copies checkout $1 into $2, vendors its crates (patina-apps is a private +# git dependency the container can't fetch; ssh reaches it here), and prints +# the commit it came from. +stage() { + local src=$1 dest=$2 commit dirty + [[ -d "$src/.git" ]] || { echo "error: no checkout at $src" >&2; exit 1; } + commit=$(git -C "$src" rev-parse HEAD) + dirty=$(git -C "$src" status --porcelain) + rm -rf "$dest" && mkdir -p "$dest" + if [[ -n "$worktree" ]]; then + # What git would commit: tracked files and new ones it doesn't ignore. + git -C "$src" ls-files -z --cached --others --exclude-standard | + tar -c -C "$src" --null -T - | tar -x -C "$dest" + [[ -z "$dirty" ]] || commit="$commit+dirty" + else + [[ -z "$dirty" ]] || say "$(basename "$src") has uncommitted changes; building its last commit" >&2 + git -C "$src" archive HEAD | tar -x -C "$dest" + fi + mkdir -p "$dest/.cargo" + (cd "$dest" && cargo vendor --locked vendor > .cargo/config.toml.vendor 2> .cargo/vendor.log) || + { cat "$dest/.cargo/vendor.log" >&2; exit 1; } + mv "$dest/.cargo/config.toml.vendor" "$dest/.cargo/config.toml" + echo "$commit" +} say "the build environment" docker build -q -f "$ROOT/desktop/builder.Containerfile" -t "$BUILDER" "$ROOT/desktop" >/dev/null -say "building patina-desktop $commit" -rm -rf "$BUILD/src" -mkdir -p "$BUILD/src" "$BUILD/target" -if [[ -n "$worktree" ]]; then - # What git would commit: tracked files and new ones it doesn't ignore. - git -C "$SRC" ls-files -z --cached --others --exclude-standard | - tar -c -C "$SRC" --null -T - | tar -x -C "$BUILD/src" -else - git -C "$SRC" archive HEAD | tar -x -C "$BUILD/src" -fi -# patina-apps is a private git dependency the container can't fetch; vendor -# every crate here, where ssh reaches it, and point cargo at the copy. -(cd "$BUILD/src" && cargo vendor --locked vendor > .cargo/config.toml.vendor 2> .cargo/vendor.log) || - { cat "$BUILD/src/.cargo/vendor.log" >&2; exit 1; } -mv "$BUILD/src/.cargo/config.toml.vendor" "$BUILD/src/.cargo/config.toml" +mkdir -p "$BUILD/target" +commit=$(stage "$SRC" "$BUILD/src") +files_commit=$(stage "$FILES" "$BUILD/files-src") # Cargo's downloads are kept in a volume, and its target folder in build/, so # rebuilds are incremental. As the user, so build/ stays theirs. -docker run --rm --user "$(id -u):$(id -g)" \ - -e CARGO_HOME=/cargo -e HOME=/tmp \ - -v patina-os-cargo:/cargo \ - -v "$BUILD/src:/src:ro" -v "$BUILD/target:/target" \ - -w /src "$BUILDER" \ - cargo build --release --locked --workspace --target-dir /target +for project in src files-src; do + say "building $project" + docker run --rm --user "$(id -u):$(id -g)" \ + -e CARGO_HOME=/cargo -e HOME=/tmp \ + -v patina-os-cargo:/cargo \ + -v "$BUILD/$project:/src:ro" -v "$BUILD/target:/target" \ + -w /src "$BUILDER" \ + cargo build --release --locked --target-dir /target +done say "laying out build/desktop" rm -rf "$STAGE" @@ -71,3 +86,20 @@ sed 's|@BINDIR@|/usr/bin|' "$BUILD/src/packaging/linux/patina.desktop" \ > "$STAGE/usr/share/wayland-sessions/patina.desktop" install -m 644 "$BUILD/src/packaging/linux/patina-lock.pam" "$STAGE/etc/pam.d/patina-lock" echo "$commit" > "$STAGE/usr/lib/patina-os/desktop" + +# Files: the file manager, the session's file chooser through the portal, +# and what opens folders in the Patina session (Files' ADR-0004). +F="$BUILD/files-src" +install -m 755 "$BUILD/target/release/files" "$STAGE/usr/bin/" +install -D -m 644 "$F/packaging/linux/files.svg" \ + "$STAGE/usr/share/icons/hicolor/scalable/apps/com.sectorflabs.Files.svg" +install -D -m 644 "$F/packaging/linux/com.sectorflabs.Files.desktop" \ + "$STAGE/usr/share/applications/com.sectorflabs.Files.desktop" +service=org.freedesktop.impl.portal.desktop.patina.service +install -d "$STAGE/usr/share/dbus-1/services" +sed 's|@BINDIR@|/usr/bin|' "$F/packaging/portal/$service" > "$STAGE/usr/share/dbus-1/services/$service" +install -D -m 644 "$F/packaging/portal/patina.portal" "$STAGE/usr/share/xdg-desktop-portal/portals/patina.portal" +install -D -m 644 "$F/packaging/portal/patina-portals.conf" "$STAGE/usr/share/xdg-desktop-portal/patina-portals.conf" +install -d "$STAGE/etc/xdg" +printf '[Default Applications]\ninode/directory=com.sectorflabs.Files.desktop\n' > "$STAGE/etc/xdg/patina-mimeapps.list" +echo "$files_commit" > "$STAGE/usr/lib/patina-os/files"