Read-only pull mirror of github.com/ublue-os/brew: the Homebrew integration Aurora's build copies from its image.
Find a file
Kyle Gospodnetich 456449a90b
Merge pull request #1 from tulilirockz/path-modification
feat(brew.sh): set linuxbrew PATH to the last entry in $PATH instead of first
2025-12-17 09:51:22 -08:00
.github chore: Delete .github/pull.yml 2025-12-16 22:08:49 -08:00
system_files Update system_files/etc/profile.d/brew.sh 2025-12-17 11:39:51 -03:00
Containerfile fix: generate tarball and expose inside of OCI image instead of generating github releases 2025-12-13 16:03:08 -03:00
cosign.pub fix: update cosign key 2025-12-13 16:06:29 -03:00
Justfile init: first functional homebrew tarball generator 2025-12-13 15:50:10 -03:00
LICENSE init: first functional homebrew tarball generator 2025-12-13 15:50:10 -03:00
README.md Update Homebrew image source in README 2025-12-17 13:52:09 +02:00

The best way to bring homebrew to your custom bootc image!

Repository for generating Homebrew tarballs for redistribution on image-based systems via an OCI image. This includes general settings you'd want to use when using Homebrew on a bootc system, including a tarball and services for setting it up.

Overview

This repository builds an OCI container image that packages:

  • A pre-installed Homebrew tarball (homebrew.tar.zst)
  • Systemd services for automated setup, updates, and upgrades
  • Shell integration scripts (bash, fish)
  • Security limits and tmpfiles configuration

The image is designed to be consumed by custom bootc-based container images.

Using in Custom bootc Images

Basic Example

To include Homebrew in your custom bootc image, copy the files from this repository's OCI image:

# Copy Homebrew files from the brew image
COPY --from=ghcr.io/ublue-os/brew:latest /system_files /

This will:

  1. Install the Homebrew tarball to /usr/share/homebrew.tar.zst
  2. Install all systemd services and timers
  3. Add shell integration scripts
  4. Configure system limits and tmpfiles

On first boot, brew-setup.service will automatically:

  1. Extract Homebrew to /var/home/linuxbrew/.linuxbrew
  2. Set up proper permissions
  3. Make Homebrew ready to use

Advanced Example with Pre-installed Packages

If you want to pre-install Homebrew packages in your image:

# Copy Homebrew files
COPY --from=ghcr.io/ublue-os/brew:latest /system_files /

# Install Homebrew packages during image build
RUN mkdir -p /var/home/linuxbrew && \
    tar --zstd -xvf /usr/share/homebrew.tar.zst -C /tmp && \
    mv /tmp/home/linuxbrew/.linuxbrew /var/home/linuxbrew/ && \
    eval "$(/var/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
    brew install gcc neovim ripgrep && \
    brew cleanup && \
    tar --zstd -cvf /usr/share/homebrew.tar.zst /var/home/linuxbrew/.linuxbrew && \
    rm -rf /var/home/linuxbrew/.linuxbrew /tmp/home

Systemd Services

brew-setup.service

Runs on first boot to extract and configure Homebrew:

  • Extracts tarball to /var/home/linuxbrew/.linuxbrew
  • Sets appropriate ownership (UID 1000)
  • Creates marker file to prevent re-running

brew-update.timer & brew-update.service

Automatically keeps Homebrew up to date:

  • Runs daily to update Homebrew itself
  • Ensures formula database is current

brew-upgrade.timer & brew-upgrade.service

Automatically upgrades installed packages:

  • Runs on a regular schedule
  • Keeps installed packages up to date

Shell Integration

  • Bash: /etc/profile.d/brew.sh - Automatically configures Homebrew environment
  • Fish: /usr/share/fish/vendor_conf.d/ublue-brew.fish - Fish shell support
  • Bash Completion: /etc/profile.d/brew-bash-completion.sh

Configuration Files

  • Security Limits: /etc/security/limits.d/30-brew-limits.conf
  • Tmpfiles: /usr/lib/tmpfiles.d/homebrew.conf
  • Systemd Presets: /usr/lib/systemd/system-preset/01-homebrew.preset