Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .claude/commands/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
description: Build the perpixel-silverblue OCI image locally (make container) and report the result
---

Build the container image locally by running the `build-container` skill: run `make container`
in the background, watch for `dnf`/`buildah` failures, and report the resulting OCI archive path
(or the exact failing line plus a proposed fix). Do not run `make rebase` unless I ask.
44 changes: 44 additions & 0 deletions .claude/skills/build-container/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: build-container
description: Build the perpixel-silverblue OCI image locally with `make container` and report the result. Use when asked to build the image, do a local build, test the Containerfile, or verify that changes to packages.sh / build_files actually build.
---

# Build the container image locally

`make container` runs `build.sh`, which calls `buildah bud` with `--no-cache --pull=always`.
This pulls the full Fedora Silverblue base and runs every `dnf install` in `packages.sh`, so a
clean build takes many minutes and a lot of disk/network. The output is an OCI archive at
`/tmp/${TARGET_IMAGE_NAME}.tar.gz` (`/tmp/perpixel-silverblue.tar.gz`).

## Steps

1. **Run it in the background** — it is long-running. From the repo root:
```sh
make container
```
Launch with `run_in_background: true` so you keep getting progress and aren't blocked.

2. **Watch for the common failure modes.** `set -oeux pipefail` means the build aborts on the
first error and the failing line is printed. Most failures are in `packages.sh`:
- **Package not found / obsoleted** — a package name changed or moved. Read the exact `dnf`
error; fix the name in `build_files/scripts/packages.sh`.
- **RPM Fusion "freeworld" conflict** — `mesa-va-drivers-freeworld` / `mesa-vdpau-drivers-freeworld`
replace the stock `mesa-*-drivers`. If `dnf install` reports a conflict, switch that line to
`dnf swap mesa-va-drivers mesa-va-drivers-freeworld -y` (and the vdpau equivalent).
- **i686/multilib not found** — the 32-bit gaming drivers (`*.i686`) require the x86_64 base
package and matching repos; confirm the exact arch-qualified name with `dnf`.

3. **On success**, report the archive path and the rebase command:
```sh
make rebase # bootc switch --transport oci-archive /tmp/perpixel-silverblue.tar.gz
```
Do not run `make rebase` unless the user asks — it switches the running system's deployment.

4. **On failure**, surface the exact failing `dnf`/`buildah` line (not a paraphrase), propose the
one-line fix, and offer to apply it and rebuild.

## Notes

- buildah runs rootless here (subuid is configured for the user); no `sudo` is needed.
- A failed or interrupted build can leave large layers behind. `buildah images` / `buildah rm --all`
and `make clean` (removes the `/tmp` tarball) help reclaim space.
5 changes: 0 additions & 5 deletions .github/workflows/build-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ jobs:
echo "$line" >> $GITHUB_ENV
done < ./config.env

# fetch NVIDIA driver version
NVIDIA_VERSION=$(./get_nvidia_versions.sh)
echo "NVIDIA_VERSION=$(./get_nvidia_versions.sh)" >> $GITHUB_ENV

- name: Generate tags
id: generate-tags
shell: bash
Expand Down Expand Up @@ -124,7 +120,6 @@ jobs:
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
FEDORA_VERSION=${{ env.FEDORA_VERSION }}
NVIDIA_VERSION=${{ env.NVIDIA_VERSION }}
extra-args: |
--no-cache
--pull=always
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Delete old container
uses: snok/container-retention-policy@v2.2.1
with:
image-names: perpixel-silverblue, nvidia-*, akmods-*
image-names: perpixel-silverblue
cut-off: 1 weeks ago UTC
account-type: personal
skip-tags: latest
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Delete pr containers
uses: snok/container-retention-policy@v2.2.1
with:
image-names: perpixel-silverblue, nvidia*, akmods*
image-names: perpixel-silverblue
cut-off: 1 day ago UTC
account-type: personal
filter-tags: "pr-*"
Expand Down
34 changes: 34 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## What this is

A custom Fedora Silverblue OCI image (bootc/ostree). The build layers extra packages, the COSMIC desktop, and hardware tweaks onto the upstream `fedora-ostree-desktops/silverblue` base, then publishes it to `ghcr.io/perpixel/perpixel-silverblue`. End users `rpm-ostree rebase` / `bootc switch` onto the published image — there is no application code, only build orchestration and system config.

## Commands

```sh
make container # build the image locally via build.sh -> oci-archive:/tmp/perpixel-silverblue.tar.gz
make rebase # bootc switch onto the freshly built local archive
make update # bootc update to the latest local image
make clean # remove the /tmp tarball
```

There is no test suite or linter. "Building" means producing the container image; validation is done by booting into it. The local build (`build.sh`) shells out to `buildah bud` with `--no-cache`, so a full build is slow and downloads the whole base image.

## Build flow

1. `config.env` is the single source of truth for build variables (`TARGET_IMAGE_NAME`, `BASE_IMAGE`, `FEDORA_VERSION`). It is sourced by `Makefile`, `build.sh`, and the GitHub workflow alike — change values here, not in the consumers.
2. `Containerfile` runs `build_files/scripts/install.sh`, which calls `packages.sh`. **`packages.sh` is where almost all real customization lives** — package installs/removals, RPM Fusion setup, kernel selection. To add/remove packages, edit the `dnf install`/`dnf remove` lists there (the README points at an Ansible playbook that no longer exists).
3. `system_files/` is copied verbatim onto `/` in the image. These are drop-in config files (systemd units, `/etc/environment`, etc.).

## Hardware target: AMD

This image targets AMD GPUs using the in-tree `amdgpu` driver — there are no out-of-tree kernel modules to build. VA-API video decode comes from RPM Fusion's `mesa-va-drivers-freeworld` (carries the codecs the stock Fedora package strips); `rocm` provides compute; `/etc/environment` sets `LIBVA_DRIVER_NAME=radeonsi`. For Steam/Proton, `packages.sh` also installs the 32-bit (`.i686`) Mesa DRI/Vulkan/GL drivers. Note F44 RPM Fusion has no `mesa-vdpau-drivers-freeworld` — VA-API is the only freeworld video path. (This repo was previously NVIDIA-based with source-built drivers; that machinery — `get_nvidia_versions.sh`, the builder stage, `nvidia-installer.sh`, `kernel-installer.sh`, the LTS-kernel option — has all been removed.)

`build-pipewire-aptx.sh` is orphaned (not called by any script).

## CI

`.github/workflows/build-all.yml` is the entry point (PRs, weekly cron, manual dispatch). It calls `build-system.yml` (buildah build + push to GHCR; injects `config.env` into the env) then `cleanup.yml` (prunes old GHCR images). PRs get `pr-<n>` tags; pushes get `<fedora-version>` and dated tags. CI does an aggressive disk cleanup step first because the base image is large.
17 changes: 0 additions & 17 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
ARG BASE_IMAGE="${BASE_IMAGE}"
ARG FEDORA_VERSION="${FEDORA_VERSION}"
# ARG NVIDIA_VERSION="${NVIDIA_VERSION}"
ARG USE_LTS_KERNEL="${USE_LTS_KERNEL}"

# Build NVIDIA drivers and other source packages

# FROM ${BASE_IMAGE}:${FEDORA_VERSION} as builder
# ARG NVIDIA_VERSION="${NVIDIA_VERSION}"
# ARG USE_LTS_KERNEL="${USE_LTS_KERNEL}"
# ARG BUILDROOT=/build
# COPY build_files/ "${BUILDROOT}"
# RUN rpm-ostree cliwrap install-to-root / \
# && "${BUILDROOT}"/scripts/build-nvidia-modules.sh

# Build final image

FROM ${BASE_IMAGE}:${FEDORA_VERSION}
# ARG NVIDIA_VERSION="${NVIDIA_VERSION}"
ARG USE_LTS_KERNEL="${USE_LTS_KERNEL}"
ARG BUILDROOT=/build

# Copy build scripts
COPY build_files/ "${BUILDROOT}"
# Copy built modules from builder step
# COPY --from=builder /tmp/built /tmp/builder
# RUN ls -la /tmp/builder/nvidia
# Copy configuration files to root
COPY ./system_files/. /
# Run installer and commit image
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ container:

rebase:
@echo "Rebasing to local image: $(TARGET_IMAGE_NAME)..."
# rpm-ostree rebase ostree-unverified-image:oci-archive:/tmp/$(TARGET_IMAGE_NAME).tar.gz
bootc switch ostree-unverified-image:oci-archive:/tmp/$(TARGET_IMAGE_NAME).tar.gz
# rpm-ostree alternative: rpm-ostree rebase ostree-unverified-image:oci-archive:/tmp/$(TARGET_IMAGE_NAME).tar.gz
bootc switch --transport oci-archive /tmp/$(TARGET_IMAGE_NAME).tar.gz

update:
@echo "Updating to latest local image..."
# rpm-ostree update
bootc update
# rpm-ostree alternative: rpm-ostree upgrade
bootc upgrade

clean:
@echo "Cleaning up..."
Expand Down
28 changes: 11 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,31 @@
[![build-all](https://github.com/perpixel/perpixel-silverblue/actions/workflows/build-all.yml/badge.svg)](https://github.com/perpixel/perpixel-silverblue/actions/workflows/build-all.yml)


Custom image of Fedora Silverblue for myself. Nvidia drivers built from source.
Custom image of Fedora Silverblue for myself. Built for AMD hardware (amdgpu /
Mesa / ROCm), with the COSMIC desktop and a curated package set layered on top
of the upstream Silverblue base.

### Project Structure

- `config.env`: Central configuration file for image build variables.
- `Makefile`: Main entry point for building and managing the image.
- `build.sh`: Wrapper script for `buildah` to build the image.
- `Containerfile`: Container image definition (Dockerfile equivalent).
- `build_files/`: Scripts and playbooks used during the build.
- `build_files/`: Scripts used during the build.
- `system_files/`: Files copied verbatim onto `/` in the image.

### Configuration

The project is configured via `config.env`. You can modify the following variables:
The project is configured via `config.env`:

- `TARGET_IMAGE_NAME`: Name of the resulting image.
- `BASE_IMAGE`: Upstream base image (e.g., Fedora Silverblue).
- `BASE_IMAGE`: Upstream base image (Fedora Silverblue).
- `FEDORA_VERSION`: Version of Fedora to use.
- `USE_LTS_KERNEL`: Set to `true` to use the LTS kernel from COPR.
- `NVIDIA_VERSION`: Specific NVIDIA driver version to build.

### Customization

To add or remove packages, edit:
`build_files/playbooks/install-packages.ansible.yaml`
To add or remove packages, edit the `dnf install` / `dnf remove` lists in
`build_files/scripts/packages.sh`.

### Rebase from ghcr.io

Expand All @@ -37,13 +38,6 @@ rpm-ostree rebase ostree-unverified-image:docker://ghcr.io/perpixel/<tag>
### Local build

``` sh
make build
# Then rebase:
make rebase
```

### Kernel args

``` sh
sudo rpm-ostree kargs --append=rd.driver.blacklist=nouveau --append=modprobe.blacklist=nouveau
make container # build the image locally
make rebase # build and rebase onto the local image
```
3 changes: 0 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -oex pipefail
# Resolve script directory to locate config.env
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
CONFIG_FILE="${SCRIPT_DIR}/config.env"
NVIDIA_VERSION=$(./get_nvidia_versions.sh)

# Load configuration
if [ -f "${CONFIG_FILE}" ]; then
Expand All @@ -23,8 +22,6 @@ buildah bud --pull=true \
--tag=oci-archive:/tmp/${TARGET_IMAGE_NAME}.tar.gz \
--build-arg BASE_IMAGE=${BASE_IMAGE} \
--build-arg FEDORA_VERSION=${FEDORA_VERSION} \
--build-arg NVIDIA_VERSION=${NVIDIA_VERSION} \
--build-arg USE_LTS_KERNEL=${USE_LTS_KERNEL} \
--no-cache \
--pull=always \
--volume $(pwd):/workspace:z \
Expand Down
53 changes: 0 additions & 53 deletions build_files/scripts/build-nvidia-modules.sh

This file was deleted.

33 changes: 0 additions & 33 deletions build_files/scripts/kernel-installer.sh

This file was deleted.

Loading
Loading