I would like to get some extra tools/packages on my ucore server, so that it acts more like my aurora desktop when I ssh into it.
What is the best way to get homebrew installed and working on the system?
I would like to get some extra tools/packages on my ucore server, so that it acts more like my aurora desktop when I ssh into it.
What is the best way to get homebrew installed and working on the system?
Copy, paste, and run the codeblocks on this web page: Homebrew on Linux — Homebrew Documentation
I built ucore-brew to do exactly this.
It uses the Universal-Blue-native way of customizing (via the ublue-os/image-template repo) the stock ucore image to include Homebrew by enabling the ublue-os/packages copr (see Bluefin’s build_files/base/02-install-copr-repos.sh), installing the appropriate brew package (see Bluefin’s build_files/base/04-packages.sh), then disabling the copr and enabling the appropriate services (see Bluefin’s build_files/base/17-cleanup.sh, lines 18-20 and 52).
Hopefully this helps someone else to do it in (what I think to be) the most Universal Blue-ish way! (I wish I could add all the permalinks to the Bluefin repo, but new accounts can’t add more than 2 links)
Don’t forget that you can export tools from a Distrobox, as a way to do this out of the box without needing Brew:
# Create the VM
distrobox-create --name toolbox
# Enter the new VM
distrobox enter toolbox
# Install apps via dnf
sudo dnf install btop npm
# Export apps back to the host
distrobox-export --bin /usr/bin/btop
distrobox-export --bin /usr/bin/npm
distrobox-export --bin /usr/bin/node
You can also do this from your Ignition file, which makes the whole process hands-free:
storage:
files:
- path: /usr/local/bin/post-ignition-distrobox.sh
mode: 0755
contents:
inline: |
#!/bin/bash
# Set up Distrobox "toolbox"
distrobox create -Y --image fedora-minimal --name toolbox
distrobox-enter toolbox -- sudo dnf install -y btop age
# Export packages
distrobox-enter toolbox -- distrobox-export --bin /usr/bin/btop
distrobox-enter toolbox -- distrobox-export --bin /usr/bin/age
- path: /var/home/core/.bash_profile
mode: 0644
append:
- inline: |
# Add ~/.local/bin to PATH if not already present
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
systemd:
units:
- name: post-ignition-distrobox.service
enabled: true
contents: |
[Unit]
Description=Post-install Distrobox setup
After=network-online.target
Wants=network-online.target
ConditionPathExists=/etc/ucore-autorebase/signed
ConditionPathExists=!/var/home/core/.local/bin/btop
[Service]
Type=oneshot
User=core
Group=core
ExecStart=/usr/local/bin/post-ignition-distrobox.sh
[Install]
WantedBy=multi-user.target
I got this running, and the easiest way was to build my image with BlueBuild, as they have a module that takes care of it. BlueBuild brew page. They take care of all the work getting it set up.
Here is my recipe file from BlueBuild as an example.
# description will be included in the image's metadata
name: uBlue-uCore-test
description: Custom FCOS Server
# the base image to build on top of (FROM) and the version tag to use
base-image: ghcr.io/ublue-os/ucore
image-version: stable-nvidia # latest is also supported if you want new updates ASAP
modules:
- type: dnf
install:
packages:
- vim
- zsh
- util-linux-script
- rpmconf
remove:
packages:
- nano
- type: brew
- type: signing
In case anyone is still looking at this in the future, do note that the Universal Blue team have upstreamed a consumable Homebrew tarball and integration for use in DIY bootc images:
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.