From 34016cfb27137510278dde88a075d832b1a23e76 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 8 Oct 2026 09:57:54 +0200 Subject: [PATCH] Prioritize the Omarchy package repository --- .../add-custom-repo.sample | 4 +-- default/pacman/pacman-edge.conf | 6 ++-- default/pacman/pacman-rc.conf | 6 ++-- default/pacman/pacman-stable.conf | 6 ++-- migrations/1791403252.sh | 30 +++++++++++++++++++ 5 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 migrations/1791403252.sh diff --git a/config/omarchy/hooks/pre-refresh-pacman.d/add-custom-repo.sample b/config/omarchy/hooks/pre-refresh-pacman.d/add-custom-repo.sample index fdc3a871..4c91ecd3 100644 --- a/config/omarchy/hooks/pre-refresh-pacman.d/add-custom-repo.sample +++ b/config/omarchy/hooks/pre-refresh-pacman.d/add-custom-repo.sample @@ -11,7 +11,7 @@ # # To put it into use, remove .sample from this file name. -# Example: add an Include line above [core]. +# Example: add an Include line above the first repository, [omarchy]. # Maintain the repo entries in /etc/pacman.d/custom-repos.conf yourself. CONF=/etc/pacman.conf @@ -21,4 +21,4 @@ MARKER="Include = $SNIPPET" [[ -r $SNIPPET ]] || exit 0 grep -qxF "$MARKER" "$CONF" && exit 0 -sudo sed -i "0,/^\[core\]/s||$MARKER\n\n[core]|" "$CONF" +sudo sed -i "0,/^\[omarchy\]/s||$MARKER\n\n[omarchy]|" "$CONF" diff --git a/default/pacman/pacman-edge.conf b/default/pacman/pacman-edge.conf index a968d26d..b65d065e 100644 --- a/default/pacman/pacman-edge.conf +++ b/default/pacman/pacman-edge.conf @@ -16,6 +16,9 @@ SigLevel = Required DatabaseOptional LocalFileSigLevel = Optional # pacman searches repositories in the order defined here +[omarchy] +Server = https://pkgs.omarchy.org/edge/$arch + [core] Include = /etc/pacman.d/mirrorlist @@ -25,9 +28,6 @@ Include = /etc/pacman.d/mirrorlist [multilib] Include = /etc/pacman.d/mirrorlist -[omarchy] -Server = https://pkgs.omarchy.org/edge/$arch - # Repositories for debug symbol packages. # # These upstream debug packages will only match core/extra/multilib packages from the Omarchy edge diff --git a/default/pacman/pacman-rc.conf b/default/pacman/pacman-rc.conf index 66ad3fb4..b79b14a0 100644 --- a/default/pacman/pacman-rc.conf +++ b/default/pacman/pacman-rc.conf @@ -16,6 +16,9 @@ SigLevel = Required DatabaseOptional LocalFileSigLevel = Optional # pacman searches repositories in the order defined here +[omarchy] +Server = https://pkgs.omarchy.org/rc/$arch + [core] Include = /etc/pacman.d/mirrorlist @@ -24,6 +27,3 @@ Include = /etc/pacman.d/mirrorlist [multilib] Include = /etc/pacman.d/mirrorlist - -[omarchy] -Server = https://pkgs.omarchy.org/rc/$arch diff --git a/default/pacman/pacman-stable.conf b/default/pacman/pacman-stable.conf index 7e4b5538..b7fc74ba 100644 --- a/default/pacman/pacman-stable.conf +++ b/default/pacman/pacman-stable.conf @@ -16,6 +16,9 @@ SigLevel = Required DatabaseOptional LocalFileSigLevel = Optional # pacman searches repositories in the order defined here +[omarchy] +Server = https://pkgs.omarchy.org/stable/$arch + [core] Include = /etc/pacman.d/mirrorlist @@ -24,6 +27,3 @@ Include = /etc/pacman.d/mirrorlist [multilib] Include = /etc/pacman.d/mirrorlist - -[omarchy] -Server = https://pkgs.omarchy.org/stable/$arch diff --git a/migrations/1791403252.sh b/migrations/1791403252.sh new file mode 100644 index 00000000..fdcdd8a0 --- /dev/null +++ b/migrations/1791403252.sh @@ -0,0 +1,30 @@ +echo "Prioritize the Omarchy package repository over Arch repositories" + +# Move the existing section rather than replacing pacman.conf so channel URLs, +# custom repositories, and administrator options survive the migration. +pacman_config=$(mktemp) +trap 'rm -f "$pacman_config"' EXIT + +awk ' + /^[[:space:]]*\[[^]]+\]/ { + section = $0 + sub(/^[[:space:]]*\[/, "", section) + sub(/\].*$/, "", section) + if (section != "options") repositories = 1 + } + !repositories { prefix = prefix $0 "\n"; next } + section == "omarchy" { omarchy = omarchy $0 "\n"; next } + { others = others $0 "\n" } + END { printf "%s%s%s", prefix, omarchy, others } +' /etc/pacman.conf >"$pacman_config" + +if ! cmp -s /etc/pacman.conf "$pacman_config"; then + sudo cp -a /etc/pacman.conf /etc/pacman.conf.bak + sudo install -m 644 -o root -g root "$pacman_config" /etc/pacman.conf +fi + +# Migrations run after the upgrade. Explicitly select OPR now, including when +# Arch's installed build has an equal or higher version number. +if omarchy-pkg-present quickshell; then + sudo pacman -S --noconfirm omarchy/quickshell +fi