Repository navigation
Conversation
f9a2156 to
4f0d7a4
Compare
4f0d7a4 to
50a26be
Compare
[Medium impact] The changes affect package downloads, developer tools, and first-user setup for China-region machines. The PR still needs fixes for ARM switching, overlapping rollback copies, and new apps keeping the previous region's registries.
|
|
Regions are useful beyond China. 1Password for example uses different servers for global (US), Canada and EU. See https://support.1password.com/regions/ A unified ISO with region selection during install is probably to best choice to avoid overcomplicating things. |
Thanks, good point. Regions aren't specific to China. The trade-off is that every user would have to pick their region during install, even though most don't need a regional profile. A dedicated Both are reasonable, so leave this to @dhh. |
|
@xdanger Region can be preselected on setup through auto-detection, just like the time zone. |
|
@axelfontaine you are absolutely right! Will revert all the |
…or prepends Drop the .cn servers.sed twins, the USTC Arch fallback and the closed omacom#14399 timezone preselection. region.sh follows the installer's marker.
# Conflicts: # AGENTS.md # bin/omarchy-refresh-pacman # default/omarchy/omarchy-menu.jsonc # install/post-install/pacman.sh # shell/plugins/menu/MenuModel.js # test/shell.d/menu-test.sh
…y with a region Integration only, until omarchy omacom#13690 rebases onto the ARM pacman templates. pacman-templates-test still expects x86 refresh to copy the templates directly.
Integration only.
# Conflicts: # AGENTS.md # bin/omarchy-refresh-pacman # default/omarchy/omarchy-menu.jsonc # install/post-install/pacman.sh # shell/plugins/menu/MenuModel.js # test/shell.d/menu-test.sh
…y with a region Integration only, until omarchy omacom#13690 rebases onto the ARM pacman templates. pacman-templates-test still expects x86 refresh to copy the templates directly.
Integration only.
ec4579a to
d0ea9f6
Compare
| arch_server=$(sed -n '1s/^Server = //p' "$work/rendered/mirrorlist") | ||
| for url in "${omarchy_server//\$arch/$arch}/omarchy.db" "$(sed "s|\$repo|core|; s|\$arch|$arch|" <<<"$arch_server")/core.db"; do |
There was a problem hiding this comment.
On both ARM platforms, the mirrorlist starts with comments. This reads line 1 as a server URL, so curl receives a comment followed by /core.db and fails. Users cannot switch to China, including its developer-tool mirrors.
Read the first Server = entry rather than the first line.
| sudo cp -f /etc/pacman.conf /etc/pacman.conf.bak | ||
| sudo cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak | ||
| changed=1 | ||
| omarchy-region-user "$region" | ||
| sudo cp -f "$work/rendered/pacman.conf" /etc/pacman.conf | ||
| sudo cp -f "$work/rendered/mirrorlist" /etc/pacman.d/mirrorlist |
There was a problem hiding this comment.
Overlapping switches restore wrong files
Each switch overwrites the same rollback files. One switch can copy China's pacman.conf and pause; a second switch can then back up that half-switched state. If the first switch fails, restore_previous restores those newer backups, leaving the old region marker with mixed package settings. omarchy-refresh-pacman also writes the same backups.
Hold a shared lock from reading the current state through completion or rollback, and keep each switch's rollback copies separate.
|
Reviewed and extended on the maintainer's direction, and verified on a fresh Omarchy worker against the merge with current What changed, and why:
Checked on the worker:
Second opinion: Codex at medium effort, three rounds.
This is waiting on the maintainer. omacom/omarchy-iso#241 is its install-time half. |
A region profile can name launchers and preinstalled bindings to leave out (apps-skip) and packages to skip or add (packages-skip, packages-add), keyed off the region the install already records. The installer applies the package lists; omarchy-region-preinstalls removes the skipped launchers and dock pins for the user a regional install finalizes and records them, so launcher refreshes and the bindings keep them out and a later region switch changes no apps. China leaves out the apps whose services are unreachable there without a VPN and adds WeChat, QQ, WPS Office, DingTalk and Feishu. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ges-skip can do An empty XDG_STATE_HOME is unset to the shell side, so the bindings now fall back to ~/.local/state as well. packages-skip leaves packages out of the default set only; one the installer or another package needs still installs, and the docs say so. The test keeps every command's state under its own home. Co-Authored-By: Codex <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Added region preinstalls (cf6826b, 2bcee54). A profile can now leave out launchers, dock pins and preinstalled bindings ( |
quattro's Calculator bindings go through o.bind_preinstalled like the other preinstalled bindings. Refresh keeps quattro's current-channel detection and the branch's regional render, so the boundary tests from quattro now check the render's copies. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Brought up to date with quattro (54fcdbc), merged with no force-push. Three conflicts were resolved: quattro's Calculator bindings now use |
| (( ${#unset_names[@]} == 0 )) || systemctl --user unset-environment "${unset_names[@]}" | ||
| (( ${#set_values[@]} == 0 )) || systemctl --user set-environment "${set_values[@]}" |
There was a problem hiding this comment.
New terminals keep China settings
Switching from China to World updates only systemd's environment. Apps launched through uwsm-app keep the environment of Hyprland or the running shell, so new terminals still inherit China's registry values. env-bootstrap does not clear those inherited values for World.
Update Hyprland's environment and restart the shell from it, as omarchy-language does.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| if len(begins) != 1 or len(ends) != 1 or ends[0] < begins[0] or mode not in MODES or ends[0] == len(lines) - 1: | ||
| leave("its omarchy region block has been edited") | ||
| # before is everything ahead of the newline that precedes BEGIN; after | ||
| # is everything following END's newline. | ||
| before = b"\n".join(lines[:begins[0]]) | ||
| after = b"\n".join(lines[ends[0] + 1:]) |
There was a problem hiding this comment.
Edited cargo settings disappear
The cargo check detects edited markers, but not edits inside the marked block. If a user changes the registry URL or adds a setting inside that block, switching to World deletes those edits; reapplying China overwrites them. This conflicts with the stated promise to leave hand-edited configurations alone.
Check the block's contents before replacing or removing it.
| # omarchy:summary=Set where packages and developer tools download from: world or china | ||
| # omarchy:args=<world|china> | ||
| # omarchy:examples=omarchy region china | omarchy region world |
There was a problem hiding this comment.
The new public region command group has no entry in GROUP_DESCRIPTIONS. AGENTS.md requires adding that entry for a group users should browse. Without it, the top-level omarchy listing does not show the new group.
Add the entry before merging to satisfy the repository requirement.
File Used: AGENTS.md (source)
| @@ -0,0 +1,102 @@ | |||
| #!/bin/bash -p | |||
There was a problem hiding this comment.
Required startup test is missing
The new #!/bin/bash -p entrypoint has no regression test that launches it through ordinary Bash with a decoy -p argument. AGENTS.md requires that test for this shebang exception.
Add omarchy-region to the startup-refusal coverage before merging. The existing loop tests only the updater, pacman refresh, and sudo wrapper.
File Used: AGENTS.md (source)
| local status=$? | ||
| # Reapplying the current region leaves the marker as it was, so there only | ||
| # reaching the end counts. | ||
| if (( changed && ! finished )) && [[ $previous == "$region" || $(omarchy-region-current) != "$target" ]]; then |
There was a problem hiding this comment.
Bash comparisons break repository style
The new Bash code uses bare comparison literals and quoted variables inside [[ ]], contrary to AGENTS.md: leave variables unquoted there and quote string literals. For example, use [[ $region == "cn" ]] and [[ $previous == $region ]].
The same pattern appears in omarchy-apply-pacman and omarchy-region-user. Update these comparisons before merging to satisfy the repository requirement.
File Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
A region profile can name a font; omarchy-region-preinstalls sets it for the user a regional install finalizes, only when the install carries it, and without restarting a shell an install does not have (OMARCHY_FONT_HEADLESS). China names Maple Mono NF CN and adds maplemono-nf-cn, so the font is already current when the first-run invitation to Maple would otherwise appear. omarchy-font-set now replaces only the family in alacritty's font lines, keeping each style, and the keybinding extractor reads o.bind_preinstalled, which the English keybindings catalog check needs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An install's chroot shares the live system's processes, so kitty and ghostty are signalled only in a live session. The test records the signals and covers first-boot owner setup. Co-Authored-By: Codex <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A China install now makes Maple Mono NF CN the first user's monospace font (e9050b4, d862446). |
|
@xdanger This is a lot to review as one PR so I will split it out into smaller parts while preserving your commits. |
Many registries developer tools pull from are slow or unreachable from mainland China. With the region marker set to cn, env-bootstrap exports the profile's environment to every shell and the desktop session: npm, pip and uv, Go (with GOSUMDB=sum.golang.google.cn, sum.golang.org's reachable mirror, checked with the same key), rustup, Bundler, RubyGems and Maven. A value the user exported first wins, and root's shells skip it, since a dev link's OMARCHY_PATH is a user-writable checkout. cargo reads source replacement only from $CARGO_HOME/config.toml, so omarchy-region-user adds a marked block there for the first user of a China install and removes exactly that block for World. A config that already sets crates.io's source, invalid TOML, and a block edited around or inside its markers are left alone. From #13690 by @xdanger, where omarchybot wrote this part; updating a running session's environment is left to region switching, which needs it. Co-authored-by: Kros Dai <[email protected]>
Many registries developer tools pull from are slow or unreachable from mainland China. With the region marker set to cn, env-bootstrap exports the profile's environment to every shell and the desktop session: npm, pip and uv, Go (with GOSUMDB=sum.golang.google.cn, sum.golang.org's reachable mirror, checked with the same key), rustup, Bundler, RubyGems and Maven. A value the user exported first wins, and root's shells skip it, since a dev link's OMARCHY_PATH is a user-writable checkout. cargo reads source replacement only from $CARGO_HOME/config.toml, so omarchy-region-user adds a marked block there for the first user of a China install and removes exactly that block for World. A config that already sets crates.io's source, invalid TOML, and a block edited around or inside its markers are left alone. From #13690 by @xdanger, where omarchybot carried over @Raiden-MeixElysia's registries from #15118; updating a running session's environment is left to region switching, which needs it. Co-authored-by: Kros Dai <[email protected]> Co-authored-by: 雷电芽衣 <[email protected]>
Many registries developer tools pull from are slow or unreachable from mainland China. With the region marker set to cn, env-bootstrap exports the profile's environment to every shell and the desktop session: npm, pip and uv, Go (with GOSUMDB=sum.golang.google.cn, sum.golang.org's reachable mirror, checked with the same key), rustup, Bundler, RubyGems and Maven. A value the user exported first wins, and root's shells skip it, since a dev link's OMARCHY_PATH is a user-writable checkout. cargo reads source replacement only from $CARGO_HOME/config.toml, so omarchy-region-user adds a marked block there for the first user of a China install and removes exactly that block for World. A config that already sets crates.io's source, invalid TOML, and a block edited around or inside its markers are left alone. From #13690 by @xdanger, where omarchybot carried over @Raiden-MeixElysia's registries from #15118; updating a running session's environment is left to region switching, which needs it. Co-authored-by: Kros Dai <[email protected]> Co-authored-by: 雷电芽衣 <[email protected]>
Setup > Region offers World and China, and `omarchy region world|china` does the same from a terminal; `omarchy region current` prints the active one. A switch renders both pacman files as the caller, checks that the region's first servers answer, applies the developer tool settings, has root copy the two files, and moves the marker into place last. Until the marker names the new region, any failure, a closed terminal or Ctrl+C puts the old region back. Beyond the version in #13690: - The probe reads the first Server line of the mirrorlist. ARM mirrorlists open with comments, so it used to ask for /core.db and refuse every switch on ARM. It names the architecture through omarchy-hw-aarch64, not uname. - One switch runs at a time, for every user: it locks /etc/pacman.conf, which any user can open. A second one started while the first waited for its password would back up a half-switched machine as the region to return to. - A shell started after a switch to World drops the registries China set for the running session (OMARCHY_REGION_EXPORTED) while they still hold China's values, and none the user set, so new terminals follow at once; apps started straight from the desktop follow at the next login, and the switch says so. - omarchy-region-current and env-bootstrap read a marker without a final newline. - The region command group has its description, and omarchy-region joins the bash -p startup refusal test. From #13690 by @xdanger, where omarchybot carried over @Raiden-MeixElysia's Setup > Region from #15119. Co-authored-by: Kros Dai <[email protected]> Co-authored-by: 雷电芽衣 <[email protected]>
Setup > Region offers World and China, and `omarchy region world|china` does the same from a terminal; `omarchy region current` prints the active one. A switch renders both pacman files as the caller, checks that the region's first servers answer, applies the developer tool settings, has root copy the two files, and moves the marker into place last. Until the marker names the new region, any failure, a closed terminal or Ctrl+C puts the old region back. Beyond the version in #13690: - The probe reads the first Server line of the mirrorlist. ARM mirrorlists open with comments, so it used to ask for /core.db and refuse every switch on ARM. It names the architecture through omarchy-hw-aarch64, not uname. - One writer of pacman's files at a time, for every user: the switch locks /etc/pacman.conf, which any user can open, and omarchy-refresh-pacman takes the same lock. A second switch or a refresh started while the first waited for its password would replace the backups it returns to. - A failed switch puts the user's own cargo config back exactly as it was, rather than reapplying the old region, which could add a China block that user never had. - A shell started after a switch to World drops the registries China set for the running session (OMARCHY_REGION_EXPORTED) while they still hold China's values, and none the user set, so new terminals follow at once; apps started straight from the desktop follow at the next login, and the switch says so. Root's shells never take part, taking back included, since a dev link's checkout is user-writable. - omarchy-region-current and env-bootstrap read a marker without a final newline. - The region command group has its description, and omarchy-region joins the bash -p startup refusal test. From #13690 by @xdanger, where omarchybot carried over @Raiden-MeixElysia's Setup > Region from #15119. Co-authored-by: Kros Dai <[email protected]> Co-authored-by: 雷电芽衣 <[email protected]>
Setup > Region offers World and China, and `omarchy region world|china` does the same from a terminal; `omarchy region current` prints the active one. A switch renders both pacman files as the caller, checks that the region's first servers answer, applies the developer tool settings, has root copy the two files, and moves the marker into place last. Until the marker names the new region, any failure, a closed terminal or Ctrl+C puts the old region back. Beyond the version in #13690: - The probe reads the first Server line of the mirrorlist. ARM mirrorlists open with comments, so it used to ask for /core.db and refuse every switch on ARM. It names the architecture through omarchy-hw-aarch64, not uname. - One writer of pacman's files at a time, for every user: the switch locks /etc/pacman.d, which any user can open and nothing replaces, and omarchy-refresh-pacman takes the same lock. A second switch or a refresh started while the first waited for its password would replace the backups it returns to. - A failed switch puts the user's own cargo config back exactly as it was, rather than reapplying the old region, which could add a China block that user never had. - A shell started after a switch to World drops the registries China set for the running session (OMARCHY_REGION_EXPORTED) while they still hold China's values, and none the user set, so new terminals follow at once; apps started straight from the desktop follow at the next login, and the switch says so. Root's shells never take part, taking back included, since a dev link's checkout is user-writable. - omarchy-region-current and env-bootstrap read a marker without a final newline. - The region command group has its description, and omarchy-region joins the bash -p startup refusal test. From #13690 by @xdanger, where omarchybot carried over @Raiden-MeixElysia's Setup > Region from #15119. Co-authored-by: Kros Dai <[email protected]> Co-authored-by: 雷电芽衣 <[email protected]>
|
Closing this umbrella PR in favour of focused successors, following the split proposed in #13690 (comment). This is supersession, not a claim that all of its features have merged. The remaining runtime work is now tracked separately against current
I checked the original head Package delivery remains explicitly deferred. In #17121, All three new PRs are ready for review, not merged. Focused regression checks pass, including isolated setup with a read-only host filesystem. Full-suite runs and their three independently reproduced upstream/environment failures are disclosed in the PRs. No existing branch or old worktree has been rewritten or removed. |
Packages in mainland China come slowly or not at all from the
.orgmirrors, and so do the registries developer tools use (#7858, #8697, #11456). This gives an install one region setting, World or China, that decides where both download from. It also lets a region change the preinstalls, and China gets its own apps. The region framework is @xdanger's; the Setup > Region menu and the developer tool registries come from @Raiden-MeixElysia's #15119 and #15118.Region. A plain-text marker,
/etc/omarchy/region(cn, or absent for World), read as data. The installer derives it from the timezone (omacom/omarchy-iso#241):Asia/Shanghai,Asia/Urumqiand their tzdata aliases select China. Hong Kong, Macau and Taiwan belong to no region under any name, and a test keeps it that way. It can be changed at any time under Setup > Region > World / China or withomarchy-region world|china;omarchy-region-currentreads it. Profiles live indefault/regions/<code>/.Packages. For China,
omarchy-apply-pacmanputs Omarchy's China replicas first: the channel's Arch mirror (stable-mirror,rc-mirrorormirror.omarchy.cn) and, ahead ofpkgs.omarchy.orgin[omarchy],pkgs.omarchy.cn/<channel>, which carries the largest downloads. The.orgservers stay as the fallback. Both replicas serve the same signed packages, so no repository or signing key is added; World is the channel templates byte for byte. Install finalization andomarchy-refresh-pacmanrender through it, and switching to the dev channel refuses a checkout that lacks this machine's profile.Developer tools. While the region is China,
env-bootstrapexports the profile's registries to every shell and the desktop session: npm (npmmirror), pip and uv, Go (withGOSUMDB=sum.golang.google.cn, the reachable mirror ofsum.golang.org, checked with the same key), rustup, Bundler, RubyGems (GEMRC) and Maven (MAVEN_ARGS), all Aliyun. A value the user exported first wins, and root's shells skip it. cargo reads source replacement only from$CARGO_HOME/config.toml, so a marked block goes there, for the user who switches and the first user of a China install; it records what it added so World restores the file exactly, and a config that already configures crates.io, or that has been hand-edited, is left alone. Not covered: tools mise installs from GitHub releases, the AUR, the arch-mact2 hardware repository and Google services.Preinstalls. A region can also change what a new install comes with, as data in its profile:
apps-skipnames launchers and preinstalled key bindings to leave out, andpackages-skipandpackages-addname packages to leave out of or add to the default set. The ISO applies the package lists while it installs the defaults, adding only what its offline mirror carries, so a package with no build for the machine never fails an install (omacom/omarchy-iso#275). For the first user of a regional install,omarchy-region-preinstallsremoves the skipped launchers, unpins them from the dock, and records them in~/.local/state/omarchy/preinstalls-skipped, whichomarchy-refresh-applicationsand the preinstalled bindings (o.bind_preinstalled) read, so a refresh or migration does not bring them back. World has no lists and installs exactly the defaults. Preinstalls are decided once, at install: a region switch changes where packages come from, never which apps are installed, because removing apps on a switch would take away ones the user may still reach and installing them would add software nobody chose.China adds WeChat (
wechat-bin), QQ (linuxqq), WPS Office (wps-office-cn, x86_64 only), DingTalk (dingtalk-bin), Feishu (feishu-bin) and Maple Mono NF CN (maplemono-nf-cn).Font. A profile's
fontnames the monospace family its first user gets. China's is Maple Mono NF CN, which draws Han two cells wide, so Chinese lines up with Latin in a terminal.omarchy-region-preinstallssets it withomarchy-font-setonly when the font is installed. During an install there is no session, soOMARCHY_FONT_HEADLESSwrites foot, alacritty, kitty, ghostty and fontconfig without restarting the shell, notifying, or signalling terminals that the chroot shares with the live system. The font is already current at first login, so #16026's one-time Maple invitation does not appear. World keeps JetBrains Mono.omarchy-font-setnow replaces only the family in alacritty's font lines and keeps each style, and the keybinding extractor readso.bind_preinstalled. It leaves out these, because their services are blocked or unreliable in mainland China without a VPN:Kept, as questions for the maintainer:
Switching.
omarchy-regionkeeps the command-scoped sudo boundary: it renders as the caller, checks the region's first servers answer, applies the tool settings, then has root copy the two pacman files and rename the marker into place, last. Until the marker names the new region, any exit, including a closed terminal or Ctrl+C, puts the old region back; when a closed terminal leaves the rollback unable to authenticate, it says how to finish. It does not resync or upgrade packages.Existing installs have no marker and stay World until switched.
docs/regions.mdcovers the layout, the fallback rules and the trust model.Related: #11456, #9695, #15118, #15119.