diff --git a/home/.chezmoiexternal.toml b/home/.chezmoiexternal.toml index afa17c7a..5190be06 100644 --- a/home/.chezmoiexternal.toml +++ b/home/.chezmoiexternal.toml @@ -138,6 +138,19 @@ clone.args = ["--depth", "1"] pull.args = ["--ff-only"] +### NGINX +[".local/system/etc/nginx"] + type = "git-repo" + url = "https://gitlab.com/megabyte-labs/cloud/nginx-configs.git" + clone.args = ["--depth", "1"] + pull.args = ["--ff-only"] + +### Rundeck +[".local/system/src/var/lib/rundeck/libext/ansible-plugin-3.2.2.jar"] + type = "file" + url = "https://github.com/rundeck-plugins/ansible-plugin/releases/download/v3.2.2/ansible-plugin-3.2.2.jar" + refreshPeriod = "{{ $refreshPeriod }}" + ### CookieCutter Template [".local/src/cookiecutter"] type = "git-repo" diff --git a/home/.chezmoiscripts/universal/run_onchange_after_14-keybase.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_14-keybase.tmpl new file mode 100644 index 00000000..f3b46dea --- /dev/null +++ b/home/.chezmoiscripts/universal/run_onchange_after_14-keybase.tmpl @@ -0,0 +1,18 @@ +{{- if eq .host.distro.family "linux" -}} +#!/usr/bin/env bash + +# timeshift.json hash: {{ include (joinPath .chezmoi.homeDir ".config" "keybase" "config.json") | sha256sum }} + +{{ includeTemplate "universal/profile" }} +{{ includeTemplate "universal/logg" }} + +if command -v keybase > /dev/null; then + logg info 'Ensuring /etc/keybase is a directory' + sudo mkdir -p /etc/keybase + + KEYBASE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/keybase/config.json" + logg info "Copying $KEYBASE_CONFIG to /etc/keybase/config.json" + sudo cp -f "$KEYBASE_CONFIG" /etc/keybase/config.json +else + logg info 'The `keybase` executable is not available' +fi diff --git a/home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl index 7911be58..4312af7e 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl @@ -4,6 +4,23 @@ {{ includeTemplate "universal/profile" }} {{ includeTemplate "universal/logg" }} +# font config hash: {{ include (joinPath .host.home ".config" "fontconfig" "fonts.conf") | sha256sum }} + +### Sync user fonts with system fonts +if [ -d /Applications ] && [ -d /System ]; then + # macOS + 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" +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" +fi + +### Configure system font properties if [ -d /etc/fonts ]; then logg info 'Copying ~/.config/fontconfig/fonts.conf to /etc/fonts/local.conf' sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/fontconfig/fonts.conf" /etc/fonts/local.conf diff --git a/home/.chezmoiscripts/universal/run_onchange_after_50-rclone.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_50-rclone.tmpl index 3533ba2d..ee0caf5d 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_50-rclone.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_50-rclone.tmpl @@ -9,6 +9,10 @@ if rclone -v rclone > /dev/null; then sudo mkdir -p /var/cache/rclone sudo chmod 700 /var/cache/rclone + logg info 'Ensuring /var/log/rclone exists' + sudo mkdir -p /var/log/rclone + sudo chmod 700 /var/log/rclone + logg info 'Ensuring /mnt/s3-docker exists' sudo mkdir -p /mnt/s3-docker sudo chmod 700 /mnt/s3-docker @@ -17,7 +21,23 @@ if rclone -v rclone > /dev/null; then sudo cp -f "$HOME/.local/bin/rclone-mount" /usr/local/bin/rclone-mount sudo chmod +x /usr/local/bin/rclone-mount + logg info 'Adding ~/.config/rclone/rcloneignore to /etc/rcloneignore' + sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/rclone/rcloneignore" /etc/rcloneignore + sudo chmod 644 /etc/rcloneignore + if [ -d /etc/systemd/system ]; then + logg info 'Adding Docker S3 rclone mount (available at /mnt/docker-s3)' + sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/rclone/s3-docker.service" /etc/systemd/system/docker-s3.service + logg info 'Enabling / restarting the S3 Docker mount' + sudo systemctl enable docker-s3 + sudo systemctl restart docker-s3 + + logg info 'Adding user S3 rclone mount (available at ~/.local/mnt/s3)' + sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/rclone/s3-user.service" "/etc/systemd/system/${USER}-s3.service" + logg info 'Enabling / restarting the S3 user mount' + sudo systemctl enable "${USER}-s3" + sudo systemctl restart "${USER}-s3" + fi else logg info '`rclone` is not available' fi diff --git a/system/etc/cockpit/machines.d/TODO.cockpit-machine.json.tmpl b/home/dot_config/cockpit/machines.d/cockpit-machine.json.TODO similarity index 100% rename from system/etc/cockpit/machines.d/TODO.cockpit-machine.json.tmpl rename to home/dot_config/cockpit/machines.d/cockpit-machine.json.TODO diff --git a/system/etc/sanoid/sanoid.conf.TODO b/home/dot_config/keybase/config.json similarity index 100% rename from system/etc/sanoid/sanoid.conf.TODO rename to home/dot_config/keybase/config.json diff --git a/home/dot_config/rclone/merge_rclone.conf b/home/dot_config/rclone/merge_rclone.conf index ab49cc2c..31cb1878 100644 --- a/home/dot_config/rclone/merge_rclone.conf +++ b/home/dot_config/rclone/merge_rclone.conf @@ -1,12 +1,11 @@ {{- if and (ne .user.CLOUDFLARE_ACCESS_KEY_ID "") (ne .user.CLOUDFLARE_SECRET_ACCESS_KEY "") (ne .user.CLOUDFLARE_R2_ACCOUNT_ID "") }} #!/usr/bin/env bash -# Consider https://github.com/dustinsand/blockinfile CONFIG_FILE="$HOME/.config/rclone/rclone.conf" -if cat "$CONFIG_FILE" | grep '# MEGABYTE LABS MANAGED r2-user'; then +if cat "$CONFIG_FILE" | grep '# MEGABYTE LABS MANAGED S3'; then # TODO: Remove old block - START_LINE="$(echo `grep -n -m 1 "# MEGABYTE LABS MANAGED r2-user" .zshrc | cut -f1 -d ":"`)" - END_LINE="$(echo `grep -n -m 1 "# MEGABYTE LABS MANAGED r2-user" .zshrc | cut -f1 -d ":"`)" + START_LINE="$(echo `grep -n -m 1 "# MEGABYTE LABS MANAGED S3" .zshrc | cut -f1 -d ":"`)" + END_LINE="$(echo `grep -n -m 1 "# MEGABYTE LABS MANAGED S3" .zshrc | cut -f1 -d ":"`)" if command -v gsed > /dev/null; then gsed -i "$START_LINE,$END_LINEd" "$CONFIG_FILE" else @@ -15,8 +14,8 @@ if cat "$CONFIG_FILE" | grep '# MEGABYTE LABS MANAGED r2-user'; then fi tee -a "$CONFIG_FILE" > /dev/null <