Updated file structure and updated XDG variables

This commit is contained in:
Brian Zalewski 2023-08-08 01:29:21 -04:00 committed by GitHub
parent 78b27bd6cf
commit 5e16d6c224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 336 additions and 1247 deletions

View file

@ -50,8 +50,8 @@ tasks:
cmds:
- .config/log info "PATH variable --> $PATH"
- task: :install:go:bin
- mkdir -p "$HOME/.config/bin"
- jq '. | .default_path = "./.bin" | .bins = {}' <<< $(echo '{}') > "$HOME/.config/bin/config.json"
- mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/bin"
- jq '. | .default_path = "./.bin" | .bins = {}' <<< $(echo '{}') > "${XDG_CONFIG_HOME:-$HOME/.config}/bin/config.json"
- |
if [ -n "$CI" ]; then echo "*************** GitHub --> {{.BIN}}"; fi
- |

View file

@ -338,15 +338,15 @@ tasks:
start: Installing the "Development Tools" group
success: Successfully installed the "Development Tools" group
cmds:
- mkdir -p "$HOME/.config/bodega"
- mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/bodega"
- |
if [ ! -f "$HOME/.config/bodega/yum-devtools-check-ran" ]; then
if [ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}HOME:-$HOME/.config}/bodega/yum-devtools-check-ran" ]; then
if type dnf &> /dev/null; then
dnf groupinfo 'Development Tools' &> "$HOME/.config/bodega/dnf-devtools-check-ran"
dnf groupinfo 'Development Tools' &> "${XDG_CONFIG_HOME:-$HOME/.config}/bodega/dnf-devtools-check-ran"
else
yum grouplist 'Development Tools' &> "$HOME/.config/bodega/yum-devtools-check-ran"
yum grouplist 'Development Tools' &> "${XDG_CONFIG_HOME:-$HOME/.config}/bodega/yum-devtools-check-ran"
fi
DEV_TOOLS_NOT_INSTALLED="$(grep 'No groups match' < "$HOME/.config/bodega/yum-devtools-check-ran" > /dev/null)"
DEV_TOOLS_NOT_INSTALLED="$(grep 'No groups match' < "${XDG_CONFIG_HOME:-$HOME/.config}/bodega/yum-devtools-check-ran" > /dev/null)"
if [[ "$DEV_TOOLS_NOT_INSTALLED" == '0' ]]; then
if type sudo &> /dev/null; then
if type dnf &> /dev/null; then
@ -362,7 +362,7 @@ tasks:
fi
fi
fi
touch "$HOME/.config/bodega/yum-devtools-check-ran"
touch "${XDG_CONFIG_HOME:-$HOME/.config}/bodega/yum-devtools-check-ran"
fi
common:linux:redhat:fedora:

View file

@ -100,5 +100,6 @@
"workbench.startupEditor": "readme",
"workbench.welcomePage.walkthroughs.openOnInstall": false,
"yaml.format.printWidth": 160,
"yaml.format.singleQuote": true
"yaml.format.singleQuote": true,
"editor.acceptSuggestionOnEnter": "off"
}

View file

@ -59,7 +59,7 @@
Want to try out a new desktop jam-packed with a whole suite of GitHub's most-starred projects? Install Doctor is a combination of application settings, theme files, and a performant yet flexible software installer written with [ZX](https://github.com/google/zx). It is easily customizable, with optional prompts that ask you for API keys if you want to completely automate everything. The installer supports almost any operating system, just checkout the [software.yml file](https://gitlab.com/megabyte-labs/install.doctor/-/blob/master/software.yml). It uses [Chezmoi](https://github.com/twpayne/chezmoi) to apply file changes in an interactive way. It is not your typical Chezmoi project - it is built around the philosophy that you should be able to bash all your computers to bits with a hammer and then resurrect them the next day ✝️️ by storing stateful data to an encrypted S3 bucket and automating desktop configuration as much as possible.
Sexy Start is a cross-platform development environment provisioning system. The project began as an ongoing Ansible project named [Gas Station](https://github.com/megabyte-labs/gas-station) but transitioned to a dotfile-ish approach for easier adoption and less overhead. It is intended for:
Install Doctor is a cross-platform development environment provisioning system. The project began as an ongoing Ansible project named [Gas Station](https://github.com/megabyte-labs/gas-station) but transitioned to a dotfile-ish approach for easier adoption and less overhead. It is intended for:
1. Power users that want to maximize their long-term efficiency by incorporating the [most-starred applications / projects / CLIs on GitHub](https://stars.megabyte.space) into their stack.
2. Users that distro hop but want to retain their favorite tools regardless of whether they are using macOS, Windows, or Linux

View file

@ -1,5 +0,0 @@
# Environment Variable Configuration
Install Doctor can provision most of the system without additional input. However, you can take advantage of more features if you pass in variables with API keys which are used to leverage free cloud services.
For more details on how you can customize your deployment, check out the [Customization](https://install.doctor/customization) and the [Integrating Secrets](https://install.doctor/customization/secrets) documentation.

View file

@ -1,35 +0,0 @@
```
🍺 /usr/local/Cellar/sftpgo/2.5.3: 174 files, 50.3MB
==> Running `brew cleanup sftpgo`...
Removing: /usr/local/Cellar/sftpgo/2.5.2... (174 files, 50.2MB)
==> Upgrading angular-cli
16.1.1 -> 16.1.4
==> Pouring angular-cli--16.1.4.ventura.bottle.tar.gz
🍺 /usr/local/Cellar/angular-cli/16.1.4: 6,965 files, 31.2MB
==> Running `brew cleanup angular-cli`...
Removing: /usr/local/Cellar/angular-cli/16.1.1... (6,970 files, 31.2MB)
==> Upgrading docker-compose
2.19.0 -> 2.19.1
==> Pouring docker-compose--2.19.1.ventura.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/docker-compose
Target /usr/local/bin/docker-compose
already exists. You may want to remove it:
rm '/usr/local/bin/docker-compose'
To force the link and overwrite all conflicting files:
brew link --overwrite docker-compose
To list all files that would be deleted:
brew link --overwrite --dry-run docker-compose
Possible conflicting files are:
/usr/local/bin/docker-compose -> /Applications/Docker.app/Contents/Resources/bin/docker-compose
==> Caveats
Compose is now a Docker plugin. For Docker to find this plugin, symlink it:
mkdir -p ~/.docker/cli-plugins
ln -sfn /usr/local/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
```

View file

@ -1,16 +0,0 @@
## Post-Installation
The script has finished provisioning. Enjoy! You can review the installation logs which are stored at `~/.local/share/install.doctor.$(date +%s).log`. If you come across any issues, have some good ideas, or want to get involved, feel free to open an issue on [GitHub](https://github.com/megabyte-labs/install.doctor) or check out our [Community](https://install.doctor/community). Pull requests / stars are welcome too.
### Next Steps
1. Fork the project so you can add your own customizations (using the method described at the top of the README.md)
2. Review the [README.md](https://github.com/megabyte-labs/install.doctor) for a high-level overview
3. Utilize the [Install Doctor documentation](https://install.doctor/docs) for more thorough details
4. Check out the [Chezmoi documentation](https://www.chezmoi.io/) (since this project utilizes it heavily)
5. Open a pull request with your own improvements if you want to contribute
6. Visit [Megabyte Labs](https://megabyte.space) to see what else we are up to
**bZ out**
_Note: Some of the settings / applications might require a reboot (or at the very least, a terminal reload)._

View file

@ -1,81 +0,0 @@
Sexy Start is a cross-platform development environment provisioning system. The project began as an ongoing Ansible project named [Gas Station](https://github.com/megabyte-labs/gas-station) but transitioned to a dotfile-ish approach for easier adoption and less overhead. It is intended for:
1. Power users that want to maximize their long-term efficiency by incorporating the [most-starred applications / projects / CLIs on GitHub](https://stars.megabyte.space) into their stack.
2. Users that distro hop but want to retain their favorite tools regardless of whether they are using macOS, Windows, or Linux
3. People that want to reformat their computers on a, perhaps, daily basis while retaining stateful elements of their file system by leveraging S3 buckets
4. Enthusiasts that want to deploy as many cool, useful tools as possible without having to spend much time configuring their file system
5. Perfectionists that love software that behaives as it should, looks gorgeous (desktop preview screenshots below), and performs tasks quickly on any platform
6. CLI ninjas that want to bring their set of tools wherever they go
## Quick Start
To provision your workstation, you can run the following which will install some basic dependencies (e.g. Chezmoi) and provide interactive prompts where you can personalize your configuration:
```
bash <(curl -sSL https://install.doctor/start)
```
If you fork this repository and would like to use your fork as the source, you can still use the command shown above by setting the `START_REPO` environment variable. If it is located on GitHub, you can do this by running:
```
START_REPO=my-gh-user/my-fork-name bash <(curl -sSL https://install.doctor/start)
```
Alternatively, if you want to host your project on GitLab or another git provider, then just specify the git remote's URL:
```
START_REPO=git@gitlab.com:megabyte-labs/install.doctor.git bash <(curl -sSL https://install.doctor/start)
```
### Quick Start Notes
- The quick start script is tested on the latest versions of Archlinux, CentOS, Debian, Fedora, macOS, and Ubuntu
- The quick start script is the preferred method of using this project to provision your system
- The script can be configured to be completely headless by specifying environment variables which are detailed below
- _Windows support is on the roadmap._
## Chezmoi-Based
This project leverages [Chezmoi](https://github.com/twpayne/chezmoi) to provide:
1. File diffs that show how files are being changed
2. Easy-to-use encryption that lets you store private data publicly on GitHub
3. A basic set of prompts that accept and integrate API credentials for services like CloudFlare, GitHub, GitLab, and Slack so that your development environment is augmented by free cloud services
## Security Focused
This software was built in an adversarial environment. This led towards a focus on security which is why we employ technologies like [Firejail](https://github.com/netblue30/firejail), [Portmaster](https://safing.io/), [Little Snitch](https://www.obdev.at/products/littlesnitch/index.html), and [Qubes](https://www.qubes-os.org/). Whenever possible, Flatpaks are used as the preferred application type. This also led to an emphasis on performance. When your workstation is possibly compromised or you have a good habit of reformatting your workstation on regular basis then it makes sense to use a provisioning system that can restore the workstation to a similar state quicker.
## Cross-Platform
This project has been developed with support for Archlinux, CentOS, Fedora, macOS, Ubuntu, and Windows. Almost all the testing has been done on x86_64 systems but the system is flexible enough to be adapted for other systems such as ARM or FreeBSD. A lot of effort has also gone into supporting Qubes which, when fully provisioned, is basically a combination of all the operating systems we have developed this project for.
### Custom Software Provisioning System
The project also incorporates a custom [ZX](https://github.com/google/zx) script that allows you to choose which package managers you would like to manage your software. It attempts to be as asynchronous as possible without opening the door to errors. The script leverages the [software.yml](/software.yml) file in the root of this repository to figure out which package manager to use. By default, the installer will choose the most secure option (e.g. Flatpaks are preferred for Linux applications). The installer is more performant and less error-prone than our Ansible variant. It also makes it a lot easier to add software to your stack in such a way that you can keep the software regardless of what operating system you are using by storing everything in the aforementioned `software.yml` file.
### Beautiful Anywhere
Windows and macOS do a great job of making things look good from a UI perspective out of the box. Linux on the other hand requires some finessing especially when you follow our philosophy of taking many different operating systems and deploying similar software on them. A sizable amount of effort went into customizing the popular [Sweet](https://github.com/EliverLara/Sweet) theme and adapting it to our liking. Bells and whistles like a customized GRUB2 and Plymouth theme are included.
### Qubes Support
Qubes support is on its way.
## Gas Station
This project began as something to supplement our provisioning system that uses Ansible. The system is called [Gas Station](https://gitlab.com/megabyte-labs/gas-station). It includes hundreds of Ansible roles. If you look at the [`software.yml`](/software.yml) file, you will notice that some of the Ansible roles that Gas Station provides are inside of it. By default, this project will try to install software / dependencies using other, lighter methods before resorting to using Ansible. This is because of the software installer order that is defined at the top of the software.yml file. Gas Station is also still used to house some of the variables / data that this project uses.
## Chezmoi
This project uses Chezmoi to orchestrate the provisioning. After calling the quick start script shown above, the quick start script will ensure some dependencies are installed (including Chezmoi) and then initiate Chezmoi. In order to customize this project, you should head over to the Chezmoi documentation to get a better understanding of why some of the files in this repository start with `dot_`, `run_`, etc.
### Resetting Chezmoi
This script is designed to run only the code that is necessary to improve performance. This is accomplished by using [`.chezmoiscripts`](home/.chezmoiscripts), Chezmoi's `onchange_` identifier, and a custom installer written in ZX that is powered by the software definitions in [`software.yml`](software.yml).
If there is an error during the provision process or you make changes that are not being run during the provision process then you might want to clear Chezmoi's cache and configuration. This can be done on macOS/Linux by running:
```
rm -rf ~/.config/chezmoi && rm -rf ~/.cache/chezmoi
```

View file

@ -6,21 +6,21 @@
### Symlink the variables / files / inventories to ~/.config/ansible folders if they are present
### i.e. Changes to upstream will not impact the play if your configuration files are stored locally
for TARGET in "files" "group_vars" "host_vars" "inventories" "templates"; do
if [ -d "$HOME/.config/ansible/$TARGET" ] && [ "$(readlink -f "$HOME/.local/share/ansible/$TARGET")" != "$HOME/.config/ansible/$TARGET" ]; then
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/ansible/$TARGET" ] && [ "$(readlink -f "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/$TARGET")" != "${XDG_CONFIG_HOME:-$HOME/.config}/ansible/$TARGET" ]; then
logg 'Symlinking Ansible playbook `'"$TARGET"'` to ~/.config/ansible/$TARGET'
rm -f "$HOME/.local/share/ansible/$TARGET"
ln -s "$HOME/.config/ansible/$TARGET" "$HOME/.local/share/ansible/$TARGET"
rm -f "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/$TARGET"
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/ansible/$TARGET" "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/$TARGET"
fi
done
### Symlink tasks as well
### Note: Only handles tasks one level deep (i.e. ~/.config/ansible/tasks/my-task.yml will link to the tasks folder
### but ~/.config/ansible/tasks/directory/my-other-task.yml will not)
if [ -d "$HOME/.config/ansible/tasks" ]; then
find "$HOME/.config/ansible/tasks" -type f | while read TASK_FILE; do
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/ansible/tasks" ]; then
find "${XDG_CONFIG_HOME:-$HOME/.config}/ansible/tasks" -type f | while read TASK_FILE; do
TASK_FILE_NAME="$(echo "$TASK_FILE" | sed 's/.*\/\([^\/]*\)$/\1/')"
if [ "$(readlink -f "$HOME/.local/share/ansible/tasks/$TASK_FILE_NAME")" != "$TASK_FILE" ]; then
ln -s "$TASK_FILE" "$HOME/.local/share/ansible/tasks/$TASK_FILE_NAME"
if [ "$(readlink -f "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/tasks/$TASK_FILE_NAME")" != "$TASK_FILE" ]; then
ln -s "$TASK_FILE" "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/tasks/$TASK_FILE_NAME"
fi
done
fi

View file

@ -37,7 +37,7 @@ decryptionFailure() {
logg info 'Proceeding without decrypting age encryption key stored at `~/.local/share/chezmoi/home/key.txt.age`'
logg info 'To have Chezmoi handle your encryption (so you can store your private files publicly) take a look at https://shorturl.at/jkpzG'
logg info 'Removing all files that begin with encrypted_ because decryption failed'
find "$HOME/.local/share/chezmoi" -type f -name "encrypted_*" | while read ENCRYPTED_FILE; do
find "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi" -type f -name "encrypted_*" | while read ENCRYPTED_FILE; do
logg info "Removing $ENCRYPTED_FILE"
rm -f "$ENCRYPTED_FILE"
done

View file

@ -13,7 +13,7 @@ if command -v brew > /dev/null && command -v sdkman-cli > /dev/null; then
export SDKMAN_DIR="$(brew --prefix sdkman-cli)/libexec"
. "$SDKMAN_DIR/bin/sdkman-init.sh"
elif [ -f "$SDKMAN_DIR/bin/sdkman-init.sh" ]; then
export SDKMAN_DIR="$XDG_DATA_HOME/sdkman"
export SDKMAN_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/sdkman"
. "$SDKMAN_DIR/bin/sdkman-init.sh"
fi

View file

@ -17,13 +17,13 @@ if [ -f /tmp/install-gnome-extensions.txt ]; then
fi
### Register temporary file for gnome.yml JSON
if [ -f "$HOME/.config/desktop/gnome.yml" ]; then
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/desktop/gnome.yml" ]; then
TMP_YQ="$(mktemp)"
cat "$HOME/.config/desktop/gnome.yml" | yq e -o=j '.' > "$TMP_YQ"
cat "${XDG_CONFIG_HOME:-$HOME/.config}/desktop/gnome.yml" | yq e -o=j '.' > "$TMP_YQ"
fi
### Populate /tmp/install-gnome-extensions.txt with GNOME extensions that need to be installed
if [ -f "$HOME/.config/desktop/gnome.yml" ]; then
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/desktop/gnome.yml" ]; then
cat "$TMP_YQ" | jq -c '.default_gnome_extensions[] | tojson' | while read EXT; do
TMP="$(mktemp)"
echo "$EXT" | sed 's/^.\(.*\).$/\1/' > "$TMP"
@ -66,7 +66,7 @@ else
fi
### Apply plugin gsettings
if [ -f "$HOME/.config/desktop/gnome.yml" ]; then
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/desktop/gnome.yml" ]; then
cat "$TMP_YQ" | jq -c '.default_gnome_extensions[] | tojson' | while read EXT; do
if [ "$DEBUG_MODE" == 'true' ]; then
logg info 'Extension data:'

View file

@ -16,12 +16,12 @@ if [ -d /Applications ] && [ -d /System ]; then
logg info 'Copying fonts from ~/Library/Fonts and ~/.local/share/fonts to /Library/Fonts to make them available globally'
FONT_DIR='/Library/Fonts'
sudo rsync -av "$HOME/Library/Fonts" "$FONT_DIR"
sudo rsync -av "$HOME/.local/share/fonts" "$FONT_DIR"
sudo rsync -av "${XDG_DATA_HOME:-$HOME/.local/share}/fonts" "$FONT_DIR"
else
# Linux
logg info 'Copying fonts from ~/.local/share/fonts to /usr/local/share/fonts to make them available globally'
FONT_DIR='/usr/local/share/fonts'
sudo rsync -av "$HOME/.local/share/fonts" "$FONT_DIR"
sudo rsync -av "${XDG_DATA_HOME:-$HOME/.local/share}/fonts" "$FONT_DIR"
fi
### Configure system font properties

View file

@ -28,8 +28,8 @@ dconf dump / > "$DCONF_TMP"
logg info 'Backed up system dconf settings to '"$DCONF_TMP"
### Reset system settings / load saved configurations from ~/.config/dconf/settings
if [ -d "$XDG_CONFIG_HOME/dconf/settings" ]; then
find "$XDG_CONFIG_HOME/dconf/settings" -mindepth 1 -maxdepth 1 -type f | while read DCONF_CONFIG_FILE; do
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" ]; then
find "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" -mindepth 1 -maxdepth 1 -type f | while read DCONF_CONFIG_FILE; do
if [ "$DEBUG_MODE" == 'true' ]; then
logg info 'Dconf configuration file:'
echo "$DCONF_CONFIG_FILE"

View file

@ -11,5 +11,5 @@
{{ includeTemplate "universal/logg" }}
logg 'Installing crontab jobs'
crontab < "$XDG_CONFIG_HOME/crontab/config"
crontab < "${XDG_CONFIG_HOME:-$HOME/.config}/crontab/config"
{{ end -}}

View file

@ -52,7 +52,7 @@
if command -v rclone > /dev/null; then
{{- if and (or (and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_R2_ID"))) (env "CLOUDFLARE_R2_ID")) (or (and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_R2_SECRET"))) (env "CLOUDFLARE_R2_SECRET")) (ne .user.cloudflare.r2 "") }}
logg info 'Removing ~/.config/rclone/rclone.conf INSTALL DOCTOR managed block'
CONFIG_FILE="$HOME/.config/rclone/rclone.conf"
CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/rclone/rclone.conf"
if cat "$CONFIG_FILE" | grep '# INSTALL DOCTOR MANAGED S3'; then
# TODO: Remove old block
START_LINE="$(echo `grep -n -m 1 "# INSTALL DOCTOR MANAGED S3" "$CONFIG_FILE" | cut -f1 -d ":"`)"

View file

@ -19,7 +19,7 @@ if [ "$DEBUG_MODE" == 'true' ]; then
fi
### Initialize
COMPLETION_DIR="$HOME/.local/share/bash-completion/completions"
COMPLETION_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions"
mkdir -p "$COMPLETION_DIR"
### Aqua

View file

@ -15,7 +15,7 @@
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### Ensure node is installed

View file

@ -11,7 +11,7 @@
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### Ensure recent version of Node.js is being used

View file

@ -11,7 +11,7 @@
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
if command -v brew > /dev/null; then

View file

@ -3,14 +3,14 @@
### Source .bashrc if it is present
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
elif [ -f "$HOME/.config/shell/exports.sh" ]; then
. "$HOME/.config/shell/exports.sh"
elif [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/exports.sh" ]; then
. "${XDG_CONFIG_HOME:-$HOME/.config}/shell/exports.sh"
fi
### XDG
XDG_CONFIG_HOME="$HOME/.config"
XDG_CACHE_HOME="$HOME/.cache"
XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
### Ensure Homebrew PATHs
if [ -d "/home/linuxbrew/.linuxbrew/bin" ]; then
@ -29,10 +29,10 @@ fi
export HOMEBREW_NO_ANALYTICS=1
### SDKMan
export SDKMAN_DIR="$XDG_DATA_HOME/sdkman"
export SDKMAN_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/sdkman"
### Volta
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### Ensure ~/.local/bin in PATH

View file

@ -17,7 +17,7 @@ if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
fi
### Import Common Settings
[ ! -f "$HOME/.config/shell/profile.sh" ] || . "$HOME/.config/shell/profile.sh"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/profile.sh" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/profile.sh"
### Ble.sh
[[ $- == *i* ]] && source "${XDG_DATA_HOME:-$HOME/.local/share}/blesh/ble.sh" --noattach --rcfile "${XDG_DATA_CONFIG:-$HOME/.config}/blesh/bleshrc"
@ -68,7 +68,7 @@ if [ "$BASH_SUPPORT" = 'true' ]; then
. "$BASH_IT/bash_it.sh"
elif command -v oh-my-posh > /dev/null; then
# Oh My Posh (See: https://ohmyposh.dev/)
eval "$(oh-my-posh init bash --config "$XDG_CONFIG_HOME/oh-my-posh/Betelgeuse.omp.json")"
eval "$(oh-my-posh init bash --config "${XDG_CONFIG_HOME:-$HOME/.config}/oh-my-posh/Betelgeuse.omp.json")"
else
# Basic styled terminal
case "$TERM" in
@ -79,9 +79,7 @@ if [ "$BASH_SUPPORT" = 'true' ]; then
fi
else
# Minimal session
if command -v oh-my-posh > /dev/null; then
eval "$(oh-my-posh init bash --config "$XDG_CONFIG_HOME/oh-my-posh/Betelgeuse-minimal.omp.json")"
fi
! command -v oh-my-posh > /dev/null || eval "$(oh-my-posh init bash --config "${XDG_CONFIG_HOME/.config}/oh-my-posh/Betelgeuse-minimal.omp.json")"
fi
### Bash Completion (Homebrew)
@ -97,34 +95,22 @@ if [ "$BASH_SUPPORT" = 'true' ]; then
fi
### Atuin
if command -v atuin > /dev/null; then
eval "$(atuin init bash)"
fi
! command -v atuin > /dev/null || eval "$(atuin init bash)"
### Carapace
if command -v carapace > /dev/null; then
source <(carapace _carapace)
fi
! command -v carapace > /dev/null || source <(carapace _carapace)
### Cod
if command -v cod > /dev/null; then
. <(cod init $$ bash)
fi
! command -v cod > /dev/null || . <(cod init $$ bash)
### Google Cloud SDK
if [ -f "${HOMEBREW_PREFIX}/share/google-cloud-sdk/path.bash.inc" ]; then
. "$HOMEBREW_PREFIX/share/google-cloud-sdk/path.bash.inc"
fi
[ ! -f "${HOMEBREW_PREFIX}/share/google-cloud-sdk/path.bash.inc" ] || . "$HOMEBREW_PREFIX/share/google-cloud-sdk/path.bash.inc"
### direnv
if command -v direnv > /dev/null; then
eval "$(direnv hook bash)"
fi
! command -v direnv > /dev/null || eval "$(direnv hook bash)"
### Emplace
if command -v emplace > /dev/null; then
. <(emplace init bash)
fi
! command -v emplace > /dev/null || . <(emplace init bash)
### hiSHtory
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/hishtory/config.sh" ]; then
@ -138,14 +124,10 @@ if [ "$BASH_SUPPORT" = 'true' ]; then
fi
### iTerm2
if [ -f "$HOME/.local/scripts/iterm2.bash" ]; then
. "$HOME/.local/scripts/iterm2.bash"
fi
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.bash" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.bash"
### Fig
if [ -f "$HOME/.fig/shell/bashrc.post.bash" ]; then
. "$HOME/.fig/shell/bashrc.post.bash"
fi
[ ! -f "$HOME/.fig/shell/bashrc.post.bash" ] || . "$HOME/.fig/shell/bashrc.post.bash"
### Mamba Forge (Faster Conda Drop-In Replacement)
# TODO: Add logic for Linux
@ -185,28 +167,22 @@ if [ "$BASH_SUPPORT" = 'true' ]; then
fi
### Navi (Ctrl+G)
if command -v navi > /dev/null; then
eval "$(navi widget bash)"
fi
! command -v navi > /dev/null || eval "$(navi widget bash)"
### SDKMan
if command -v brew > /dev/null && command -v sdkman-cli > /dev/null; then
export SDKMAN_DIR="$(brew --prefix sdkman-cli)/libexec"
. "$SDKMAN_DIR/bin/sdkman-init.sh"
elif [ -f "$SDKMAN_DIR/bin/sdkman-init.sh" ]; then
export SDKMAN_DIR="$XDG_DATA_HOME/sdkman"
export SDKMAN_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/sdkman"
. "$SDKMAN_DIR/bin/sdkman-init.sh"
fi
### Up
if [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/up/up.sh" ]; then
. "${XDG_DATA_HOME:-$HOME/.local/share}/up/up.sh"
fi
[ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/up/up.sh" ] || . "${XDG_DATA_HOME:-$HOME/.local/share}/up/up.sh"
### Vault
if command -v vault > /dev/null; then
complete -C vault vault
fi
! command -v vault > /dev/null || complete -C vault vault
### zoxide
if command -v zoxide > /dev/null; then

View file

@ -22,6 +22,7 @@ The following plugins were tested but removed because the `extensions.json` alre
"gitpod.gitpod-desktop",
"gitpod.gitpod-remote-ssh", // Bunch of errors like this during install [gitpod-remote-ssh]: Couldn't find message for key openPreview.
"google-home.google-home-extension",
"htmlhint.vscode-htmlhint", // Couldn't start client HTML-hint on macOS GitHub remote repository
"ibm.codewind", // Creates a ~/.codewind folder. Does not respect XDG spec.
"ibm.ibm-developer",
"idered.npm",

View file

@ -65,7 +65,6 @@
"hashicorp.sentinel",
"hashicorp.terraform",
"hediet.vscode-drawio",
"htmlhint.vscode-htmlhint",
"humao.rest-client",
"ibm.output-colorizer",
"jerrygoyal.shortcut-menu-bar",

View file

@ -53,13 +53,15 @@
"**/.trunk/*actions/": true,
"**/.trunk/*logs/": true,
"**/.trunk/*out/": true,
"**/.trunk/*plugins/": true
"**/.trunk/*plugins/": true,
"**/.trunk/*notifications/": true
},
"files.watcherExclude": {
"**/.trunk/*actions/": true,
"**/.trunk/*logs/": true,
"**/.trunk/*out/": true,
"**/.trunk/*plugins/": true
"**/.trunk/*plugins/": true,
"**/.trunk/*notifications/": true
},
"git.autofetch": true,
"git.enableSmartCommit": true,
@ -342,5 +344,26 @@
"pieces.autocomplete": true,
"pieces.autocompleteKey": "Tab only",
"pieces.notifications": "Only Critical Notifications",
"thunder-client.workspaceRelativePath": ".config"
"thunder-client.workspaceRelativePath": ".config",
"editor.acceptSuggestionOnEnter": "off",
"files.associations": {
"**/frontmatter.json": {
"**/frontmatter.json": "jsonc",
"**/.frontmatter/config/*.json": "jsonc",
".env*": "dotenv"
},
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "keyword.other.dotenv",
"settings": {
"foreground": "#FF000000"
}
}
]
},
"workbench.editorAssociations": {
"*.webp": "magickImageReader.readImage"
}
}
}

View file

@ -1,24 +1,37 @@
{
"sh.enable": true,
"dockerfile": {
"command": "docker-langserver",
"filetypes": ["Dockerfile"],
"args": ["--stdio"]
},
"sql": {
"module": "$HOME/.local/share/nvim/lib/node_modules/sql-language-server/npm_bin/cli.js",
"args": ["up", "--method", "node-ipc"],
"filetypes": ["sql", "mysql"]
},
"terraform": {
"command": "terraform-ls",
"args": ["serve"],
"filetypes": [
"terraform",
"tf"
],
"initializationOptions": {},
"settings": {}
}
"dockerfile": {
"command": "docker-langserver",
"filetypes": [
"Dockerfile"
],
"args": [
"--stdio"
]
},
"sql": {
"module": "${XDG_DATA_HOME:-$HOME/.local/share}/nvim/lib/node_modules/sql-language-server/npm_bin/cli.js",
"args": [
"up",
"--method",
"node-ipc"
],
"filetypes": [
"sql",
"mysql"
]
},
"terraform": {
"command": "terraform-ls",
"args": [
"serve"
],
"filetypes": [
"terraform",
"tf"
],
"initializationOptions": {},
"settings": {}
}
}
}

View file

@ -3,7 +3,7 @@ container_generate_entry=0
container_manager="docker"
container_image_default="registry.opensuse.org/opensuse/toolbox:latest"
container_name_default="distrobox"
container_user_custom_home="$HOME/.local/share/distrobox"
container_user_custom_home="${XDG_DATA_HOME:-$HOME/.local/share}/distrobox"
# container_init_hook="~/.local/distrobox/a_custom_default_init_hook.sh"
# container_pre_init_hook="~/a_custom_default_pre_init_hook.sh"
# container_manager_additional_flags="--env-file /path/to/file --custom-flag"

View file

@ -83,10 +83,10 @@ fi
### mitmproxy / mitmweb
if command -v mitmproxy > /dev/null; then
alias mitmproxy="mitmproxy --set confdir=$XDG_CONFIG_HOME/mitmproxy"
alias mitmproxy="mitmproxy --set confdir=${XDG_CONFIG_HOME:-$HOME/.config}/mitmproxy"
fi
if command -v mitmweb > /dev/null; then
alias mitmweb="mitmweb --set confdir=$XDG_CONFIG_HOME/mitmproxy"
alias mitmweb="mitmweb --set confdir=${XDG_CONFIG_HOME:-$HOME/.config}/mitmproxy"
fi
### ripgrep
@ -258,7 +258,7 @@ fi
alias wget="wget --hsts-file ~/.local/wget-hsts"
### Yarn
alias yarn='yarn --use-yarnrc "$XDG_CONFIG_HOME/yarn/config"'
alias yarn='yarn --use-yarnrc "${XDG_CONFIG_HOME:-$HOME/.config}/yarn/config"'
# Running this will update GPG to point to the current YubiKey
alias yubi-stub='gpg-connect-agent "scd serialno" "learn --force" /bye'

View file

@ -10,9 +10,9 @@ export DO_NOT_TRACK=1
### XDG
# Source: # https://wiki.archlinux.org/index.php/XDG_Base_Directory
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_RUNTIME_DIR=
{{- if eq .host.distro.family "darwin" -}}
@ -35,8 +35,8 @@ export XDG_PUBLICSHARE_DIR="$HOME/Public"
### Theme
export COLOR_SCHEME=dark
export GTK_RC_FILES="$XDG_CONFIG_HOME/gtk-1.0/gtkrc"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export GTK_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-1.0/gtkrc"
export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc"
### PATH References
export PATH_TASK="$(which task)"
@ -70,7 +70,7 @@ elif [ -f /usr/local/bin/brew ]; then
fi
### Android Studio
export ANDROID_AVD_HOME="$XDG_DATA_HOME/android/avd"
export ANDROID_AVD_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/android/avd"
if [ -d /Applications ] && [ -d /System ]; then
### macOS
export WHALEBREW_INSTALL_PATH="/usr/local/bin"
@ -85,54 +85,54 @@ if [ -d /Applications ] && [ -d /System ]; then
fi
else
### Linux / Windows
export ANDROID_SDK_HOME="$XDG_DATA_HOME/android/sdk"
export ANDROID_SDK_ROOT="$XDG_DATA_HOME/android/sdk"
export ANDROID_HOME="$XDG_DATA_HOME/sdk"
export PATH="$PATH:$XDG_DATA_HOME/android/sdk/cmdline-tools/latest/bin"
export PATH="$PATH:$XDG_DATA_HOME/android/sdk/platform-tools"
export PATH="$PATH:$XDG_DATA_HOME/android/sdk/tools/bin"
export PATH="$PATH:$XDG_DATA_HOME/android/sdk/tools"
export ANDROID_SDK_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/android/sdk"
export ANDROID_SDK_ROOT="${XDG_DATA_HOME:-$HOME/.local/share}/android/sdk"
export ANDROID_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/sdk"
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local/share}/android/sdk/cmdline-tools/latest/bin"
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local/share}/android/sdk/platform-tools"
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local/share}/android/sdk/tools/bin"
export PATH="$PATH:${XDG_DATA_HOME:-$HOME/.local/share}/android/sdk/tools"
fi
### Ansible
export ANSIBLE_CONFIG="$XDG_DATA_HOME/ansible/ansible.cfg"
export ANSIBLE_HOME="$XDG_DATA_HOME/ansible"
export ANSIBLE_CONFIG="${XDG_DATA_HOME:-$HOME/.local/share}/ansible/ansible.cfg"
export ANSIBLE_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/ansible"
### Aqua
export AQUA_ROOT_DIR="$XDG_DATA_HOME/aqua"
export AQUA_GLOBAL_CONFIG="$XDG_CONFIG_HOME/aqua/aqua.yaml"
export AQUA_ROOT_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/aqua"
export AQUA_GLOBAL_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/aqua/aqua.yaml"
export PATH="${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin:$PATH"
### ASDF
export ASDF_CONFIG_FILE="$XDG_CONFIG_HOME/asdf/asdfrc"
export ASDF_DIR="$XDG_DATA_HOME/asdf"
export ASDF_CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/asdfrc"
export ASDF_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/asdf"
export ASDF_DATA_DIR="$ASDF_DIR"
export ASDF_CRATE_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-cargo-pkgs"
export ASDF_GEM_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-ruby-pkgs"
export ASDF_GOLANG_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-golang-pkgs"
export ASDF_CRATE_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-cargo-pkgs"
export ASDF_GEM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-ruby-pkgs"
export ASDF_GOLANG_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-golang-pkgs"
export ASDF_GOLANG_MOD_VERSION_ENABLED=true
export ASDF_NPM_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-npm-packages"
export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-python-pkgs"
export ASDF_NPM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-npm-packages"
export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-python-pkgs"
### AWS CLI
export AWS_SHARED_CREDENTIALS_FILE="$XDG_CONFIG_HOME/aws/credentials"
export AWS_CONFIG_FILE="$XDG_CONFIG_HOME/aws/config"
export AWS_SHARED_CREDENTIALS_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/aws/credentials"
export AWS_CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/aws/config"
if [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.crt" ]; then
export AWS_CA_BUNDLE="${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.crt"
fi
### Azure CLI
export AZURE_CONFIG_DIR="$XDG_CONFIG_HOME/azure"
export AZURE_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/azure"
### bat
export BAT_CONFIG_PATH="$XDG_CONFIG_HOME/bat/config"
export BAT_CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/bat/config"
### Cargo
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo"
export PATH="$PATH:$CARGO_HOME/bin"
### Bash
export BASH_COMPLETION_USER_FILE="$XDG_CONFIG_HOME/bash-completion/bash_completion"
export BASH_COMPLETION_USER_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/bash-completion/bash_completion"
### Bash It
# Don't check mail when opening terminal.
@ -164,37 +164,37 @@ fi
export CONCURRENT_LOG_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/concurrent"
### Desk
export DESK_DIR="$XDG_CONFIG_HOME/desk"
export DESK_DESKS_DIR="$XDG_CONFIG_HOME/desk/desks"
export DESK_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/desk"
export DESK_DESKS_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/desk/desks"
### Deta
export DETA_INSTALL="$XDG_DATA_HOME/deta"
export DETA_INSTALL="${XDG_DATA_HOME:-$HOME/.local/share}/deta"
export PATH="$PATH:$DETA_INSTALL/bin"
### Docker
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
export MACHINE_STORAGE_PATH="$XDG_DATA_HOME/docker-machine"
export DOCKER_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/docker"
export MACHINE_STORAGE_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/docker-machine"
### Dotnet
export DOTNET_CLI_HOME="$XDG_CONFIG_HOME/dotnet"
export DOTNET_CLI_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/dotnet"
if [ -d /Applications ] && [ -d /Library ]; then
export DOTNET_ROOT="/usr/local/opt/dotnet/libexec"
elif [ -d /home/linuxbrew/.linuxbrew/opt/dotnet ]; then
export DOTNET_ROOT="/home/linuxbrew/.linuxbrew/opt/dotnet/libexec"
fi
export PATH="$PATH:$XDG_CONFIG_HOME/dotnet/.dotnet/tools"
export PATH="$PATH:${XDG_CONFIG_HOME:-$HOME/.config}/dotnet/.dotnet/tools"
### Elastic Agent
# https://www.elastic.co/guide/en/fleet/current/agent-environment-variables.html#env-common-vars
### ffmpeg
export FFMPEG_DATADIR="$XDG_CONFIG_HOME/ffmpeg"
export FFMPEG_DATADIR="${XDG_CONFIG_HOME:-$HOME/.config}/ffmpeg"
### Flatpak
if command -v flatpak > /dev/null; then
FLATPAK_INSTALLATIONS="$(flatpak --installations)"
export PATH="$FLATPAK_INSTALLATIONS/exports/bin:$PATH"
export XDG_DATA_DIRS="$HOME/.local/share/flatpak/exports/share:$FLATPAK_INSTALLATIONS/exports/share:$XDG_DATA_DIRS"
export XDG_DATA_DIRS="${XDG_CONFIG_HOME:-$HOME/.local/share}/flatpak/exports/share:$FLATPAK_INSTALLATIONS/exports/share:$XDG_DATA_DIRS"
fi
### fzf
@ -216,12 +216,12 @@ export GIT_MERGE_AUTOEDIT=no
if command -v delta > /dev/null; then
export GF_BAT_STYLE=changes
export GF_BAT_THEME=zenbur
export GF_SNAPSHOT_DIRECTORY="$XDG_DATA_HOME/git-fuzzy-snapshots"
export GF_SNAPSHOT_DIRECTORY="${XDG_DATA_HOME:-$HOME/.local/share}/git-fuzzy-snapshots"
export GF_PREFERRED_PAGER="delta --theme=gruvbox --highlight-removed -w __WIDTH__"
fi
### Go
export GOPATH="$XDG_DATA_HOME/go"
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
export GO111MODULE=on
export PATH="$PATH:${GOPATH}/bin"
if command -v go > /dev/null && which go | grep -q 'asdf' > /dev/null && command -v asdf > /dev/null; then
@ -235,41 +235,41 @@ elif command -v go > /dev/null && command -v brew > /dev/null; then
fi
### Gradle
export GRADLE_USER_HOME="$XDG_DATA_HOME/gradle"
export GRADLE_USER_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/gradle"
### Hishtory
export HISHTORY_PATH="$XDG_CONFIG_HOME/hishtory"
export HISHTORY_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/hishtory"
export HSTR_CONFIG=hicolor
export HSTR_TIOCSTI=y
### Homebrew
export HOMEBREW_BUNDLE_FILE="$XDG_CONFIG_HOME/Brewfile"
export HOMEBREW_BUNDLE_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/Brewfile"
export HOMEBREW_CASK_OPTS="--appdir=/Applications --display-times"
### HTTPie
export HTTPIE_CONFIG_DIR="$XDG_CONFIG_HOME/httpie"
export HTTPIE_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/httpie"
### IPFS
export IPFS_PATH="$XDG_DATA_HOME/ipfs"
export IPFS_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/ipfs"
### k9s
export K9SCONFIG="$XDG_CONFIG_HOME/k9s"
export K9SCONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/k9s"
### KDE
export KDEHOME="$XDG_CONFIG_HOME/kde"
export KDEHOME="${XDG_CONFIG_HOME:-$HOME/.config}/kde"
### Kodi
export KODI_DATA="$XDG_DATA_HOME/kodi"
export KODI_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/kodi"
### Krew
export KREW_ROOT="$XDG_DATA_HOME/krew"
export KREW_ROOT="${XDG_DATA_HOME:-$HOME/.local/share}/krew"
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
### Kube
export KUBECONFIG="$XDG_CONFIG_HOME/kube/config"
export KUBECONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/kube/config"
### Maven
export MAVEN_CONFIG="$XDG_CONFIG_HOME/maven/settings.xml"
export MAVEN_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/maven/settings.xml"
alias mvn="mvn -s $MAVEN_CONFIG"
### McFly
@ -278,7 +278,7 @@ export MCFLY_RESULTS=14
export MCFLY_KEY_SCHEME=vim
### minikube
export MINIKUBE_HOME="$XDG_DATA_HOME/minikube"
export MINIKUBE_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/minikube"
### Monero
if [ -f /Applications/monero-wallet-gui.app/Contents/MacOS/monerod ]; then
@ -286,13 +286,13 @@ if [ -f /Applications/monero-wallet-gui.app/Contents/MacOS/monerod ]; then
fi
### MySQL
export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history"
export MYSQL_HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/mysql_history"
### .netrc
export NETRC="$XDG_CONFIG_HOME/netrc"
export NETRC="${XDG_CONFIG_HOME:-$HOME/.config}/netrc"
### Navi
export NAVI_CONFIG="$XDG_CONFIG_HOME/navi/config.yaml"
export NAVI_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/navi/config.yaml"
### Nix
export NIX_SSL_CERT_FILE="${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.crt"
@ -307,45 +307,45 @@ if command -v nnn > /dev/null; then
fi
### Node.js
export NODE_REPL_HISTORY="$XDG_DATA_HOME/node_repl_history"
export NODE_REPL_HISTORY="${XDG_DATA_HOME:-$HOME/.local/share}/node_repl_history"
if [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.pem" ]; then
export NODE_EXTRA_CA_CERTS="${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.pem"
fi
### NPM
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
export NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/npm/npmrc"
### NTL
export NTL_RUNNER="pnpm"
export NTL_RERUN_CACHE_DIR="$XDG_DATA_HOME/ntl"
export NTL_RERUN_CACHE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/ntl"
export NTL_RERUN_CACHE_NAME="cache"
export NTL_RERUN_CACHE_MAX="100"
### NuGet
export NUGET_PACKAGES="$XDG_DATA_HOME/nuget"
export NUGET_PACKAGES="${XDG_DATA_HOME:-$HOME/.local/share}/nuget"
### Parallels
export PARALLEL_HOME="$XDG_CONFIG_HOME/parallel"
export PARALLEL_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/parallel"
### Pass
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass"
export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/pass"
### Poetry
export POETRY_HOME="$XDG_DATA_HOME/poetry"
export POETRY_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/poetry"
export PATH="$POETRY_HOME/bin:$PATH"
### Porter
export PORTER_HOME="$XDG_DATA_HOME/porter"
export PORTER_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/porter"
export PATH="$PATH:$PORTER_HOME"
### Postgres
export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc"
export PSQLRC="${XDG_CONFIG_HOME:-$HOME/.config}/pg/psqlrc"
export PSQL_HISTORY="$XDG_STATE_HOME/psql_history"
export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass"
export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf"
export PGPASSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/pg/pgpass"
export PGSERVICEFILE="${XDG_CONFIG_HOME:-$HOME/.config}/pg/pg_service.conf"
### PNPM
export PNPM_HOME="$XDG_DATA_HOME/pnpm"
export PNPM_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/pnpm"
export PATH="$PATH:$PNPM_HOME"
### Prettierd
@ -360,29 +360,29 @@ if command -v python3 > /dev/null; then
fi
### Readline
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/readline/inputrc"
### Redis
export REDISCLI_HISTFILE="$XDG_DATA_HOME/redis/rediscli_history"
export REDISCLI_RCFILE="$XDG_CONFIG_HOME/redis/redisclirc"
export REDISCLI_HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/redis/rediscli_history"
export REDISCLI_RCFILE="${XDG_CONFIG_HOME:-$HOME/.config}/redis/redisclirc"
### ripgrep
export RIPGREP_CONFIG_PATH="$XDG_CONFIG_HOME/ripgrep/config"
export RIPGREP_CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/ripgrep/config"
### Ruby
# Add Homebrew Ruby install location to PATH (for macOS and tools that require a more recent version than the bundled system version)
export PATH="/usr/local/opt/ruby/bin:$PATH"
export GEM_HOME="$XDG_DATA_HOME/gems"
export GEM_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/gems"
export PATH="$PATH:$GEM_HOME/bin"
### Rustup
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export RUSTUP_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/rustup"
### SDKMan
export SDKMAN_DIR="$XDG_DATA_HOME/sdkman"
export SDKMAN_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/sdkman"
### Steampipe
export STEAMPIPE_INSTALL_DIR="$XDG_DATA_HOME/steampipe"
export STEAMPIPE_INSTALL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/steampipe"
export STEAMPIPE_TELEMETRY=none
### Update
@ -391,16 +391,16 @@ if [ -d "$HOME/.local/bin/update/bin" ]; then
fi
### Vagrant
export VAGRANT_ALIAS_FILE="$XDG_CONFIG_HOME/vagrant/aliases"
export VAGRANT_ALIAS_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/vagrant/aliases"
export VAGRANT_DEFAULT_PROVIDER=virtualbox
export VAGRANT_HOME="$XDG_DATA_HOME/vagrant.d"
export VAGRANT_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/vagrant.d"
### Volta
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### Wakatime
export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime"
export WAKATIME_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/wakatime"
export WAKATIME_API_KEY="{{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "WAKATIME_API_KEY")) }}{{ includeTemplate "secrets/VAGRANT_CLOUD_TOKEN" | decrypt | trim }}{{ else }}{{ env "WAKATIME_API_KEY" }}{{ end }}"
### Wazuh
@ -412,21 +412,21 @@ elif [ -d /var/ossec/bin ]; then
fi
### Wego Weather CLI
export WEGORC="$XDG_CONFIG_HOME/wego/wegorc"
export WEGORC="${XDG_CONFIG_HOME:-$HOME/.config}/wego/wegorc"
### wget
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc"
### Whalebrew
export WHALEBREW_CONFIG_DIR="$XDG_CONFIG_HOME/whalebrew"
export WHALEBREW_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/whalebrew"
### .zsh_sessions
# Source: https://apple.stackexchange.com/questions/427561/macos-zsh-sessions-zsh-history-and-setopt-append-history
export SHELL_SESSIONS_DISABLE=1
### CloudFlare Wrangler
export WRANGLER_INSTALL_PATH="$XDG_DATA_HOME/wrangler"
export WRANGLER_HOME="$XDG_DATA_HOME/wrangler"
export WRANGLER_INSTALL_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/wrangler"
export WRANGLER_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/wrangler"
### Man pages
export LESS_TERMCAP_mb=$'\e[1;32m'

View file

@ -0,0 +1,5 @@
{{- if stat (joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.bash") -}}
{{- joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.bash" -}}
{{- elif stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.bash") -}}
{{- joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.bash" -}}
{{- end -}}

View file

@ -0,0 +1,5 @@
{{- if stat (joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.fish") -}}
{{- joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.fish" -}}
{{- elif stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.fish") -}}
{{- joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.fish" -}}
{{- end -}}

View file

@ -0,0 +1,5 @@
{{- if stat (joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.tcsh") -}}
{{- joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.tcsh" -}}
{{- elif stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.tcsh") -}}
{{- joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.tcsh" -}}
{{- end -}}

View file

@ -0,0 +1,5 @@
{{- if stat (joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.zsh") -}}
{{- joinPath .chezmoi.homeDir "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.zsh" -}}
{{- elif stat (joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.zsh") -}}
{{- joinPath "Applications" "iTerm.app" "Contents" "Resources" "iterm2_shell_integration.zsh" -}}
{{- end -}}

View file

@ -19,7 +19,7 @@ export ATUIN_USERNAME="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplat
### Google Cloud SDK
export CLOUDSDK_CORE_PROJECT="{{ .user.gcloud.coreProject }}"
export GCE_SERVICE_ACCOUNT_EMAIL="{{ .user.gcloud.email }}"
export GCE_CREDENTIALS_FILE="$HOME/.config/gcloud/gcp.json"
export GCE_CREDENTIALS_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/gcloud/gcp.json"
### CloudFlare
# Source: https://github.com/cloudflare/cf-terraforming

View file

@ -8,16 +8,10 @@
# shellcheck disable=SC1090,SC1091
# Aliases / Functions / Exports
export XDG_CONFIG_HOME="$HOME/.config"
if [ -f "$XDG_CONFIG_HOME/shell/exports.sh" ]; then
. "$XDG_CONFIG_HOME/shell/exports.sh"
fi
if [ -f "$XDG_CONFIG_HOME/shell/aliases.sh" ]; then
. "$XDG_CONFIG_HOME/shell/aliases.sh"
fi
if [ -f "$XDG_CONFIG_HOME/shell/functions.sh" ]; then
. "$XDG_CONFIG_HOME/shell/functions.sh"
fi
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/exports.sh" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/exports.sh"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliases.sh" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliases.sh"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/functions.sh" ] || . "${XDG_CONFIG_HOME:-$HOME/.config}/shell/functions.sh"
### Bash / ZSH
if [ "$BASH_SUPPORT" = 'true' ]; then
@ -81,8 +75,8 @@ if [ "$BASH_SUPPORT" = 'true' ]; then
fi
### Directory Colors
if [ -f "$XDG_CONFIG_HOME/shell/lscolors.sh" ]; then
. "$XDG_CONFIG_HOME/shell/lscolors.sh"
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/lscolors.sh" ]; then
. "${XDG_CONFIG_HOME:-$HOME/.config}/shell/lscolors.sh"
fi
### fzf-git
@ -91,13 +85,13 @@ if [ "$BASH_SUPPORT" = 'true' ]; then
#fi
### git-fuzzy
if [ -d "$XDG_DATA_HOME/git-fuzzy/bin" ]; then
export PATH="$XDG_DATA_HOME/git-fuzzy/bin:$PATH"
if [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/git-fuzzy/bin" ]; then
export PATH="${XDG_DATA_HOME:-$HOME/.local/share}/git-fuzzy/bin:$PATH"
fi
### MOTD
if [ -f "$XDG_CONFIG_HOME/shell/motd.sh" ]; then
. "$XDG_CONFIG_HOME/shell/motd.sh"
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/motd.sh" ]; then
. "${XDG_CONFIG_HOME:-$HOME/.config}/shell/motd.sh"
fi
fi

View file

@ -40,6 +40,11 @@ tasks:
### Copy the password to the clipboard
printf '%s' "$(echo "$selected" | jq -r '.login.password')" | $COPY
build:packer:
desc: Builds Packer boxes using all supported virtualization platform / operating system combinations
summary: |
# {{ .AppName}} Packer Build
build:packer:
desc: Builds Packer boxes using all supported virtualization platform / operating system combinations
summary: |
@ -72,7 +77,7 @@ tasks:
Qubes can leverage the assets generated from the VirtualBox builds to power HVMs.
cmds:
- |
cd "$HOME/.local/share/bento"
cd "${XDG_DATA_HOME:-$HOME/.local/share}/bento"
packer init -upgrade ./packer_templates
logg info 'Building Ubuntu VirtualBox VMs'
packer build -var-file=os_pkrvars/ubuntu/ubuntu-22.04-x86_64.pkrvars.hcl ./packer_templates
@ -441,11 +446,11 @@ tasks:
if [ -d "$HOME/.local/mnt/s3" ]; then
if command -v rclone > /dev/null && command -v restic > /dev/null; then
logg info '{{ .AppName }} profile folder exists and user S3 mount exists. Backing the profile up to user S3 bucket via Restic.'
if ([ -z "$(restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "$HOME/.config/age/chezmoi.txt" cat config)" ]) 2>/dev/null; then
if ([ -z "$(restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" cat config)" ]) 2>/dev/null; then
logg info 'Initializing {{ .AppName }} Restic repository'
restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "$HOME/.config/age/chezmoi.txt" init
restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" init
fi
restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "$HOME/.config/age/chezmoi.txt" --verbose backup --tag "{{ .ProfileFolder }}" --tag {{ OS }} --tag "$HOST" "{{ .ProfileFolder }}"
restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" --verbose backup --tag "{{ .ProfileFolder }}" --tag {{ OS }} --tag "$HOST" "{{ .ProfileFolder }}"
else
logg error 'Both `rclone` and `restic` must be available' && exit 1
fi
@ -462,10 +467,10 @@ tasks:
if [ -d '{{ .AppFolder }}' ]; then
if [ -d "$HOME/.local/mnt/s3" ]; then
if command -v rclone > /dev/null && command -v restic > /dev/null; then
if ([ -z "$(restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "$HOME/.config/age/chezmoi.txt" cat config)" ]) 2>/dev/null; then
if ([ -z "$(restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" cat config)" ]) 2>/dev/null; then
logg warn 'The {{ .AppName }} Rclone repository has not been initialized. Skipping.'
else
restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "$HOME/.config/age/chezmoi.txt" restore latest --target '{{ .ProfileFolder }}'
restic -r "rclone:$USER-s3:user/{{ .RcloneRepository }}" --password-file "${XDG_CONFIG_HOME:-$HOME/.config}/age/chezmoi.txt" restore latest --target '{{ .ProfileFolder }}'
fi
else
logg error 'Both `rclone` and `restic` must be available' && exit 1

View file

@ -339,7 +339,7 @@ autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Install Coc extensions
" TODO: Add https://github.com/yuki-yano/fzf-preview.vim
" TODO: Add https://github.com/tpope/vim-fugitive
let g:coc_global_config="$HOME/.config/coc/coc-settings.json"
let g:coc_global_config="${XDG_CONFIG_HOME:-$HOME/.config}/coc/coc-settings.json"
let g:coc_global_extensions = [
\'@yaegassy/coc-ansible',
\'@yaegassy/coc-nginx',

View file

@ -5,17 +5,17 @@
{{ includeTemplate "universal/logg" }}
### Create backups
if [ -d "$XDG_CONFIG_HOME/dconf/settings" ]; then
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" ]; then
DCONF_TMP="$(mktemp)"
logg info 'Moving ~/.config/dconf/settings to '"$DCONF_TMP"
cp -rf "$XDG_CONFIG_HOME/dconf/settings" "$DCONF_TMP"
cp -rf "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" "$DCONF_TMP"
fi
### Ensure ~/.config/dconf/settings exists
mkdir -p "$XDG_CONFIG_HOME/dconf/settings"
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings"
### Overwrite ~/.config/dconf/settings configurations so we can diff with Chezmoi
find "$XDG_CONFIG_HOME/dconf/settings" -mindepth 1 -maxdepth 1 -type f | while read DCONF_CONFIG_FILE; do
find "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" -mindepth 1 -maxdepth 1 -type f | while read DCONF_CONFIG_FILE; do
DCONF_SETTINGS_ID="/$(basename "$DCONF_CONFIG_FILE" | sed 's/\./\//g')/"
logg info 'Dumping `'"$DCONF_SETTINGS_ID"'` to '"$DCONF_CONFIG_FILE"
dconf dump "$DCONF_SETTINGS_ID" > "$DCONF_CONFIG_FILE"

View file

@ -859,8 +859,8 @@ async function ensurePackageManagerAnsible() {
await $`pipx inject ansible-core PyObjC PyObjC-core`
}
await $`pipx inject ansible-core docker lxml netaddr pexpect python-vagrant pywinrm requests-credssp watchdog`
await $`mkdir -p "$HOME/.cache/megabyte-labs"`
await $`touch "$HOME/.cache/megabyte-labs/ansible-installed"`
await $`mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs"`
await $`touch "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs/ansible-installed"`
log('info', 'Package Manager Install', `Ansible and its supporting packages are now installed via pipx`)
}
@ -896,7 +896,7 @@ async function ensurePackageManager(packageManager) {
}
} else if (packageManager === 'ansible') {
try {
await $`test -f "$HOME/.cache/megabyte-labs/ansible-installed"`
await $`test -f "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs/ansible-installed"`
const ansible = which.sync('ansible', { nothrow: true })
if (ansible) {
log('info', logStage, `\`ansible\` and its supporting packages appear to be installed`)

View file

@ -832,7 +832,7 @@ appy_tilixschemes() {
# so we have to update color palette for the current profile in order to switch to the new theme
# but only set the palette on the last loop to avoid a flashing terminal
if ((LOOP == OPTLENGTH)); then
cp -f ${scratchdir}/* "$HOME/.config/tilix/schemes/"
cp -f ${scratchdir}/* "${XDG_CONFIG_HOME:-$HOME/.config}/tilix/schemes/"
rm -rf "${scratchdir}"
read -r -p "All done - apply new theme? [y/N] " -n 1 TILIX_RES
if [[ ${TILIX_RES::1} =~ ^(y|Y)$ ]]; then

View file

@ -379,8 +379,8 @@ else
sudo sed -i '/# TEMPORARY FOR INSTALL DOCTOR/d' /etc/sudoers || logg warn 'Failed to remove passwordless sudo from the /etc/sudoers file'
fi
# @description Render the `docs/POST-INSTALL.md` file to the terminal at the end of the provisioning process
# @description Render the `docs/terminal/post-install.md` file to the terminal at the end of the provisioning process
logg success 'Provisioning complete!'
if command -v glow > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/POST-INSTALL.md" ]; then
glow "$HOME/.local/share/chezmoi/docs/POST-INSTALL.md"
if command -v glow > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md" ]; then
glow "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md"
fi

View file

@ -18,8 +18,8 @@
{{ includeTemplate "universal/logg" }}
### Create symlinks pointing to stored configurations
ln -s "$HOME/.config/mackup/.mackup/" ~/.mackup
ln -s "$HOME/.config/mackup/.mackup.cfg" ~/.mackup.cfg
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup/" ~/.mackup
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup.cfg" ~/.mackup.cfg
### Run original mackup executable
if command -v brew > /dev/null && brew list | grep mackup > /dev/null; then

View file

@ -0,0 +1,39 @@
#!/usr/bin/env bash
### Source .bashrc if it is present
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
elif [ -f "$HOME/.config/shell/exports.sh" ]; then
. "$HOME/.config/shell/exports.sh"
fi
### XDG
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
### Ensure Homebrew PATHs
if [ -d "/home/linuxbrew/.linuxbrew/bin" ]; then
export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar"
export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew"
export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin${PATH+:$PATH}"
export MANPATH="/home/linuxbrew/.linuxbrew/share/man${MANPATH+:$MANPATH}:"
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}"
export WHALEBREW_INSTALL_PATH="/home/linuxbrew/.linuxbrew/whalebrew"
elif [ -f "/usr/local/bin/brew" ]; then
eval "$(/usr/local/bin/brew shellenv)"
elif [ -f "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
export HOMEBREW_NO_ANALYTICS=1
### SDKMan
export SDKMAN_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/sdkman"
### Volta
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### Ensure ~/.local/bin in PATH
export PATH="$HOME/.local/bin:$PATH"

View file

@ -1,15 +0,0 @@
[Appearance]
ColorScheme=Betelgeuse
[General]
Environment=TERM=xterm-256color,COLORTERM=truecolor
Name=Default
Parent=FALLBACK/
TerminalColumns=124
TerminalRows=35
[Scrolling]
HistoryMode=2
[Terminal Features]
UrlHintsModifiers=67108864

View file

@ -1,650 +0,0 @@
#!/usr/bin/env bash
# The iTerm2 customizations fall under the following license:
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# -- BEGIN ITERM2 CUSTOMIZATIONS --
if [[ "$ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX""$TERM" != screen && "$ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX""$TERM" != tmux-256color && "$ITERM_SHELL_INTEGRATION_INSTALLED" = "" && "$-" == *i* && "$TERM" != linux && "$TERM" != dumb ]]; then
if shopt extdebug | grep on > /dev/null; then
echo "iTerm2 Shell Integration not installed."
echo ""
echo "Your shell has 'extdebug' turned on."
echo "This is incompatible with shell integration."
echo "Find 'shopt -s extdebug' in bash's rc scripts and remove it."
return 0
fi
ITERM_SHELL_INTEGRATION_INSTALLED=Yes
# Saved copy of your PS1. This is used to detect if the user changes PS1
# directly. ITERM_PREV_PS1 will hold the last value that this script set PS1 to
# (including various custom escape sequences).
ITERM_PREV_PS1="$PS1"
# A note on execution. When you invoke a command at an interactive prompt the following steps are taken:
#
# 1. The DEBUG trap runs.
# It calls __bp_preexec_invoke_exec
# It runs any registered preexec_functions, including __iterm2_preexec
# 2. The command you executed runs.
# 3. PROMPT_COMMAND runs.
# It runs __bp_precmd_invoke_cmd, which is inserted as the first command in PROMPT_COMMAND.
# It calls any registered precmd_functions
# Then, pre-existing PROMPT_COMMANDs run
# 4. The prompt is shown.
#
# __iterm2_prompt_command used to be run from precmd_functions but then a pre-existing
# PROMPT_COMMAND could clobber the PS1 it modifies. Instead, add __iterm2_prompt_command as the last
# of the "preexisting" PROMPT_COMMANDs so it will be the very last thing done before the prompt is
# shown (unless someone amends PROMPT_COMMAND, but that is on them).
if [[ -n "$PROMPT_COMMAND" ]]; then
PROMPT_COMMAND+=$'\n'
fi;
PROMPT_COMMAND+='__iterm2_prompt_command'
# The following chunk of code, bash-preexec.sh, is licensed like this:
# The MIT License
#
# Copyright (c) 2015 Ryan Caloras and contributors (see https://github.com/rcaloras/bash-preexec)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Wrap bash-preexec.sh in a function so that, if it exits early due to having
# been sourced elsewhere, it doesn't exit our entire script.
_install_bash_preexec () {
# -- END ITERM2 CUSTOMIZATIONS --
# -- BEGIN BASH-PREEXEC.SH --
# bash-preexec.sh -- Bash support for ZSH-like 'preexec' and 'precmd' functions.
# https://github.com/rcaloras/bash-preexec
#
#
# 'preexec' functions are executed before each interactive command is
# executed, with the interactive command as its argument. The 'precmd'
# function is executed before each prompt is displayed.
#
# Author: Ryan Caloras (ryan@bashhub.com)
# Forked from Original Author: Glyph Lefkowitz
#
# V0.4.1
#
# General Usage:
#
# 1. Source this file at the end of your bash profile so as not to interfere
# with anything else that's using PROMPT_COMMAND.
#
# 2. Add any precmd or preexec functions by appending them to their arrays:
# e.g.
# precmd_functions+=(my_precmd_function)
# precmd_functions+=(some_other_precmd_function)
#
# preexec_functions+=(my_preexec_function)
#
# 3. Consider changing anything using the DEBUG trap or PROMPT_COMMAND
# to use preexec and precmd instead. Preexisting usages will be
# preserved, but doing so manually may be less surprising.
#
# Note: This module requires two Bash features which you must not otherwise be
# using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. If you override
# either of these after bash-preexec has been installed it will most likely break.
# Make sure this is bash that's running and return otherwise.
if [[ -z "${BASH_VERSION:-}" ]]; then
return 1;
fi
# Avoid duplicate inclusion
if [[ -n "${bash_preexec_imported:-}" ]]; then
return 0
fi
bash_preexec_imported="defined"
# WARNING: This variable is no longer used and should not be relied upon.
# Use ${bash_preexec_imported} instead.
__bp_imported="${bash_preexec_imported}"
# Should be available to each precmd and preexec
# functions, should they want it. $? and $_ are available as $? and $_, but
# $PIPESTATUS is available only in a copy, $BP_PIPESTATUS.
# TODO: Figure out how to restore PIPESTATUS before each precmd or preexec
# function.
__bp_last_ret_value="$?"
BP_PIPESTATUS=("${PIPESTATUS[@]}")
__bp_last_argument_prev_command="$_"
__bp_inside_precmd=0
__bp_inside_preexec=0
# Initial PROMPT_COMMAND string that is removed from PROMPT_COMMAND post __bp_install
__bp_install_string=$'__bp_trap_string="$(trap -p DEBUG)"\ntrap - DEBUG\n__bp_install'
# Fails if any of the given variables are readonly
# Reference https://stackoverflow.com/a/4441178
__bp_require_not_readonly() {
local var
for var; do
if ! ( unset "$var" 2> /dev/null ); then
echo "bash-preexec requires write access to ${var}" >&2
return 1
fi
done
}
# Remove ignorespace and or replace ignoreboth from HISTCONTROL
# so we can accurately invoke preexec with a command from our
# history even if it starts with a space.
__bp_adjust_histcontrol() {
local histcontrol
histcontrol="${HISTCONTROL:-}"
histcontrol="${histcontrol//ignorespace}"
# Replace ignoreboth with ignoredups
if [[ "$histcontrol" == *"ignoreboth"* ]]; then
histcontrol="ignoredups:${histcontrol//ignoreboth}"
fi;
export HISTCONTROL="$histcontrol"
}
# This variable describes whether we are currently in "interactive mode";
# i.e. whether this shell has just executed a prompt and is waiting for user
# input. It documents whether the current command invoked by the trace hook is
# run interactively by the user; it's set immediately after the prompt hook,
# and unset as soon as the trace hook is run.
__bp_preexec_interactive_mode=""
# These arrays are used to add functions to be run before, or after, prompts.
declare -a precmd_functions
declare -a preexec_functions
# Trims leading and trailing whitespace from $2 and writes it to the variable
# name passed as $1
__bp_trim_whitespace() {
local var=${1:?} text=${2:-}
text="${text#"${text%%[![:space:]]*}"}" # remove leading whitespace characters
text="${text%"${text##*[![:space:]]}"}" # remove trailing whitespace characters
printf -v "$var" '%s' "$text"
}
# Trims whitespace and removes any leading or trailing semicolons from $2 and
# writes the resulting string to the variable name passed as $1. Used for
# manipulating substrings in PROMPT_COMMAND
__bp_sanitize_string() {
local var=${1:?} text=${2:-} sanitized
__bp_trim_whitespace sanitized "$text"
sanitized=${sanitized%;}
sanitized=${sanitized#;}
__bp_trim_whitespace sanitized "$sanitized"
printf -v "$var" '%s' "$sanitized"
}
# This function is installed as part of the PROMPT_COMMAND;
# It sets a variable to indicate that the prompt was just displayed,
# to allow the DEBUG trap to know that the next command is likely interactive.
__bp_interactive_mode() {
__bp_preexec_interactive_mode="on";
}
# This function is installed as part of the PROMPT_COMMAND.
# It will invoke any functions defined in the precmd_functions array.
__bp_precmd_invoke_cmd() {
# Save the returned value from our last command, and from each process in
# its pipeline. Note: this MUST be the first thing done in this function.
__bp_last_ret_value="$?" BP_PIPESTATUS=("${PIPESTATUS[@]}")
# Don't invoke precmds if we are inside an execution of an "original
# prompt command" by another precmd execution loop. This avoids infinite
# recursion.
if (( __bp_inside_precmd > 0 )); then
return
fi
local __bp_inside_precmd=1
# Invoke every function defined in our function array.
local precmd_function
for precmd_function in "${precmd_functions[@]}"; do
# Only execute this function if it actually exists.
# Test existence of functions with: declare -[Ff]
if type -t "$precmd_function" 1>/dev/null; then
__bp_set_ret_value "$__bp_last_ret_value" "$__bp_last_argument_prev_command"
# Quote our function invocation to prevent issues with IFS
"$precmd_function"
fi
done
}
# Sets a return value in $?. We may want to get access to the $? variable in our
# precmd functions. This is available for instance in zsh. We can simulate it in bash
# by setting the value here.
__bp_set_ret_value() {
return ${1:-}
}
__bp_in_prompt_command() {
local prompt_command_array
IFS=$'\n;' read -rd '' -a prompt_command_array <<< "${PROMPT_COMMAND:-}"
local trimmed_arg
__bp_trim_whitespace trimmed_arg "${1:-}"
local command trimmed_command
for command in "${prompt_command_array[@]:-}"; do
__bp_trim_whitespace trimmed_command "$command"
if [[ "$trimmed_command" == "$trimmed_arg" ]]; then
return 0
fi
done
return 1
}
# This function is installed as the DEBUG trap. It is invoked before each
# interactive prompt display. Its purpose is to inspect the current
# environment to attempt to detect if the current command is being invoked
# interactively, and invoke 'preexec' if so.
__bp_preexec_invoke_exec() {
# Save the contents of $_ so that it can be restored later on.
# https://stackoverflow.com/questions/40944532/bash-preserve-in-a-debug-trap#40944702
__bp_last_argument_prev_command="${1:-}"
# Don't invoke preexecs if we are inside of another preexec.
if (( __bp_inside_preexec > 0 )); then
return
fi
local __bp_inside_preexec=1
# Checks if the file descriptor is not standard out (i.e. '1')
# __bp_delay_install checks if we're in test. Needed for bats to run.
# Prevents preexec from being invoked for functions in PS1
if [[ ! -t 1 && -z "${__bp_delay_install:-}" ]]; then
return
fi
if [[ -n "${COMP_LINE:-}" ]]; then
# We're in the middle of a completer. This obviously can't be
# an interactively issued command.
return
fi
if [[ -z "${__bp_preexec_interactive_mode:-}" ]]; then
# We're doing something related to displaying the prompt. Let the
# prompt set the title instead of me.
return
else
# If we're in a subshell, then the prompt won't be re-displayed to put
# us back into interactive mode, so let's not set the variable back.
# In other words, if you have a subshell like
# (sleep 1; sleep 2)
# You want to see the 'sleep 2' as a set_command_title as well.
if [[ 0 -eq "${BASH_SUBSHELL:-}" ]]; then
__bp_preexec_interactive_mode=""
fi
fi
if __bp_in_prompt_command "${BASH_COMMAND:-}"; then
# If we're executing something inside our prompt_command then we don't
# want to call preexec. Bash prior to 3.1 can't detect this at all :/
__bp_preexec_interactive_mode=""
return
fi
local this_command
this_command=$(
export LC_ALL=C
HISTTIMEFORMAT= builtin history 1 | sed '1 s/^ *[0-9][0-9]*[* ] //'
)
# Sanity check to make sure we have something to invoke our function with.
if [[ -z "$this_command" ]]; then
return
fi
# Invoke every function defined in our function array.
local preexec_function
local preexec_function_ret_value
local preexec_ret_value=0
for preexec_function in "${preexec_functions[@]:-}"; do
# Only execute each function if it actually exists.
# Test existence of function with: declare -[fF]
if type -t "$preexec_function" 1>/dev/null; then
__bp_set_ret_value ${__bp_last_ret_value:-}
# Quote our function invocation to prevent issues with IFS
"$preexec_function" "$this_command"
preexec_function_ret_value="$?"
if [[ "$preexec_function_ret_value" != 0 ]]; then
preexec_ret_value="$preexec_function_ret_value"
fi
fi
done
# Restore the last argument of the last executed command, and set the return
# value of the DEBUG trap to be the return code of the last preexec function
# to return an error.
# If `extdebug` is enabled a non-zero return value from any preexec function
# will cause the user's command not to execute.
# Run `shopt -s extdebug` to enable
__bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command"
}
__bp_install() {
# Exit if we already have this installed.
if [[ "${PROMPT_COMMAND:-}" == *"__bp_precmd_invoke_cmd"* ]]; then
return 1;
fi
trap '__bp_preexec_invoke_exec "$_"' DEBUG
# Preserve any prior DEBUG trap as a preexec function
local prior_trap=$(sed "s/[^']*'\(.*\)'[^']*/\1/" <<<"${__bp_trap_string:-}")
unset __bp_trap_string
if [[ -n "$prior_trap" ]]; then
eval '__bp_original_debug_trap() {
'"$prior_trap"'
}'
preexec_functions+=(__bp_original_debug_trap)
fi
# Adjust our HISTCONTROL Variable if needed.
__bp_adjust_histcontrol
# Issue #25. Setting debug trap for subshells causes sessions to exit for
# backgrounded subshell commands (e.g. (pwd)& ). Believe this is a bug in Bash.
#
# Disabling this by default. It can be enabled by setting this variable.
if [[ -n "${__bp_enable_subshells:-}" ]]; then
# Set so debug trap will work be invoked in subshells.
set -o functrace > /dev/null 2>&1
shopt -s extdebug > /dev/null 2>&1
fi;
local existing_prompt_command
# Remove setting our trap install string and sanitize the existing prompt command string
existing_prompt_command="${PROMPT_COMMAND:-}"
existing_prompt_command="${existing_prompt_command//$__bp_install_string[;$'\n']}" # Edge case of appending to PROMPT_COMMAND
existing_prompt_command="${existing_prompt_command//$__bp_install_string}"
__bp_sanitize_string existing_prompt_command "$existing_prompt_command"
# Install our hooks in PROMPT_COMMAND to allow our trap to know when we've
# actually entered something.
PROMPT_COMMAND=$'__bp_precmd_invoke_cmd\n'
if [[ -n "$existing_prompt_command" ]]; then
PROMPT_COMMAND+=${existing_prompt_command}$'\n'
fi;
PROMPT_COMMAND+='__bp_interactive_mode'
# Add two functions to our arrays for convenience
# of definition.
precmd_functions+=(precmd)
preexec_functions+=(preexec)
# Invoke our two functions manually that were added to $PROMPT_COMMAND
__bp_precmd_invoke_cmd
__bp_interactive_mode
}
# Sets an installation string as part of our PROMPT_COMMAND to install
# after our session has started. This allows bash-preexec to be included
# at any point in our bash profile.
__bp_install_after_session_init() {
# bash-preexec needs to modify these variables in order to work correctly
# if it can't, just stop the installation
__bp_require_not_readonly PROMPT_COMMAND HISTCONTROL HISTTIMEFORMAT || return
local sanitized_prompt_command
__bp_sanitize_string sanitized_prompt_command "${PROMPT_COMMAND:-}"
if [[ -n "$sanitized_prompt_command" ]]; then
PROMPT_COMMAND=${sanitized_prompt_command}$'\n'
fi;
PROMPT_COMMAND+=${__bp_install_string}
}
# Run our install so long as we're not delaying it.
if [[ -z "${__bp_delay_install:-}" ]]; then
__bp_install_after_session_init
fi;
# -- END BASH-PREEXEC.SH --
}
_install_bash_preexec
unset -f _install_bash_preexec
# -- BEGIN ITERM2 CUSTOMIZATIONS --
# We don't care about whitespace, but users care about not changing their histcontrol variables.
# We overwrite the upstream __bp_adjust_histcontrol function whcih gets called from the next
# PROMPT_COMMAND invocation.
function __bp_adjust_histcontrol() {
true
}
function iterm2_begin_osc {
printf "\033]"
}
function iterm2_end_osc {
printf "\007"
}
function iterm2_print_state_data() {
local _iterm2_hostname="${iterm2_hostname}"
if [ -z "${iterm2_hostname:-}" ]; then
_iterm2_hostname=$(hostname -f 2>/dev/null)
fi
iterm2_begin_osc
printf "1337;RemoteHost=%s@%s" "$USER" "$_iterm2_hostname"
iterm2_end_osc
iterm2_begin_osc
printf "1337;CurrentDir=%s" "$PWD"
iterm2_end_osc
iterm2_print_user_vars
}
# Usage: iterm2_set_user_var key value
function iterm2_set_user_var() {
iterm2_begin_osc
printf "1337;SetUserVar=%s=%s" "$1" $(printf "%s" "$2" | base64 | tr -d '\n')
iterm2_end_osc
}
if [ -z "$(type -t iterm2_print_user_vars)" ] || [ "$(type -t iterm2_print_user_vars)" != function ]; then
# iterm2_print_user_vars is not already defined. Provide a no-op default version.
#
# Users can write their own version of this function. It should call
# iterm2_set_user_var but not produce any other output.
function iterm2_print_user_vars() {
true
}
fi
function iterm2_prompt_prefix() {
iterm2_begin_osc
printf "133;D;\$?"
iterm2_end_osc
}
function iterm2_prompt_mark() {
iterm2_begin_osc
printf "133;A"
iterm2_end_osc
}
function iterm2_prompt_suffix() {
iterm2_begin_osc
printf "133;B"
iterm2_end_osc
}
function iterm2_print_version_number() {
iterm2_begin_osc
printf "1337;ShellIntegrationVersion=18;shell=bash"
iterm2_end_osc
}
# If hostname -f is slow on your system, set iterm2_hostname before sourcing this script.
# On macOS we run `hostname -f` every time because it is fast.
if [ -z "${iterm2_hostname:-}" ]; then
if [ "$(uname)" != "Darwin" ]; then
iterm2_hostname=$(hostname -f 2>/dev/null)
# some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option
if [ $? -ne 0 ]; then
iterm2_hostname=$(hostname)
fi
fi
fi
iterm2_maybe_print_cr() {
if [ "$TERM_PROGRAM" = "iTerm.app" ]; then
printf "\r"
fi
}
# Runs after interactively edited command but before execution
__iterm2_preexec() {
# Save the returned value from our last command
__iterm2_last_ret_value="$?"
iterm2_begin_osc
printf "133;C;"
iterm2_maybe_print_cr
iterm2_end_osc
# If PS1 still has the value we set it to in iterm2_preexec_invoke_cmd then
# restore it to its original value. It might have changed if you have
# another PROMPT_COMMAND (like liquidprompt) that modifies PS1.
if [ -n "${ITERM_ORIG_PS1+xxx}" -a "$PS1" = "$ITERM_PREV_PS1" ]
then
export PS1="$ITERM_ORIG_PS1"
fi
iterm2_ran_preexec="yes"
# preexec functions can return nonzero to prevent user's command from running.
return 0
}
# Prints the current directory and hostname control sequences. Modifies PS1 to
# add the FinalTerm A and B codes to locate the prompt.
function __iterm2_prompt_command () {
__iterm2_last_ret_value="$?"
if [[ -z "${iterm2_ran_preexec:-}" ]]
then
# This code path is taken when you press ^C while entering a command.
# I observed this behavior in CentOS 7.2 and macOS "GNU bash, version 5.0.18(1)-release".
__iterm2_preexec ""
__bp_set_ret_value "$__iterm2_last_ret_value" "$__bp_last_argument_prev_command"
fi
iterm2_ran_preexec=""
# This is an iTerm2 addition to try to work around a problem in the
# original preexec.bash.
# When the PS1 has command substitutions, this gets invoked for each
# substitution and each command that's run within the substitution, which
# really adds up. It would be great if we could do something like this at
# the end of this script:
# PS1="$(iterm2_prompt_prefix)$PS1($iterm2_prompt_suffix)"
# and have iterm2_prompt_prefix set a global variable that tells precmd not to
# output anything and have iterm2_prompt_suffix reset that variable.
# Unfortunately, command substitutions run in subshells and can't
# communicate to the outside world.
# Instead, we have this workaround. We save the original value of PS1 in
# $ITERM_ORIG_PS1. Then each time this function is run (it's called from
# PROMPT_COMMAND just before the prompt is shown) it will change PS1 to a
# string without any command substitutions by doing eval on ITERM_ORIG_PS1. At
# this point ITERM_PREEXEC_INTERACTIVE_MODE is still the empty string, so preexec
# won't produce output for command substitutions.
# The first time this is called ITERM_ORIG_PS1 is unset. This tests if the variable
# is undefined (not just empty) and initializes it. We can't initialize this at the
# top of the script because it breaks with liquidprompt. liquidprompt wants to
# set PS1 from a PROMPT_COMMAND that runs just before us. Setting ITERM_ORIG_PS1
# at the top of the script will overwrite liquidprompt's PS1, whose value would
# never make it into ITERM_ORIG_PS1. Issue 4532. It's important to check
# if it's undefined before checking if it's empty because some users have
# bash set to error out on referencing an undefined variable.
if [ -z "${ITERM_ORIG_PS1+xxx}" ]
then
# ITERM_ORIG_PS1 always holds the last user-set value of PS1.
# You only get here on the first time iterm2_preexec_invoke_cmd is called.
export ITERM_ORIG_PS1="$PS1"
fi
# If you want to generate PS1 dynamically from PROMPT_COMMAND, the best way
# to do it is to define a function named iterm2_generate_ps1 that sets PS1.
# Issue 5964. Other shells don't have this issue because they don't need
# such extremes to get precmd and preexec.
if [ -n "$(type -t iterm2_generate_ps1)" ] && [ "$(type -t iterm2_generate_ps1)" = function ]; then
iterm2_generate_ps1
fi
if [[ "$PS1" != "$ITERM_PREV_PS1" ]]
then
export ITERM_ORIG_PS1="$PS1"
fi
# Get the value of the prompt prefix, which will change $?
\local iterm2_prompt_prefix_value="$(iterm2_prompt_prefix)"
# Add the mark unless the prompt includes '$(iterm2_prompt_mark)' as a substring.
if [[ $ITERM_ORIG_PS1 != *'$(iterm2_prompt_mark)'* && x$ITERM2_SQUELCH_MARK = x ]]
then
iterm2_prompt_prefix_value="$iterm2_prompt_prefix_value$(iterm2_prompt_mark)"
fi
# Send escape sequences with current directory and hostname.
iterm2_print_state_data
# Reset $? to its saved value, which might be used in $ITERM_ORIG_PS1.
__bp_set_ret_value "$__iterm2_last_ret_value" "$__bp_last_argument_prev_command"
# Set PS1 to various escape sequences, the user's preferred prompt, and more escape sequences.
export PS1="\[$iterm2_prompt_prefix_value\]$ITERM_ORIG_PS1\[$(iterm2_prompt_suffix)\]"
# Save the value we just set PS1 to so if the user changes PS1 we'll know and we can update ITERM_ORIG_PS1.
export ITERM_PREV_PS1="$PS1"
__bp_set_ret_value "$__iterm2_last_ret_value" "$__bp_last_argument_prev_command"
}
# Install my function
preexec_functions+=(__iterm2_preexec)
iterm2_print_state_data
iterm2_print_version_number
fi
# -- END ITERM2 CUSTOMIZATIONS --

View file

@ -1,180 +0,0 @@
#!/usr/bin/env zsh
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
if [[ -o interactive ]]; then
if [ "${ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX-}""$TERM" != "tmux-256color" -a "${ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX-}""$TERM" != "screen" -a "${ITERM_SHELL_INTEGRATION_INSTALLED-}" = "" -a "$TERM" != linux -a "$TERM" != dumb ]; then
ITERM_SHELL_INTEGRATION_INSTALLED=Yes
ITERM2_SHOULD_DECORATE_PROMPT="1"
# Indicates start of command output. Runs just before command executes.
iterm2_before_cmd_executes() {
if [ "$TERM_PROGRAM" = "iTerm.app" ]; then
printf "\033]133;C;\r\007"
else
printf "\033]133;C;\007"
fi
}
iterm2_set_user_var() {
printf "\033]1337;SetUserVar=%s=%s\007" "$1" $(printf "%s" "$2" | base64 | tr -d '\n')
}
# Users can write their own version of this method. It should call
# iterm2_set_user_var but not produce any other output.
# e.g., iterm2_set_user_var currentDirectory $PWD
# Accessible in iTerm2 (in a badge now, elsewhere in the future) as
# \(user.currentDirectory).
whence -v iterm2_print_user_vars > /dev/null 2>&1
if [ $? -ne 0 ]; then
iterm2_print_user_vars() {
true
}
fi
iterm2_print_state_data() {
local _iterm2_hostname="${iterm2_hostname-}"
if [ -z "${iterm2_hostname:-}" ]; then
_iterm2_hostname=$(hostname -f 2>/dev/null)
fi
printf "\033]1337;RemoteHost=%s@%s\007" "$USER" "${_iterm2_hostname-}"
printf "\033]1337;CurrentDir=%s\007" "$PWD"
iterm2_print_user_vars
}
# Report return code of command; runs after command finishes but before prompt
iterm2_after_cmd_executes() {
printf "\033]133;D;%s\007" "$STATUS"
iterm2_print_state_data
}
# Mark start of prompt
iterm2_prompt_mark() {
printf "\033]133;A\007"
}
# Mark end of prompt
iterm2_prompt_end() {
printf "\033]133;B\007"
}
# There are three possible paths in life.
#
# 1) A command is entered at the prompt and you press return.
# The following steps happen:
# * iterm2_preexec is invoked
# * PS1 is set to ITERM2_PRECMD_PS1
# * ITERM2_SHOULD_DECORATE_PROMPT is set to 1
# * The command executes (possibly reading or modifying PS1)
# * iterm2_precmd is invoked
# * ITERM2_PRECMD_PS1 is set to PS1 (as modified by command execution)
# * PS1 gets our escape sequences added to it
# * zsh displays your prompt
# * You start entering a command
#
# 2) You press ^C while entering a command at the prompt.
# The following steps happen:
# * (iterm2_preexec is NOT invoked)
# * iterm2_precmd is invoked
# * iterm2_before_cmd_executes is called since we detected that iterm2_preexec was not run
# * (ITERM2_PRECMD_PS1 and PS1 are not messed with, since PS1 already has our escape
# sequences and ITERM2_PRECMD_PS1 already has PS1's original value)
# * zsh displays your prompt
# * You start entering a command
#
# 3) A new shell is born.
# * PS1 has some initial value, either zsh's default or a value set before this script is sourced.
# * iterm2_precmd is invoked
# * ITERM2_SHOULD_DECORATE_PROMPT is initialized to 1
# * ITERM2_PRECMD_PS1 is set to the initial value of PS1
# * PS1 gets our escape sequences added to it
# * Your prompt is shown and you may begin entering a command.
#
# Invariants:
# * ITERM2_SHOULD_DECORATE_PROMPT is 1 during and just after command execution, and "" while the prompt is
# shown and until you enter a command and press return.
# * PS1 does not have our escape sequences during command execution
# * After the command executes but before a new one begins, PS1 has escape sequences and
# ITERM2_PRECMD_PS1 has PS1's original value.
iterm2_decorate_prompt() {
# This should be a raw PS1 without iTerm2's stuff. It could be changed during command
# execution.
ITERM2_PRECMD_PS1="$PS1"
ITERM2_SHOULD_DECORATE_PROMPT=""
# Add our escape sequences just before the prompt is shown.
# Use ITERM2_SQUELCH_MARK for people who can't mdoify PS1 directly, like powerlevel9k users.
# This is gross but I had a heck of a time writing a correct if statetment for zsh 5.0.2.
local PREFIX=""
if [[ $PS1 == *"$(iterm2_prompt_mark)"* ]]; then
PREFIX=""
elif [[ "${ITERM2_SQUELCH_MARK-}" != "" ]]; then
PREFIX=""
else
PREFIX="%{$(iterm2_prompt_mark)%}"
fi
PS1="$PREFIX$PS1%{$(iterm2_prompt_end)%}"
ITERM2_DECORATED_PS1="$PS1"
}
iterm2_precmd() {
local STATUS="$?"
if [ -z "${ITERM2_SHOULD_DECORATE_PROMPT-}" ]; then
# You pressed ^C while entering a command (iterm2_preexec did not run)
iterm2_before_cmd_executes
if [ "$PS1" != "${ITERM2_DECORATED_PS1-}" ]; then
# PS1 changed, perhaps in another precmd. See issue 9938.
ITERM2_SHOULD_DECORATE_PROMPT="1"
fi
fi
iterm2_after_cmd_executes "$STATUS"
if [ -n "$ITERM2_SHOULD_DECORATE_PROMPT" ]; then
iterm2_decorate_prompt
fi
}
# This is not run if you press ^C while entering a command.
iterm2_preexec() {
# Set PS1 back to its raw value prior to executing the command.
PS1="$ITERM2_PRECMD_PS1"
ITERM2_SHOULD_DECORATE_PROMPT="1"
iterm2_before_cmd_executes
}
# If hostname -f is slow on your system set iterm2_hostname prior to
# sourcing this script. We know it is fast on macOS so we don't cache
# it. That lets us handle the hostname changing like when you attach
# to a VPN.
if [ -z "${iterm2_hostname-}" ]; then
if [ "$(uname)" != "Darwin" ]; then
iterm2_hostname=`hostname -f 2>/dev/null`
# Some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option.
if [ $? -ne 0 ]; then
iterm2_hostname=`hostname`
fi
fi
fi
[[ -z ${precmd_functions-} ]] && precmd_functions=()
precmd_functions=($precmd_functions iterm2_precmd)
[[ -z ${preexec_functions-} ]] && preexec_functions=()
preexec_functions=($preexec_functions iterm2_preexec)
iterm2_print_state_data
printf "\033]1337;ShellIntegrationVersion=14;shell=zsh\007"
fi
fi

View file

@ -203,7 +203,7 @@ generate_bar_disk() {
}
print_banner() {
if [ ! -f "$HOME/.cache/hey-banner-printed" ]; then
if [ ! -f "${XDG_CACHE_HOME:-$HOME/.cache}/hey-banner-printed" ]; then
if command -v lolcat >/dev/null && command -v figlet >/dev/null; then
figlet "Hey" | lolcat -f
printf "\\n"
@ -211,8 +211,8 @@ print_banner() {
printf "\\n%s\\n" "$(figlet -t -f "$BANNER_FONTPATH" " Hey")"
printf "\\n"
fi
mkdir -p "$HOME/.cache"
touch "$HOME/.cache/hey-banner-printed"
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}"
touch "${XDG_CACHE_HOME:-$HOME/.cache}/hey-banner-printed"
else
if command -v neofetch > /dev/null; then
neofetch

View file

@ -167,7 +167,7 @@ default_gnome_extensions:
- if command -v yum > /dev/null; then sudo yum install -y libgda libgda-sqlite; fi
- if command -v pacman > /dev/null; then sudo pacman -Sy libgda; fi
- if command -v zypper > /dev/null; then sudo zypper install -y libgda-6_0-sqlite typelib-1_0-Gda-6_0 typelib-1_0-GSound-1_0; fi
- dconf write /org/gnome/shell/extensions/pano/database-location "\\\"$HOME/.local/share/pano\\\""
- dconf write /org/gnome/shell/extensions/pano/database-location "\\\"${XDG_DATA_HOME:-$HOME/.local/share}/pano\\\""
- dconf write /org/gnome/shell/extensions/pano/history-length 50
- dconf write /org/gnome/shell/extensions/pano/play-audio-on-copy true
- dconf write /org/gnome/shell/extensions/pano/session-only-mode true

View file

@ -423,7 +423,7 @@ if command -v hoard > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/ho
fi
### iTerm2
[ ! -f "$HOME/.local/scripts/iterm2.zsh" ] || source "$HOME/.local/scripts/iterm2.zsh"
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.zsh" ] || source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.zsh"
### Java (asdf)
[ ! -f "$ASDF_DATA_DIR/plugins/java/set-java-home.zsh" ] || source "$ASDF_DATA_DIR/plugins/java/set-java-home.zsh"
@ -479,7 +479,7 @@ if command -v brew > /dev/null && command -v sdkman-cli > /dev/null; then
export SDKMAN_DIR="$(brew --prefix sdkman-cli)/libexec"
. "$SDKMAN_DIR/bin/sdkman-init.sh"
elif [ -f "$SDKMAN_DIR/bin/sdkman-init.sh" ]; then
export SDKMAN_DIR="$XDG_DATA_HOME/sdkman"
export SDKMAN_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/sdkman"
. "$SDKMAN_DIR/bin/sdkman-init.sh"
fi

View file

@ -433,10 +433,10 @@ find "$HOME/.local/bin" -maxdepth 1 -mindepth 1 -type f | while read -r BINFILE;
done
### Run chezmoi init
if [ ! -f "$HOME/.config/chezmoi/chezmoi.yaml" ]; then
if [ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/chezmoi/chezmoi.yaml" ]; then
### Show README.md snippet
if command -v glow > /dev/null; then
glow "$HOME/.local/share/chezmoi/docs/CHEZMOI-INTRO.md"
glow "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/CHEZMOI-INTRO.md"
fi
### Prompt for variables
@ -497,6 +497,6 @@ fi
logg success 'Provisioning complete!'
if command -v glow > /dev/null && [ -f "$HOME/.local/share/chezmoi/docs/POST-INSTALL.md" ]; then
glow "$HOME/.local/share/chezmoi/docs/POST-INSTALL.md"
if command -v glow > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md" ]; then
glow "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md"
fi

View file

@ -420,8 +420,8 @@ else
sudo sed -i '/# TEMPORARY FOR INSTALL DOCTOR/d' /etc/sudoers || logg warn 'Failed to remove passwordless sudo from the /etc/sudoers file'
fi
# @description Render the `docs/POST-INSTALL.md` file to the terminal at the end of the provisioning process
# @description Render the `docs/terminal/post-install.md` file to the terminal at the end of the provisioning process
logg success 'Provisioning complete!'
if command -v glow > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/POST-INSTALL.md" ]; then
glow "$HOME/.local/share/chezmoi/docs/POST-INSTALL.md"
if command -v glow > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md" ]; then
glow "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md"
fi

View file

@ -300,8 +300,8 @@ else
sudo sed -i '/# TEMPORARY FOR INSTALL DOCTOR/d' /etc/sudoers || logg warn 'Failed to remove passwordless sudo from the /etc/sudoers file'
fi
# @description Render the `docs/POST-INSTALL.md` file to the terminal at the end of the provisioning process
# @description Render the `docs/terminal/post-install.md` file to the terminal at the end of the provisioning process
logg success 'Provisioning complete!'
if command -v glow > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/POST-INSTALL.md" ]; then
glow "$HOME/.local/share/chezmoi/docs/POST-INSTALL.md"
if command -v glow > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md" ]; then
glow "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md"
fi

View file

@ -4812,7 +4812,7 @@ softwarePackages:
_bin: atuin
_github: https://github.com/ellie/atuin
_name: Atuin
_post: source "$XDG_CONFIG_HOME/shell/private.sh" && atuin register -u "$ATUIN_USERNAME" -e "$ATUIN_EMAIL" -p "$ATUIN_PASSWORD" && atuin import auto && atuin sync
_post: source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/private.sh" && atuin register -u "$ATUIN_USERNAME" -e "$ATUIN_EMAIL" -p "$ATUIN_PASSWORD" && atuin import auto && atuin sync
brew: atuin
cargo: atuin
pacman: atuin
@ -4823,7 +4823,7 @@ softwarePackages:
_github: https://github.com/ddworken/hishtory
_name: hiSHtory
_todo: Check for Homebrew version
_post: source "$XDG_CONFIG_HOME/shell/private.sh" && echo y | hishtory init "$HISHTORY_USER_SECRET"
_post: source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/private.sh" && echo y | hishtory init "$HISHTORY_USER_SECRET"
script: curl https://hishtory.dev/install.py | python3 -
git-town:
_bin: git-town
@ -9914,7 +9914,7 @@ softwarePackages:
_home: https://volta.sh
_name: volta-vm
_post: |
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
volta setup
volta install node@latest

View file

@ -296,18 +296,18 @@ function ensureTaskInstalled() {
logger error "System type not recognized. You must install task manually." && exit 1
fi
else
mkdir -p "$HOME/.cache/megabyte/start.sh"
if [ -f "$HOME/.cache/megabyte/start.sh/bodega-update-check" ]; then
TASK_UPDATE_TIME="$(cat "$HOME/.cache/megabyte/start.sh/bodega-update-check")"
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh"
if [ -f "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh/bodega-update-check" ]; then
TASK_UPDATE_TIME="$(cat "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh/bodega-update-check")"
else
TASK_UPDATE_TIME="$(date +%s)"
echo "$TASK_UPDATE_TIME" > "$HOME/.cache/megabyte/start.sh/bodega-update-check"
echo "$TASK_UPDATE_TIME" > "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh/bodega-update-check"
fi
# shellcheck disable=SC2004
TIME_DIFF="$(($(date +%s) - $TASK_UPDATE_TIME))"
# Only run if it has been at least 15 minutes since last attempt
if [ "$TIME_DIFF" -gt 900 ] || [ "$TIME_DIFF" -lt 5 ]; then
date +%s > "$HOME/.cache/megabyte/start.sh/bodega-update-check"
date +%s > "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh/bodega-update-check"
logger info "Checking for latest version of Task"
CURRENT_VERSION="$(task --version | cut -d' ' -f3 | cut -c 2-)"
LATEST_VERSION="$(curl -s "$TASK_RELEASE_API" | grep tag_name | cut -c 17- | sed 's/\",//')"
@ -450,12 +450,12 @@ function ensureTaskfiles() {
if [ -z "$ENSURED_TASKFILES" ]; then
# shellcheck disable=SC2030
task donothing || BOOTSTRAP_EXIT_CODE=$?
mkdir -p "$HOME/.cache/megabyte/start.sh"
if [ -f "$HOME/.cache/megabyte/start.sh/ensure-taskfiles" ]; then
TASK_UPDATE_TIME="$(cat "$HOME/.cache/megabyte/start.sh/ensure-taskfiles")"
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh"
if [ -f "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh/ensure-taskfiles" ]; then
TASK_UPDATE_TIME="$(cat "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh/ensure-taskfiles")"
else
TASK_UPDATE_TIME="$(date +%s)"
echo "$TASK_UPDATE_TIME" > "$HOME/.cache/megabyte/start.sh/ensure-taskfiles"
echo "$TASK_UPDATE_TIME" > "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh/ensure-taskfiles"
fi
# shellcheck disable=SC2004
TIME_DIFF="$(($(date +%s) - $TASK_UPDATE_TIME))"
@ -463,7 +463,7 @@ function ensureTaskfiles() {
if [ -n "$BOOTSTRAP_EXIT_CODE" ] || [ "$TIME_DIFF" -gt 3600 ] || [ "$TIME_DIFF" -lt 5 ] || [ -n "$FORCE_TASKFILE_UPDATE" ]; then
logger info 'Grabbing latest Taskfiles by downloading shared-master.tar.gz'
# shellcheck disable=SC2031
date +%s > "$HOME/.cache/megabyte/start.sh/ensure-taskfiles"
date +%s > "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte/start.sh/ensure-taskfiles"
ENSURED_TASKFILES="true"
if [ -d common/.config/taskfiles ]; then
if [[ "$OSTYPE" == 'darwin'* ]]; then