I will start by quoting the EXAMPLES section in man xdg-mime
EXAMPLES
xdg-mime install shinythings-shiny.xml
Adds a file type description for "shiny"-files. "shinythings-" is used as the vendor prefix. The file type description could look as follows.
shinythings-shiny.xml:
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-shiny">
<comment>Shiny new file type</comment>
<glob pattern="*.shiny"/>
<glob pattern="*.shi"/>
</mime-type>
</mime-info>
An icon for this new file type must also be installed, for example with:
xdg-icon-resource install --context mimetypes --size 64 shiny-file-icon.png text-x-shiny
I wish to understand both adding this mime association for 1) my user account as well as 2) system-wide.
From the same man page
xdg-mime install [--mode mode] [--novendor] mimetypes-file
--mode mode
mode can be user or system. In user mode the file is (un)installed for the current user only. In system mode the file is (un)installed for all users on the system. Usually only root is allowed to install in system mode.
The default is to use system mode when called by root and to use user mode when called by a non-root user.
when including glob-deleteall in a user-local definition, it removes any existing system-wide mime associations
Yes, glob-deleteall is used to overwrite the glob part of a mimetype definition but not only system-wide. Both depending on the mode
mentions the specific directories where things should be located on an Arch Linux system
system mode would install to /usr/share/mime/. user mode to .local/share/mime and the file list is:
./.local/share/mime/generic-icons
./.local/share/mime/mime.cache
./.local/share/mime/types
./.local/share/mime/text
./.local/share/mime/text/x-shiny.xml
./.local/share/mime/version
./.local/share/mime/treemagic
./.local/share/mime/globs
./.local/share/mime/globs2
./.local/share/mime/aliases
./.local/share/mime/subclasses
./.local/share/mime/magic
./.local/share/mime/icons
./.local/share/mime/XMLnamespaces
./.local/share/mime/packages/shinythings-shiny.xml
After all, run
update-mime-database ~/.local/share/mime/
to activate the configuartion.