2025-12-15 16:27:06 -09:00
|
|
|
> The best way to bring homebrew to your custom bootc image!
|
2025-12-13 09:50:10 -09:00
|
|
|
|
2025-12-15 16:27:06 -09:00
|
|
|
Repository for generating Homebrew tarballs for redistribution on image-based systems via an OCI image.
|
2025-12-13 10:09:21 -09:00
|
|
|
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.
|
2025-12-13 09:50:10 -09:00
|
|
|
|
2025-12-13 10:09:21 -09:00
|
|
|
## 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
|
|
|
|
|
|
2025-12-13 10:54:06 -09:00
|
|
|
The image is designed to be consumed by custom bootc-based container images.
|
2025-12-23 13:33:13 -09:00
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
|
|
[See upstream Docs](https://docs.brew.sh/Homebrew-on-Linux)
|
2025-12-13 10:09:21 -09:00
|
|
|
|
|
|
|
|
## Using in Custom bootc Images
|
|
|
|
|
|
|
|
|
|
### Basic Example
|
|
|
|
|
|
|
|
|
|
To include Homebrew in your custom bootc image, copy the files from this repository's OCI image:
|
|
|
|
|
|
|
|
|
|
```dockerfile
|
|
|
|
|
# Copy Homebrew files from the brew image
|
2026-01-02 23:59:42 -09:00
|
|
|
# And enable
|
2025-12-17 02:52:09 -09:00
|
|
|
COPY --from=ghcr.io/ublue-os/brew:latest /system_files /
|
2026-01-02 23:59:42 -09:00
|
|
|
RUN --mount=type=cache,dst=/var/cache \
|
|
|
|
|
--mount=type=cache,dst=/var/log \
|
|
|
|
|
--mount=type=tmpfs,dst=/tmp \
|
|
|
|
|
/usr/bin/systemctl preset brew-setup.service && \
|
|
|
|
|
/usr/bin/systemctl preset brew-update.timer && \
|
|
|
|
|
/usr/bin/systemctl preset brew-upgrade.timer
|
|
|
|
|
|
2025-12-13 10:09:21 -09:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This will:
|
|
|
|
|
1. Install the Homebrew tarball to `/usr/share/homebrew.tar.zst`
|
|
|
|
|
2. Install all systemd services and timers
|
2026-01-02 23:59:42 -09:00
|
|
|
3. Enable all systemd services and timers
|
|
|
|
|
4. Add shell integration scripts
|
|
|
|
|
5. Configure system limits and tmpfiles
|
2025-12-13 10:09:21 -09:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2025-12-13 10:55:35 -09:00
|
|
|
## 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`
|
|
|
|
|
|
2026-04-22 05:58:25 -08:00
|
|
|
## How do I override system binaries with homebrew ones?
|
|
|
|
|
|
|
|
|
|
As discussed [here](https://github.com/ublue-os/brew/pull/1), overriding system
|
|
|
|
|
provided binaries can lead to some unexpected issues, but it might still be
|
|
|
|
|
desirable to have a specific homebrew program that is also provided by the OS
|
|
|
|
|
to take precedence over the system one.
|
|
|
|
|
|
|
|
|
|
Make an alias!
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
alias git='/home/linuxbrew/.linuxbrew/bin/git'
|
|
|
|
|
```
|