Capture omarchy-air's customizations as a per-host overlay
hosts/<hostname>/{config,system}/ now overlays the shared trees. install.sh
installs a host file in place of the shared copy at the same path, and
capture.sh pulls back into whichever copy the host installs from. That keeps
hardware-specific files off the wrong machine: the HP's EDID-named monitors.lua
and its fnmode=2 would otherwise land on the Air.
capture.sh refreshes the shared trees only on omarchy-laptop, where they were
captured, or when CAPTURE_SHARED=1 is set. On the Air, a plain run copied its
stock terminal, hypr and shell files over every one of the HP's customizations.
air's overlay holds monitors.lua (1.33333 scale and GDK_SCALE=1 for the
2560x1664 panel), input.lua (stock settings plus the inert-accel measurements),
herdr onboarding=false, git identity and credential helpers (no secrets),
mimeapps.list, and the Asahi installer's hid_apple fnmode=1 and show_notch=1.
bindings.lua is not overlaid because the shared one is a strict superset.
hosts/omarchy-air/README.md records what was left out on purpose and why, and
warns that the shared packages.txt is x86-specific.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KKPyqMc7MGKyBLKVdeDejp
This commit is contained in:
+28
-8
@@ -18,6 +18,12 @@ STAMP="$(date +%s)"
|
||||
DRY=0
|
||||
STEPS=(packages config themes plugins bin handoff services system)
|
||||
|
||||
# Per-host overlay: hosts/<hostname>/{config,system}/ mirror the shared trees, and
|
||||
# a file there replaces the shared copy of the same path on that host only. It is
|
||||
# how hardware-specific files (monitor scale, fnmode) stay off the wrong machine.
|
||||
HOST="${OMARCHY_SETUP_HOST:-$(hostname)}"
|
||||
HOST_DIR="$REPO/hosts/$HOST"
|
||||
|
||||
# omarchy-handoff peer addresses to open the firewall for. The peer is dual-homed
|
||||
# (Wi-Fi + dock NIC) and the dock address disappears on undock, so list both.
|
||||
if [[ -z ${HANDOFF_PEER_IPS+x} ]]; then
|
||||
@@ -61,6 +67,20 @@ install_file() {
|
||||
fi
|
||||
}
|
||||
|
||||
# layered <tree> -- NUL-separated "<src>\t<rel>" for every file in the shared tree
|
||||
# and the host overlay, the host copy winning where both have the same path.
|
||||
layered() {
|
||||
local tree=$1 f rel
|
||||
declare -A pick=()
|
||||
for base in "$REPO/$tree" "$HOST_DIR/$tree"; do
|
||||
[[ -d $base ]] || continue
|
||||
while IFS= read -r -d '' f; do
|
||||
rel=${f#"$base/"}; pick[$rel]=$f
|
||||
done < <(find "$base" -type f -print0)
|
||||
done
|
||||
for rel in "${!pick[@]}"; do printf '%s\t%s\0' "${pick[$rel]}" "$rel"; done | sort -z -t$'\t' -k2
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------- packages
|
||||
step_packages() {
|
||||
head_ "Packages"
|
||||
@@ -108,11 +128,11 @@ step_packages() {
|
||||
# ---------------------------------------------------------------- config
|
||||
step_config() {
|
||||
head_ "Config files -> ~/.config"
|
||||
[[ -d $HOST_DIR/config ]] && say " host overlay: hosts/$HOST/config"
|
||||
local src rel
|
||||
while IFS= read -r -d '' src; do
|
||||
rel=${src#"$REPO/config/"}
|
||||
while IFS=$'\t' read -r -d '' src rel; do
|
||||
install_file "$src" "$HOME/.config/$rel"
|
||||
done < <(find "$REPO/config" -type f -print0 | sort -z)
|
||||
done < <(layered config)
|
||||
|
||||
if (( ! DRY )) && command -v hyprctl >/dev/null && [[ -n ${HYPRLAND_INSTANCE_SIGNATURE:-} ]]; then
|
||||
hyprctl reload >/dev/null 2>&1
|
||||
@@ -370,9 +390,9 @@ step_handoff() {
|
||||
# ---------------------------------------------------------------- system
|
||||
step_system() {
|
||||
head_ "System drop-ins (needs sudo)"
|
||||
[[ -d $HOST_DIR/system ]] && say " host overlay: hosts/$HOST/system"
|
||||
local src rel dest
|
||||
while IFS= read -r -d '' src; do
|
||||
rel=${src#"$REPO/system/"}
|
||||
while IFS=$'\t' read -r -d '' src rel; do
|
||||
dest="/etc/$rel"
|
||||
if [[ -e $dest ]] && cmp -s "$src" "$dest"; then
|
||||
skip "$dest"
|
||||
@@ -383,12 +403,12 @@ step_system() {
|
||||
continue
|
||||
fi
|
||||
sudo install -D -m 0644 "$src" "$dest" && ok "$dest"
|
||||
done < <(find "$REPO/system" -type f -print0 | sort -z)
|
||||
done < <(layered system)
|
||||
|
||||
if (( ! DRY )); then
|
||||
sudo sysctl --system >/dev/null 2>&1 && ok "sysctl reloaded"
|
||||
say ""
|
||||
say " hid_apple.conf (fnmode=2: F-keys act as F-keys) only takes effect once the"
|
||||
say " hid_apple.conf (fnmode) only takes effect once the"
|
||||
say " initramfs is rebuilt or the module reloads:"
|
||||
say " sudo mkinitcpio -P # or: sudo modprobe -r hid_apple && sudo modprobe hid_apple"
|
||||
fi
|
||||
@@ -410,7 +430,7 @@ main() {
|
||||
done
|
||||
(( ${#want[@]} )) || want=("${STEPS[@]}")
|
||||
|
||||
say "${c_hd}omarchy-setup${c_off} repo=$REPO"
|
||||
say "${c_hd}omarchy-setup${c_off} repo=$REPO host=$HOST"
|
||||
(( DRY )) && warn "dry run - nothing will be changed"
|
||||
command -v omarchy >/dev/null || warn "omarchy not found; this looks like a non-Omarchy host"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user