diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl new file mode 100644 index 0000000..741056f --- /dev/null +++ b/.chezmoi.toml.tmpl @@ -0,0 +1,24 @@ +# This .chezmoi.toml file is used once only +# It collects information about the system in order to determine +# which of the _home.* dirs will be set as the .chezmoiroot +# +{{- $chassisType := "desktop" }} +{{- $sysType := "posix" }} +{{- if eq .chezmoi.os "darwin" }} +{{- $sysType = "macos" }} +{{- if contains "BatteryData" (output "ioreg" "-c" "AppleSmartBattery") }} +{{- $chassisType = "laptop" }} +{{- else }} +{{- $chassisType = "desktop" }} +{{- end }} +{{- else if eq .chezmoi.os "linux" }} +{{- $chassisType = (output "hostnamectl" "--json=short" | mustFromJson).Chassis }} +{{- else if eq .chezmoi.os "windows" }} +{{- $sysType = "windows" }} +{{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }} +{{- end }} + +[scriptEnv] + CZ_CHASSIS="{{- $chassisType }}" + CZ_SYS="{{- $sysType }}" + CZ_OS="{{- .chezmoi.os }}" diff --git a/.chezmoiignore b/.chezmoiignore new file mode 100644 index 0000000..a43e2b3 --- /dev/null +++ b/.chezmoiignore @@ -0,0 +1,7 @@ +# The content at the root of the repo is for initial detection only. +# Thus, only .chezmoitscripts is required, because it will setup the +# correct .chezmoiroot, where the rest of the content resides. +# +* +! .chezmoiscripts/ +! .chezmoiscripts/** diff --git a/.chezmoiscripts/run_init.sh.tmpl b/.chezmoiscripts/run_init.sh.tmpl new file mode 100755 index 0000000..8b93ddc --- /dev/null +++ b/.chezmoiscripts/run_init.sh.tmpl @@ -0,0 +1,22 @@ +#! /usr/bin/env bash + +set -e + +#env | grep -E 'chezmoi|^CZ' +cd "$CHEZMOI_SOURCE_DIR" +CZ_MODEL="$(ioreg -l | grep "product-name" | sed -Ee 's/^.*\<"(.*)\"\>.*$/\1/')" +set | grep '^CZ_' +printf 'System detected as %s/%s, setting up .chezmoiroot and initializing...\n' "$CZ_SYS" "$CZ_CHASSIS" +if [ -r "base.chezmoiroot.$CZ_SYS.$CZ_CHASSIS" ]; then + ln -s "base.chezmoiroot.$CZ_SYS.$CZ_CHASSIS" .chezmoiroot +elif [ -r "base.chezmoiroot.$CZ_SYS" ]; then + ln -s "base.chezmoiroot.$CZ_SYS" .chezmoiroot +elif [ -r "base.chezmoiroot.$CZ_CHASSIS" ]; then + ln -s "base.chezmoiroot.$CZ_CHASSIS" .chezmoiroot +else + printf 'Failed to find a matching .chezmoiroot. Aborting!\n' + false +fi + +# Brute force remove chezmoistate lock and restart init --apply +exec sh -c 'rm ~/.config/chezmoi/chezmoistate.boltdb && chezmoi init --apply' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f4bb5b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# .chezmoiroot is generated by .chezmoiscripts/run_onchage_init.sh.tmpl +# during chezmoi init --apply +.chezmoiroot diff --git a/.init.me.sh b/.init.me.sh new file mode 100755 index 0000000..fc85021 --- /dev/null +++ b/.init.me.sh @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +set -ex + +rm -fR ~/.config/chezmoi ~/.local/share/chezmoi/.chezmoiroot +chezmoi init --apply diff --git a/_home.macos/.chezmoi.toml.tmpl b/_home.macos/.chezmoi.toml.tmpl new file mode 120000 index 0000000..7e4fdc7 --- /dev/null +++ b/_home.macos/.chezmoi.toml.tmpl @@ -0,0 +1 @@ +../_src.posix/.chezmoi.toml.tmpl \ No newline at end of file diff --git a/_home.macos/.chezmoiexternal.yaml b/_home.macos/.chezmoiexternal.yaml new file mode 100644 index 0000000..1d84c22 --- /dev/null +++ b/_home.macos/.chezmoiexternal.yaml @@ -0,0 +1,105 @@ +# https://www.chezmoi.io/reference/special-files-and-directories/chezmoiexternal-format/ +# +# The externals are checked based on the refreshPeriod whenever an `apply` (or `update`) operations run +# +# The simplest form to update all externals: +# ```sh +# chezmoi apply --include externals +# ``` +# +# Variable Type Default Description +# type string none External type (file, archive, archive-file, or git-repo) +# url string none URL +# refreshPeriod duration 0 Refresh period (Examples: one day (24h), one week (168h), or four weeks (672h)) +# executable bool false Add executable_ attribute to file +# path string none Path to file in archive + +{{ $defaultRefresh := "168h" -}} +{{- $externals := dict -}} + +{{ $myArch := "aarch64-apple-darwin" }} + +{{- with $repo := "zellij-org/zellij" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".cache/chezmoi/tmp/zellij" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/%s/zellij-%s.tar.gz" $repo $version $myArch) + "path" "zellij" + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end }} + +{{- with $repo := "dandavison/delta" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/delta" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/%s/delta-%s-%s.tar.gz" $repo $version $version $myArch) + "path" (printf "delta-%s-%s/delta" $version $myArch) + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end -}} + +{{ $myArch = "darwin_arm64" }} + +{{- with $repo := "hickford/git-credential-oauth" -}} +{{- with $version := trimPrefix "v" (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/git-credential-oauth" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/v%s/git-credential-oauth_%s_%s.tar.gz" $repo $version $version $myArch) + "path" "git-credential-oauth" + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end -}} + +{{ $myArch = "mac" }} + +{{- with $repo := "extrawurst/gitui" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/gitui" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/%s/gitui-%s.tar.gz" $repo $version $myArch) + "path" "./gitui" + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end }} + +{{ $myArch = "Darwin_arm64" }} + +{{- with $repo := "theimpostor/osc" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/osc" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/%s/osc_%s.tar.gz" $repo $version $myArch) + "path" "osc" + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end }} + +{{ $myArch = "darwin-arm64" }} + +{{- with $repo := "Lifailon/lazyjournal" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/lazyjournal" (dict + "type" "file" + "url" (printf "https://github.com/%s/releases/download/%s/lazyjournal-%s-%s" $repo $version $version $myArch) + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end }} + +{{- $externals | toYaml }} + +".config/sz.env/lib/delta.themes.gitconfig": + type: "file" + url: "https://raw.githubusercontent.com/dandavison/delta/refs/heads/main/themes.gitconfig" + refreshPeriod: "{{ $defaultRefresh }}" diff --git a/_home.macos/.chezmoiignore b/_home.macos/.chezmoiignore new file mode 120000 index 0000000..cc506ef --- /dev/null +++ b/_home.macos/.chezmoiignore @@ -0,0 +1 @@ +../_src.posix/.chezmoiignore \ No newline at end of file diff --git a/_home.macos/.chezmoiscripts/run_once_init.sh.tmpl b/_home.macos/.chezmoiscripts/run_once_init.sh.tmpl new file mode 100755 index 0000000..8f13a6a --- /dev/null +++ b/_home.macos/.chezmoiscripts/run_once_init.sh.tmpl @@ -0,0 +1,3 @@ +#! /usr/bin/env bash + +printf '_home.macos init\n' diff --git a/_home.macos/dot_bashrc b/_home.macos/dot_bashrc new file mode 120000 index 0000000..0762bfe --- /dev/null +++ b/_home.macos/dot_bashrc @@ -0,0 +1 @@ +../_src.posix/dot_bashrc \ No newline at end of file diff --git a/_home.macos/dot_finicky.js b/_home.macos/dot_finicky.js new file mode 100644 index 0000000..c31e7e9 --- /dev/null +++ b/_home.macos/dot_finicky.js @@ -0,0 +1,50 @@ +// Use https://finicky-kickstart.now.sh to generate basic configuration +// Learn more about configuration options: https://github.com/johnste/finicky/wiki/Configuration + +module.exports = { + defaultBrowser: "Browserosaurus", + rewrite: [{ + match: () => true, // Execute rewrite on all incoming urls to make this example easier to understand + url: ({ url }) => { + const removeKeysStartingWith = ["utm_", "uta_"]; // Remove all query parameters beginning with these strings + const removeKeys = ["fbclid", "gclid", "si"]; // Remove all query parameters matching these keys + + const search = url.search + .split("&") + .map((parameter) => parameter.split("=")) + .filter(([key]) => !removeKeysStartingWith.some((startingWith) => key.startsWith(startingWith))) + .filter(([key]) => !removeKeys.some((removeKey) => key === removeKey)); + + return { + ...url, + search: search.map((parameter) => parameter.join("=")).join("&"), + }; + }, + }], + handlers: [ + { + match: [ + finicky.matchDomains(/.*\.vastdata.com/) + ], + browser: "Google Chrome" + }, + { + match: [ + finicky.matchDomains(/127\.0\.0\.1/) + ], + browser: "DuckDuckGo" + }, + { + // Open these in Browserosaurus + match: [ + "github.com*", + "open.spotify.com*", + // YouTube + "youtube.com*", + "youtu.be*", + finicky.matchDomains(/.*\.youtube.com/) // use helper function to match on domain only + ], + browser: "Browserosaurus" + } + ] +} diff --git a/_home.macos/dot_gitconfig.tmpl b/_home.macos/dot_gitconfig.tmpl new file mode 120000 index 0000000..23d98c5 --- /dev/null +++ b/_home.macos/dot_gitconfig.tmpl @@ -0,0 +1 @@ +../_src.posix/dot_gitconfig.tmpl \ No newline at end of file diff --git a/_home.macos/dot_profile b/_home.macos/dot_profile new file mode 120000 index 0000000..9f6dadf --- /dev/null +++ b/_home.macos/dot_profile @@ -0,0 +1 @@ +../_src.posix/dot_profile \ No newline at end of file diff --git a/_home.macos/dot_vscode/_workspaces/🏑chezmoi.code-workspace b/_home.macos/dot_vscode/_workspaces/🏑chezmoi.code-workspace new file mode 100644 index 0000000..d2ed564 --- /dev/null +++ b/_home.macos/dot_vscode/_workspaces/🏑chezmoi.code-workspace @@ -0,0 +1,19 @@ +{ + "folders": [ + { + "name": "chezmoi 🏑", + "path": "../../.local/share/chezmoi" + }, + { + "name": "~/.config/chezmoi", + "path": "../../.config/chezmoi" + }, + { + "path": "." + }, + { + "path": "../.." + } + ], + "settings": {} +} \ No newline at end of file diff --git a/_home.macos/dot_zshrc b/_home.macos/dot_zshrc new file mode 120000 index 0000000..784bde6 --- /dev/null +++ b/_home.macos/dot_zshrc @@ -0,0 +1 @@ +../_src.posix/dot_zshrc \ No newline at end of file diff --git a/_home.macos/private_dot_config/atuin/config.toml b/_home.macos/private_dot_config/atuin/config.toml new file mode 120000 index 0000000..768b3d0 --- /dev/null +++ b/_home.macos/private_dot_config/atuin/config.toml @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/atuin/config.toml \ No newline at end of file diff --git a/_home.macos/private_dot_config/starship.toml b/_home.macos/private_dot_config/starship.toml new file mode 120000 index 0000000..074c848 --- /dev/null +++ b/_home.macos/private_dot_config/starship.toml @@ -0,0 +1 @@ +../../_src.posix/private_dot_config/starship.toml \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env b/_home.macos/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env new file mode 120000 index 0000000..117cb13 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/PATH_home_bin.env b/_home.macos/private_dot_config/sz.env/PATH_home_bin.env new file mode 120000 index 0000000..f6f9878 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/PATH_home_bin.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/PATH_home_bin.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/PATH_node.env b/_home.macos/private_dot_config/sz.env/PATH_node.env new file mode 120000 index 0000000..06b67f6 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/PATH_node.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/PATH_node.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/PATH_truestuff.env b/_home.macos/private_dot_config/sz.env/PATH_truestuff.env new file mode 120000 index 0000000..62bc4e1 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/PATH_truestuff.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/PATH_truestuff.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/PATH_zz_cleanup.env b/_home.macos/private_dot_config/sz.env/PATH_zz_cleanup.env new file mode 120000 index 0000000..bd30077 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/PATH_zz_cleanup.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/PATH_zz_cleanup.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/aaa_zsh_0_perp.env b/_home.macos/private_dot_config/sz.env/aaa_zsh_0_perp.env new file mode 120000 index 0000000..9ad1a34 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/aaa_zsh_0_perp.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/aaa_zsh_0_perp.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/aaa_zsh_2_zinit.env b/_home.macos/private_dot_config/sz.env/aaa_zsh_2_zinit.env new file mode 120000 index 0000000..089a0d8 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/aaa_zsh_2_zinit.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/aaa_zsh_2_zinit.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/aaa_zsh_3_completion_system.env b/_home.macos/private_dot_config/sz.env/aaa_zsh_3_completion_system.env new file mode 120000 index 0000000..dbe81b1 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/aaa_zsh_3_completion_system.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/aaa_zsh_3_completion_system.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/aab_zellij.env b/_home.macos/private_dot_config/sz.env/aab_zellij.env new file mode 120000 index 0000000..6472cc8 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/aab_zellij.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/aab_zellij.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/aliases.macos.env b/_home.macos/private_dot_config/sz.env/aliases.macos.env new file mode 100644 index 0000000..1fcbe78 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/aliases.macos.env @@ -0,0 +1,9 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +alias l='ls -lahF --color=auto ' +alias lu='l -U ' +alias lold='l -t ' +alias lnew='l -tr ' +alias ll='l -A' + +alias sudo='sudo ' diff --git a/_home.macos/private_dot_config/sz.env/bbb_bash_preexec.env b/_home.macos/private_dot_config/sz.env/bbb_bash_preexec.env new file mode 120000 index 0000000..b13a0db --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/bbb_bash_preexec.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/bbb_bash_preexec.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/bbb_ble.sh.env b/_home.macos/private_dot_config/sz.env/bbb_ble.sh.env new file mode 120000 index 0000000..75fb560 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/bbb_ble.sh.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/bbb_ble.sh.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/broot.env b/_home.macos/private_dot_config/sz.env/broot.env new file mode 120000 index 0000000..b2316c2 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/broot.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/broot.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/envman-and-webi.env b/_home.macos/private_dot_config/sz.env/envman-and-webi.env new file mode 120000 index 0000000..bc3184a --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/envman-and-webi.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/envman-and-webi.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/executable__.load.sh b/_home.macos/private_dot_config/sz.env/executable__.load.sh new file mode 120000 index 0000000..7e4dc65 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/executable__.load.sh @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/executable__.load.sh \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/fix-kubectl.env b/_home.macos/private_dot_config/sz.env/fix-kubectl.env new file mode 120000 index 0000000..2f5b699 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/fix-kubectl.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/fix-kubectl.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/fix-nvim.env b/_home.macos/private_dot_config/sz.env/fix-nvim.env new file mode 120000 index 0000000..4f47730 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/fix-nvim.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/fix-nvim.env \ No newline at end of file diff --git a/_home/.chezmoiscripts/.keep b/_home.macos/private_dot_config/sz.env/remove_ID_truenas_scale.env similarity index 100% rename from _home/.chezmoiscripts/.keep rename to _home.macos/private_dot_config/sz.env/remove_ID_truenas_scale.env diff --git a/_home.macos/private_dot_config/sz.env/remove_aliases.env b/_home.macos/private_dot_config/sz.env/remove_aliases.env new file mode 100644 index 0000000..e69de29 diff --git a/_home.macos/private_dot_config/sz.env/remove_truenas-scale.env b/_home.macos/private_dot_config/sz.env/remove_truenas-scale.env new file mode 100644 index 0000000..e69de29 diff --git a/_home.macos/private_dot_config/sz.env/zza_atuin.env b/_home.macos/private_dot_config/sz.env/zza_atuin.env new file mode 120000 index 0000000..12dba93 --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/zza_atuin.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zza_atuin.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/zza_starship.env b/_home.macos/private_dot_config/sz.env/zza_starship.env new file mode 120000 index 0000000..2a51f2d --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/zza_starship.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zza_starship.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/zzz_bash_post.env b/_home.macos/private_dot_config/sz.env/zzz_bash_post.env new file mode 120000 index 0000000..227f00e --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/zzz_bash_post.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zzz_bash_post.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/zzz_chezmoi.env b/_home.macos/private_dot_config/sz.env/zzz_chezmoi.env new file mode 120000 index 0000000..fb97cec --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/zzz_chezmoi.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zzz_chezmoi.env \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/zzz_fzf.env.off b/_home.macos/private_dot_config/sz.env/zzz_fzf.env.off new file mode 120000 index 0000000..1db551d --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/zzz_fzf.env.off @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zzz_fzf.env.off \ No newline at end of file diff --git a/_home.macos/private_dot_config/sz.env/zzz_homebrew.env b/_home.macos/private_dot_config/sz.env/zzz_homebrew.env new file mode 100644 index 0000000..fd649ce --- /dev/null +++ b/_home.macos/private_dot_config/sz.env/zzz_homebrew.env @@ -0,0 +1,4 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +! [ -x /opt/homebrew/bin/brew ] || \ + eval "$(/opt/homebrew/bin/brew shellenv)" diff --git a/_home.macos/private_dot_local/bin/executable_get-github-release.sh b/_home.macos/private_dot_local/bin/executable_get-github-release.sh new file mode 120000 index 0000000..8166e11 --- /dev/null +++ b/_home.macos/private_dot_local/bin/executable_get-github-release.sh @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_get-github-release.sh \ No newline at end of file diff --git a/_home.macos/private_dot_local/bin/executable_load-starship b/_home.macos/private_dot_local/bin/executable_load-starship new file mode 120000 index 0000000..22d7305 --- /dev/null +++ b/_home.macos/private_dot_local/bin/executable_load-starship @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_load-starship \ No newline at end of file diff --git a/_home.macos/private_dot_local/bin/executable_load-webi b/_home.macos/private_dot_local/bin/executable_load-webi new file mode 120000 index 0000000..7e8ee5b --- /dev/null +++ b/_home.macos/private_dot_local/bin/executable_load-webi @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_load-webi \ No newline at end of file diff --git a/_home.macos/private_dot_local/bin/executable_load-zellij b/_home.macos/private_dot_local/bin/executable_load-zellij new file mode 120000 index 0000000..8aae9a8 --- /dev/null +++ b/_home.macos/private_dot_local/bin/executable_load-zellij @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_load-zellij \ No newline at end of file diff --git a/_home.macos/private_dot_local/bin/executable_update-atuin b/_home.macos/private_dot_local/bin/executable_update-atuin new file mode 120000 index 0000000..58200fa --- /dev/null +++ b/_home.macos/private_dot_local/bin/executable_update-atuin @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_update-atuin \ No newline at end of file diff --git a/_home/.chezmoi.toml.tmpl b/_home/.chezmoi.toml.tmpl deleted file mode 100644 index 56873e0..0000000 --- a/_home/.chezmoi.toml.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -{{- $sysname := promptStringOnce . "sysname" "System name" -}} -{{- $sysgroup := promptStringOnce . "sysgroup" "System group" -}} -{{- $sysarea := promptStringOnce . "sysarea" "System area" -}} -{{- $gitEmail := promptStringOnce . "gitEmail" "email address (for git commits)" -}} -{{- $gitName := promptStringOnce . "gitName" "Full name (for git commits)" -}} - -[data] -{{- if ($sysname) }} - sysname = {{ $sysname | quote }} -{{- end -}} -{{- if ($sysgroup) }} - sysgroup = {{ $sysgroup | quote }} -{{- end -}} -{{- if ($sysarea) }} - sysarea = {{ $sysarea | quote }} -{{ end -}} - -{{ if ($gitEmail) }} - gitEmail = {{ $gitEmail | quote }} -{{- end -}} -{{- if ($gitName) }} - gitName = {{ $gitName | quote }} -{{- end }} - -[diff] -# command = "nvim" -# args = ["-d", "{{- "{{ .Destination }}" -}}", "{{- "{{ .Target }}" -}}"] - - command = "delta" - args = ["--paging=never", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"] - pager = "delta" - diff --git a/_home/.chezmoi.toml.tmpl b/_home/.chezmoi.toml.tmpl new file mode 120000 index 0000000..7e4fdc7 --- /dev/null +++ b/_home/.chezmoi.toml.tmpl @@ -0,0 +1 @@ +../_src.posix/.chezmoi.toml.tmpl \ No newline at end of file diff --git a/_home/.chezmoiexternal.yaml b/_home/.chezmoiexternal.yaml deleted file mode 100644 index a5362b7..0000000 --- a/_home/.chezmoiexternal.yaml +++ /dev/null @@ -1,110 +0,0 @@ -# https://www.chezmoi.io/reference/special-files-and-directories/chezmoiexternal-format/ -# -# The externals are checked based on the refreshPeriod whenever an `apply` (or `update`) operations run -# -# The simplest form to update all externals: -# ```sh -# chezmoi apply --include externals -# ``` -# -# Variable Type Default Description -# type string none External type (file, archive, archive-file, or git-repo) -# url string none URL -# refreshPeriod duration 0 Refresh period (Examples: one day (24h), one week (168h), or four weeks (672h)) -# executable bool false Add executable_ attribute to file -# path string none Path to file in archive - -{{ $defaultRefresh := "168h" -}} -{{- $externals := dict -}} - -{{- with $repo := "zellij-org/zellij" -}} -{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} -{{- $_ := set $externals ".cache/chezmoi/tmp/zellij" (dict - "type" "archive-file" - "url" (printf "https://github.com/%s/releases/download/%s/zellij-x86_64-unknown-linux-musl.tar.gz" $repo $version) - "path" "zellij" - "executable" true - "refreshPeriod" $defaultRefresh -) -}} -{{- end -}} -{{- end }} - -{{- with $repo := "dandavison/delta" -}} -{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} -{{- $_ := set $externals ".local/bin/delta" (dict - "type" "archive-file" - "url" (printf "https://github.com/%s/releases/download/%s/delta-%s-x86_64-unknown-linux-musl.tar.gz" $repo $version $version) - "path" (printf "delta-%s-x86_64-unknown-linux-musl/delta" $version) - "refreshPeriod" $defaultRefresh -) -}} -{{- end -}} -{{- end -}} - -{{- with $repo := "hickford/git-credential-oauth" -}} -{{- with $version := trimPrefix "v" (gitHubLatestRelease $repo).GetTagName -}} -{{- $_ := set $externals ".local/bin/git-credential-oauth" (dict - "type" "archive-file" - "url" (printf "https://github.com/%s/releases/download/v%s/git-credential-oauth_%s_linux_amd64.tar.gz" $repo $version $version) - "path" "git-credential-oauth" - "executable" true - "refreshPeriod" $defaultRefresh -) -}} -{{- end -}} -{{- end -}} - -{{- with $repo := "extrawurst/gitui" -}} -{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} -{{- $_ := set $externals ".local/bin/gitui" (dict - "type" "archive-file" - "url" (printf "https://github.com/%s/releases/download/%s/gitui-linux-x86_64.tar.gz" $repo $version) - "path" "./gitui" - "executable" true - "refreshPeriod" $defaultRefresh -) -}} -{{- end -}} -{{- end }} - -{{- with $repo := "theimpostor/osc" -}} -{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} -{{- $_ := set $externals ".local/bin/osc" (dict - "type" "archive-file" - "url" (printf "https://github.com/%s/releases/download/%s/osc_linux_x86_64.tar.gz" $repo $version) - "path" "osc" - "executable" true - "refreshPeriod" $defaultRefresh -) -}} -{{- end -}} -{{- end }} - -{{- with $repo := "Lifailon/lazyjournal" -}} -{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} -{{- $_ := set $externals ".local/bin/lazyjournal" (dict - "type" "file" - "url" (printf "https://github.com/%s/releases/download/%s/lazyjournal-%s-linux-amd64" $repo $version $version) - "executable" true - "refreshPeriod" $defaultRefresh -) -}} -{{- end -}} -{{- end }} - -{{- $externals | toYaml }} -".config/sz.env/lib/ble.sh.curl": - type: "archive" - url: "https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz" - refreshPeriod: "{{ $defaultRefresh }}" - -".config/sz.env/lib/delta.themes.gitconfig": - type: "file" - url: "https://raw.githubusercontent.com/dandavison/delta/refs/heads/main/themes.gitconfig" - refreshPeriod: "{{ $defaultRefresh }}" - -".config/sz.env/lib/bash-preexec/bash-preexec.sh": - type: "file" - url: "https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh" - refreshPeriod: "{{ $defaultRefresh }}" - -".local/bin/nvim.AppImage": - type: "file" - url: "https://github.com/neovim/neovim/releases/download/stable/nvim.appimage" - executable: true - refreshPeriod: "{{ $defaultRefresh }}" diff --git a/_home/.chezmoiexternal.yaml b/_home/.chezmoiexternal.yaml new file mode 120000 index 0000000..ac9fe87 --- /dev/null +++ b/_home/.chezmoiexternal.yaml @@ -0,0 +1 @@ +../_src.posix/.chezmoiexternal.yaml \ No newline at end of file diff --git a/_home/.chezmoiignore b/_home/.chezmoiignore deleted file mode 100644 index 7e110d2..0000000 --- a/_home/.chezmoiignore +++ /dev/null @@ -1,3 +0,0 @@ -/**/.git -/**/.git/** - diff --git a/_home/.chezmoiignore b/_home/.chezmoiignore new file mode 120000 index 0000000..cc506ef --- /dev/null +++ b/_home/.chezmoiignore @@ -0,0 +1 @@ +../_src.posix/.chezmoiignore \ No newline at end of file diff --git a/_home/.chezmoiscripts/run_once_init.sh.tmpl b/_home/.chezmoiscripts/run_once_init.sh.tmpl new file mode 120000 index 0000000..3e5100d --- /dev/null +++ b/_home/.chezmoiscripts/run_once_init.sh.tmpl @@ -0,0 +1 @@ +../../_src.posix/.chezmoiscripts/run_once_init.sh.tmpl \ No newline at end of file diff --git a/_home/dot_bashrc b/_home/dot_bashrc deleted file mode 100644 index 13ebe78..0000000 --- a/_home/dot_bashrc +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -# ~/.bashrc: executed by bash(1) for non-login shells. -# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) -# for examples -[ -z "${DBG_SHRC}" ] || echo "Entered .bashrc" - -## Generated for envman. Do not edit. -#[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh" -# -## Generated by Webi. Do not edit. -#eval "$(webi --init zsh)" - -[ -s "$HOME/.config/sz.env/_.load.sh" ] && . <( "$HOME/.config/sz.env/_.load.sh" - ) - -[ -z "${DBG_SHRC}" ] || echo "Exiting .bashrc" -# This will prevent atuin's setup script from adding itself: atuin init bash - -#eval "${SZ_ENV_BASH_LOAD_PREEXEC}" -#if [[ -n "${BLE_VERSION-}" ]]; then -# [[ -n "${DBG}" ]] && echo "attaching ble.sh" -# ble-attach -#fi - diff --git a/_home/dot_bashrc b/_home/dot_bashrc new file mode 120000 index 0000000..0762bfe --- /dev/null +++ b/_home/dot_bashrc @@ -0,0 +1 @@ +../_src.posix/dot_bashrc \ No newline at end of file diff --git a/_home/dot_gitconfig.tmpl b/_home/dot_gitconfig.tmpl deleted file mode 100644 index 930a684..0000000 --- a/_home/dot_gitconfig.tmpl +++ /dev/null @@ -1,56 +0,0 @@ -# This is Git's per-user configuration file. -# It is recommended to edit this using chezmoi: -# cz edit ~/.gitconfig - -[include] - path = .config/sz.env/lib/delta.themes.gitconfig - -[user] - name = {{ .gitName }} - email = {{ .gitEmail }} - -[credential] - helper = cache --timeout 21600 - helper = oauth -# helper = oauth -device -[credential "https://code.lksz.me"] - oauthClientId = a4792ccc-144e-407e-86c9-5e7d8d9c3269 - oauthAuthURL = /login/oauth/authorize - oauthTokenURL = /login/oauth/access_token -# oauthDeviceAuthURL = /login/oauth/authorize -# oauthDeviceAuthURL = /login/oauth/authorize_device -# oauthScopes = read_repository -[core] - editor = nvim - pager = delta - -[init] - defaultBranch = main - -[core] - pager = delta - -[interactive] - diffFilter = delta --color-only - -[delta] - features = colibri - navigate = true # use n and N to move between diff sections - line-numbers = true - side-by-side = true - -[diff] - tool = nvimdiff -[difftool] - prompt = false -[difftool "nvimdiff"] - cmd = "nvim -d \"$LOCAL\" \"$REMOTE\"" - -[merge] - tool = nvimdiff - conflictstyle = zdiff3 -[mergetool] - prompt = true -[mergetool "nvimdiff"] - cmd = "nvim -d \"$LOCAL\" \"$REMOTE\" \"$MERGED\" -c 'wincmd w' -c 'wincmd J'" - diff --git a/_home/dot_gitconfig.tmpl b/_home/dot_gitconfig.tmpl new file mode 120000 index 0000000..23d98c5 --- /dev/null +++ b/_home/dot_gitconfig.tmpl @@ -0,0 +1 @@ +../_src.posix/dot_gitconfig.tmpl \ No newline at end of file diff --git a/_home/dot_profile b/_home/dot_profile deleted file mode 100644 index 88fa551..0000000 --- a/_home/dot_profile +++ /dev/null @@ -1,31 +0,0 @@ -# ~/.profile: executed by the command interpreter for login shells. -# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login -# exists. -# see /usr/share/doc/bash/examples/startup-files for examples. -# the files are located in the bash-doc package. - -# the default umask is set in /etc/profile; for setting the umask -# for ssh logins, install and configure the libpam-umask package. -#umask 022 - -# if running bash -if [ -n "$BASH_VERSION" ]; then - # include .bashrc if it exists - if [ -f "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" - fi -fi - -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/bin" ] ; then - PATH="$HOME/bin:$PATH" -fi - -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/.local/bin" ] ; then - PATH="$HOME/.local/bin:$PATH" -fi - -# Generated for envman. Do not edit. -# [ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh" -[ -s "$HOME/.config/sz.env/_.load.sh" ] && . <( "$HOME/.config/sz.env/_.load.sh" - ) diff --git a/_home/dot_profile b/_home/dot_profile new file mode 120000 index 0000000..9f6dadf --- /dev/null +++ b/_home/dot_profile @@ -0,0 +1 @@ +../_src.posix/dot_profile \ No newline at end of file diff --git a/_home/dot_zshrc b/_home/dot_zshrc deleted file mode 100644 index 7742f46..0000000 --- a/_home/dot_zshrc +++ /dev/null @@ -1,8 +0,0 @@ -## Generated for envman. Do not edit. -#[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh" -# -## Generated by Webi. Do not edit. -#eval "$(webi --init zsh)" - -[ -s "$HOME/.config/sz.env/_.load.sh" ] && . <( "$HOME/.config/sz.env/_.load.sh" - ) - diff --git a/_home/dot_zshrc b/_home/dot_zshrc new file mode 120000 index 0000000..784bde6 --- /dev/null +++ b/_home/dot_zshrc @@ -0,0 +1 @@ +../_src.posix/dot_zshrc \ No newline at end of file diff --git a/_home/private_dot_config/atuin/config.toml b/_home/private_dot_config/atuin/config.toml deleted file mode 100644 index bda65c2..0000000 --- a/_home/private_dot_config/atuin/config.toml +++ /dev/null @@ -1,142 +0,0 @@ -## where to store your database, default is your system data directory -## linux/mac: ~/.local/share/atuin/history.db -## windows: %USERPROFILE%/.local/share/atuin/history.db -# db_path = "~/.history.db" - -## where to store your encryption key, default is your system data directory -## linux/mac: ~/.local/share/atuin/key -## windows: %USERPROFILE%/.local/share/atuin/key -# key_path = "~/.key" - -## where to store your auth session token, default is your system data directory -## linux/mac: ~/.local/share/atuin/session -## windows: %USERPROFILE%/.local/share/atuin/session -# session_path = "~/.session" - -## date format used, either "us" or "uk" -# dialect = "us" - -## enable or disable automatic sync -# auto_sync = true - -## enable or disable automatic update checks -# update_check = true - -## address of the sync server -# sync_address = "http://192.168.222.65" - -## how often to sync history. note that this is only triggered when a command -## is ran, so sync intervals may well be longer -## set it to 0 to sync after every command -# sync_frequency = "10m" - -## which search mode to use -## possible values: prefix, fulltext, fuzzy, skim -# search_mode = "fuzzy" - -## which filter mode to use -## possible values: global, host, session, directory -# filter_mode = "global" - -## With workspace filtering enabled, Atuin will filter for commands executed -## in any directory within a git repository tree (default: false) -# workspaces = false - -## which filter mode to use when atuin is invoked from a shell up-key binding -## the accepted values are identical to those of "filter_mode" -## leave unspecified to use same mode set in "filter_mode" -# filter_mode_shell_up_key_binding = "directory" - -## which search mode to use when atuin is invoked from a shell up-key binding -## the accepted values are identical to those of "search_mode" -## leave unspecified to use same mode set in "search_mode" -# search_mode_shell_up_key_binding = "fuzzy" - -## which style to use -## possible values: auto, full, compact -# style = "auto" - -## the maximum number of lines the interface should take up -## set it to 0 to always go full screen -inline_height = 20 - -## Invert the UI - put the search bar at the top , Default to `false` -# invert = false - -## enable or disable showing a preview of the selected command -## useful when the command is longer than the terminal width and is cut off -show_preview = true - -## what to do when the escape key is pressed when searching -## possible values: return-original, return-query -# exit_mode = "return-original" - -## possible values: emacs, subl -# word_jump_mode = "emacs" - -## characters that count as a part of a word -# word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" - -## number of context lines to show when scrolling by pages -# scroll_context_lines = 1 - -## use ctrl instead of alt as the shortcut modifier key for numerical UI shortcuts -## alt-0 .. alt-9 -# ctrl_n_shortcuts = false - -## prevent commands matching any of these regexes from being written to history. -## Note that these regular expressions are unanchored, i.e. if they don't start -## with ^ or end with $, they'll match anywhere in the command. -## For details on the supported regular expression syntax, see -## https://docs.rs/regex/latest/regex/#syntax -# history_filter = [ -# "^secret-cmd", -# "^innocuous-cmd .*--secret=.+" -# ] - -## prevent commands run with cwd matching any of these regexes from being written -## to history. Note that these regular expressions are unanchored, i.e. if they don't -## start with ^ or end with $, they'll match anywhere in CWD. -## For details on the supported regular expression syntax, see -## https://docs.rs/regex/latest/regex/#syntax -# cwd_filter = [ -# "^/very/secret/area" -# ] - -## Configure the maximum height of the preview to show. -## Useful when you have long scripts in your history that you want to distinguish -## by more than the first few lines. -max_preview_height = 8 - -## Configure whether or not to show the help row, which includes the current Atuin -## version (and whether an update is available), a keymap hint, and the total -## amount of commands in your history. -show_help = true - -## Defaults to true. This matches history against a set of default regex, and will not save it if we get a match. Defaults include -## 1. AWS key id -## 2. Github pat (old and new) -## 3. Slack oauth tokens (bot, user) -## 4. Slack webhooks -## 5. Stripe live/test keys -# secrets_filter = true - -## Defaults to true. If enabled, upon hitting enter Atuin will immediately execute the command. Press tab to return to the shell and edit. -# This applies for new installs. Old installs will keep the old behaviour unless configured otherwise. -enter_accept = false - -#[stats] -# Set commands where we should consider the subcommand for statistics. Eg, kubectl get vs just kubectl -common_subcommands = [ - "cargo", - "go", - "git", - "npm", - "yarn", - "pnpm", - "kubectl", - "apt" -] -# -# Set commands that should be totally stripped and ignored from stats -#common_prefix = ["sudo"] diff --git a/_home/private_dot_config/atuin/config.toml b/_home/private_dot_config/atuin/config.toml new file mode 120000 index 0000000..768b3d0 --- /dev/null +++ b/_home/private_dot_config/atuin/config.toml @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/atuin/config.toml \ No newline at end of file diff --git a/_home/private_dot_config/starship.toml b/_home/private_dot_config/starship.toml deleted file mode 100644 index 45402f4..0000000 --- a/_home/private_dot_config/starship.toml +++ /dev/null @@ -1,101 +0,0 @@ -# Customized, based on tokyo-night - -# global prompt configuration ( https://starship.rs/config/#prompt ) -format = """ -[β–‘β–’β–“](#a3aed2)\ -$os\ -[ξ‚΄](bg:#769ff0 fg:#a3aed2)\ -$directory\ -[ξ‚΄](fg:#769ff0 bg:#394260)\ -$git_branch\ -$git_status\ -[ξ‚΄](fg:#394260 bg:#212736)\ -$nodejs\ -$rust\ -$golang\ -[ξ‚΄](fg:#212736 bg:#1d2230)\ -$time\ -[ξ‚΄](fg:#212736 bg:#1d2230)\ -$cmd_duration\ -$status\ -[ξ‚΄ ](fg:#1d2230)\ -$line_break$character""" - -command_timeout = 1500 # milliseconds; default is 500 - -[profiles] -transient = """ -$time\ -[ξ‚΄](fg:#212736 bg:#1d2230)\ -$character""" - - -[os] -style = "bg:#a3aed2 fg:#090c0c" -disabled = false - -# Without NerdFont -#[os.symbols] -#Windows = " Win" - -# NerdFont - see https://www.nerdfonts.com/cheat-sheet -[os.symbols] -Windows = " ο…Ί" - -[directory] -style = "fg:#e3e5e5 bg:#769ff0" -format = "[ $path ]($style)" -truncation_length = 3 -truncation_symbol = "…/" - -[directory.substitutions] -"Documents" = "σ°ˆ™ " -"Downloads" = "ο€™ " -"Music" = " " -"Pictures" = "ο€Ύ " - -[git_branch] -symbol = "" -style = "bg:#394260" -format = '[[ $symbol $branch ](fg:#769ff0 bg:#394260)]($style)' - -[git_status] -style = "bg:#394260" -format = '[[($all_status$ahead_behind )](fg:#769ff0 bg:#394260)]($style)' - -[nodejs] -symbol = "" -style = "bg:#212736" -format = '[[ $symbol ($version) ](fg:#769ff0 bg:#212736)]($style)' - -[rust] -symbol = "" -style = "bg:#212736" -format = '[[ $symbol ($version) ](fg:#769ff0 bg:#212736)]($style)' - -[golang] -symbol = "" -style = "bg:#212736" -format = '[[ $symbol ($version) ](fg:#769ff0 bg:#212736)]($style)' - -[time] -disabled = false -time_format = "%R" # Hour:Minute Format -style = "bg:#1d2230" -format = '[[  $time ](fg:#a0a9cb bg:#1d2230)]($style)' - -[cmd_duration] -min_time = 500 # milliseconds -# nerd font version: -format = 'prev: [[ ο‰’ $duration ](fg:#a0a9cb bg:#1d2230)]($style)' -# General UNICODE font version: -# format = '[[ β§— $duration ](fg:#a0a9cb bg:#1d2230)]($style)' -# Emoji version: -# format = '[[ βŒ› $duration ](fg:#a0a9cb bg:#1d2230)]($style)' - -[status] -disabled = false - -[character] -disabled = false - diff --git a/_home/private_dot_config/starship.toml b/_home/private_dot_config/starship.toml new file mode 120000 index 0000000..074c848 --- /dev/null +++ b/_home/private_dot_config/starship.toml @@ -0,0 +1 @@ +../../_src.posix/private_dot_config/starship.toml \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env b/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env deleted file mode 100644 index 6e83c75..0000000 --- a/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -if [[ ! "$-" =~ i ]]; then - LOAD_EXIT=1 - echo "Non interactive session ($-) , stopping load of shell environment" 1>&2 -else - reset -fi diff --git a/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env b/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env new file mode 120000 index 0000000..117cb13 --- /dev/null +++ b/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/ID_truenas_scale.env b/_home/private_dot_config/sz.env/ID_truenas_scale.env deleted file mode 100644 index 8aa90e1..0000000 --- a/_home/private_dot_config/sz.env/ID_truenas_scale.env +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -function is_truenas() { - local TRUENAS_TARGET="truenas.target" - [ "$(systemctl get-default)" = "$TRUENAS_TARGET" ] \ - && [ "$(systemctl is-active "$TRUENAS_TARGET")" = "active" ] -} - diff --git a/_home/private_dot_config/sz.env/ID_truenas_scale.env b/_home/private_dot_config/sz.env/ID_truenas_scale.env new file mode 120000 index 0000000..9839390 --- /dev/null +++ b/_home/private_dot_config/sz.env/ID_truenas_scale.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/ID_truenas_scale.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/PATH_home_bin.env b/_home/private_dot_config/sz.env/PATH_home_bin.env deleted file mode 100644 index 72f28fd..0000000 --- a/_home/private_dot_config/sz.env/PATH_home_bin.env +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -PATH="$HOME/bin:$PATH" -PATH="$HOME/.local/bin:$PATH" diff --git a/_home/private_dot_config/sz.env/PATH_home_bin.env b/_home/private_dot_config/sz.env/PATH_home_bin.env new file mode 120000 index 0000000..f6f9878 --- /dev/null +++ b/_home/private_dot_config/sz.env/PATH_home_bin.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/PATH_home_bin.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/PATH_node.env b/_home/private_dot_config/sz.env/PATH_node.env deleted file mode 100644 index 2c440cb..0000000 --- a/_home/private_dot_config/sz.env/PATH_node.env +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -export PATH="$HOME/.local/opt/node/bin:$PATH" diff --git a/_home/private_dot_config/sz.env/PATH_node.env b/_home/private_dot_config/sz.env/PATH_node.env new file mode 120000 index 0000000..06b67f6 --- /dev/null +++ b/_home/private_dot_config/sz.env/PATH_node.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/PATH_node.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/PATH_truestuff.env b/_home/private_dot_config/sz.env/PATH_truestuff.env deleted file mode 100644 index 0095c06..0000000 --- a/_home/private_dot_config/sz.env/PATH_truestuff.env +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -if is_cmd midclt && [ -z "$SCALE_POOL" ]; then - export SCALE_POOL=szmedia - - export SCALE_POOL="$(midclt call "kubernetes.config" 2>/dev/null | jq -r '.pool')" - [ -n "$SCALE_POOL" ] && [ "$SCALE_POOL" != "null" ] || export SCALE_POOL="$(midclt call "pool.query" 2>/dev/null | jq -r '.[0].name')" - [ -d "/mnt/$SCALE_POOL" ] || unset SCALE_POOL -fi - -[ -n "$SCALE_POOL" ] \ -&& export SCALE_POOL_ROOT=/mnt/$SCALE_POOL \ -&& PATH="$SCALE_POOL_ROOT/_apps.data/_scripts/truestuff:$PATH" \ -&& PATH="$SCALE_POOL_ROOT/data/scripts/truestuff:$PATH" \ -&& export PATH - diff --git a/_home/private_dot_config/sz.env/PATH_truestuff.env b/_home/private_dot_config/sz.env/PATH_truestuff.env new file mode 120000 index 0000000..62bc4e1 --- /dev/null +++ b/_home/private_dot_config/sz.env/PATH_truestuff.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/PATH_truestuff.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/PATH_zz_cleanup.env b/_home/private_dot_config/sz.env/PATH_zz_cleanup.env deleted file mode 100644 index 7556855..0000000 --- a/_home/private_dot_config/sz.env/PATH_zz_cleanup.env +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env -S sh -c 'echo "Not a user script. source(aka .) only"' - -# Remove duplicates from PATH -OLDPATH="$PATH"; NEWPATH=""; colon="" -while [ "${OLDPATH#*:}" != "$OLDPATH" ]; do - entry="${OLDPATH%%:*}"; search=":${OLDPATH#*:}:" - [ "${search#*:"$entry":}" = "$search" ] && [[ -d $entry ]] && NEWPATH="$NEWPATH$colon$entry" && colon=: - OLDPATH="${OLDPATH#*:}" -done -NEWPATH="$NEWPATH:$OLDPATH" -export PATH="$NEWPATH" -unset NEWPATH OLDPATH colon entry search - -[[ -n "${DBG}" ]] && echo "${PATH//:/\n}" - diff --git a/_home/private_dot_config/sz.env/PATH_zz_cleanup.env b/_home/private_dot_config/sz.env/PATH_zz_cleanup.env new file mode 120000 index 0000000..bd30077 --- /dev/null +++ b/_home/private_dot_config/sz.env/PATH_zz_cleanup.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/PATH_zz_cleanup.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/aaa_zsh_0_perp.env b/_home/private_dot_config/sz.env/aaa_zsh_0_perp.env deleted file mode 100644 index be73805..0000000 --- a/_home/private_dot_config/sz.env/aaa_zsh_0_perp.env +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"' - -BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} - -if [[ "${BASE_SHELL}" == "zsh" ]]; then - - [ -z "$ZSH_CACHE_DIR" ] && export ZSH_CACHE_DIR=$HOME/.cache/zsh - mkdir -p $ZSH_CACHE_DIR/completions - mkdir -p "$HOME/.local/share/zsh/completions" - - # Remove duplicates from fpath, and add local completion dir - fpath=( $( - for d in $( - awk '!seen[$0]++' <( - echo "$HOME/.local/share/zsh/completions" - printf '%s\n' $fpath - ) - ); do - [ -d "$d" ] && echo "$d" - done - ) ) - - skip_global_compinit=1 - - # # Jump to the bottom of the screen - # SZ_TPUT_END=$(tput cup 9999 0) - # echo $SZ_TPUT_END - - PS1="$(zsh -c '. <(cat /etc/*-release | uniq -u); echo "$NAME $VERSION_ID "')| ZSH ${ZSH_VERSION} LOADING >" - - #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - #""" Shell Settings """ - #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - typeset -g HISTFILE="$HOME/.zsh_history" - typeset -g HISTSIZE=1000000 - typeset -g SAVEHIST=$HISTSIZE - typeset -g COMPLETION_WAITING_DOTS="true" - setopt hist_ignore_dups # ignore duplicated commands history list - export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES # fix "+[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called" issue - - ##################### - # SETOPT # - ##################### - setopt promptsubst - setopt extended_history # record timestamp of command in HISTFILE - setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE - setopt hist_ignore_all_dups # ignore duplicated commands history list - setopt hist_ignore_space # ignore commands that start with space - setopt hist_verify # show command with history expansion to user before running it - setopt inc_append_history # add commands to HISTFILE in order of execution - setopt share_history # share command history data - setopt always_to_end # cursor moved to the end in full completion - setopt hash_list_all # hash everything before completion - setopt nocompletealiases # no complete alisases - no need for specific compdef for aliases - setopt always_to_end # when completing from the middle of a word, move the cursor to the end of the word - setopt complete_in_word # allow completion from within a word/phrase - setopt nocorrect # spelling correction for commands - setopt list_ambiguous # complete as much of a completion until it gets ambiguous. - setopt auto_cd # changing directories without cd - setopt nolisttypes - setopt listpacked - setopt automenu - setopt vi - - [[ -n "${DBG}" ]] && echo "ZSH preped" -fi - diff --git a/_home/private_dot_config/sz.env/aaa_zsh_0_perp.env b/_home/private_dot_config/sz.env/aaa_zsh_0_perp.env new file mode 120000 index 0000000..9ad1a34 --- /dev/null +++ b/_home/private_dot_config/sz.env/aaa_zsh_0_perp.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/aaa_zsh_0_perp.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/aaa_zsh_2_zinit.env b/_home/private_dot_config/sz.env/aaa_zsh_2_zinit.env deleted file mode 100644 index 6024fa0..0000000 --- a/_home/private_dot_config/sz.env/aaa_zsh_2_zinit.env +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"' - -BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} - -if [[ "${BASE_SHELL}" == "zsh" ]]; then - # true = install zdharma-continuum/zinit - # false = install z-shell/zi - - if false; then - # Auto install zdharma-continuum/zinit - ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/bin" - if [[ ! -d "$ZINIT_HOME/.git" ]]; then - print -P "%F{33}β–“β–’β–‘ %F{220}Installing DHARMA Initiative Plugin Manager (zdharma-continuum/zinit)…%f" - command mkdir -p "$(dirname "$ZINIT_HOME")" \ - && command chmod go-rwX "$(dirname "$ZINIT_HOME")" - command git clone -q --depth=1 --branch "main" \ - https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" \ - && print -P "%F{33}β–“β–’β–‘ %F{34}Installation successful.%f%b" \ - || print -P "%F{160}β–“β–’β–‘ The clone has failed.%f%b" - fi - source "${ZINIT_HOME}/zinit.zsh" - - autoload -Uz _zinit - (( ${+_comps} )) && _comps[zinit]=_zinit - ### End of Zinit installer's chunk - alias zi='zinit ' - - [[ -n "${DBG}" ]] && echo "zinit ready" - else - #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - #""" z-shell/zi """ - #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - # - # ### Added by z-shell/zi's installer - ZI_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zi/bin" - mkdir -p "$(dirname "$ZI_HOME")" - if [[ ! -d "$ZI_HOME/.git" ]]; then - print -P "%F{33}β–“β–’β–‘ %F{160}Installing (%F{33}z-shell/zi%F{160})…%f" - command mkdir -p "$(dirname "$ZINIT_HOME")" \ - && command chmod go-rwX "$(dirname "$ZI_HOME")" - command git clone -q --depth=1 --branch "main" \ - https://github.com/z-shell/zi.git "$ZI_HOME" \ - && print -P "%F{33}β–“β–’β–‘ %F{34}Installation successful.%f%b" \ - || print -P "%F{160}β–“β–’β–‘ The clone has failed.%f%b" - fi - source "${ZI_HOME}/zi.zsh" - autoload -Uz _zi - (( ${+_comps} )) && _comps[zi]=_zi - # examples here -> https://wiki.zshell.dev/ecosystem/category/-annexes - zicompinit # <- https://wiki.zshell.dev/docs/guides/commands - ### End of z-shell/zi installer's chunk - alias zinit=zi - - [[ -n "${DBG}" ]] && echo "zi ready" - fi - -fi - diff --git a/_home/private_dot_config/sz.env/aaa_zsh_2_zinit.env b/_home/private_dot_config/sz.env/aaa_zsh_2_zinit.env new file mode 120000 index 0000000..089a0d8 --- /dev/null +++ b/_home/private_dot_config/sz.env/aaa_zsh_2_zinit.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/aaa_zsh_2_zinit.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/aaa_zsh_3_completion_system.env b/_home/private_dot_config/sz.env/aaa_zsh_3_completion_system.env deleted file mode 100644 index 714e502..0000000 --- a/_home/private_dot_config/sz.env/aaa_zsh_3_completion_system.env +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"' - -BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} - -if [[ "${BASE_SHELL}" == "zsh" ]]; then - autoload -Uz +X compinit bashcompinit && compinit && bashcompinit - - zstyle ':completion:*' menu yes select -fi - diff --git a/_home/private_dot_config/sz.env/aaa_zsh_3_completion_system.env b/_home/private_dot_config/sz.env/aaa_zsh_3_completion_system.env new file mode 120000 index 0000000..dbe81b1 --- /dev/null +++ b/_home/private_dot_config/sz.env/aaa_zsh_3_completion_system.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/aaa_zsh_3_completion_system.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/aab_zellij.env b/_home/private_dot_config/sz.env/aab_zellij.env deleted file mode 100644 index 32d2119..0000000 --- a/_home/private_dot_config/sz.env/aab_zellij.env +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -if is_cmd load-zellij; then - # zellij will need to allow reload of the enviornment - [[ -z "$ZELLIJ_SESSION_NAME" ]] && unset SZ_ENV_LOADED - . <( load-zellij - ) - [[ -z "$ZELLIJ_SESSION_NAME" ]] && SZ_ENV_LOADED=1 -fi diff --git a/_home/private_dot_config/sz.env/aab_zellij.env b/_home/private_dot_config/sz.env/aab_zellij.env new file mode 120000 index 0000000..6472cc8 --- /dev/null +++ b/_home/private_dot_config/sz.env/aab_zellij.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/aab_zellij.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/aliases.env b/_home/private_dot_config/sz.env/aliases.env deleted file mode 100644 index deab518..0000000 --- a/_home/private_dot_config/sz.env/aliases.env +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -alias l='ls -lahF --color=auto --group-directories-first ' -alias lu='l -U ' -alias lold='l --sort=time ' -alias lnew='l --sort=time --reverse ' -alias ll='l -A' - -alias sudo='sudo ' diff --git a/_home/private_dot_config/sz.env/aliases.env b/_home/private_dot_config/sz.env/aliases.env new file mode 120000 index 0000000..1807a3a --- /dev/null +++ b/_home/private_dot_config/sz.env/aliases.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/aliases.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/bbb_bash_preexec.env b/_home/private_dot_config/sz.env/bbb_bash_preexec.env deleted file mode 100644 index bde5808..0000000 --- a/_home/private_dot_config/sz.env/bbb_bash_preexec.env +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} - -if [[ "${BASE_SHELL}" == "bash" ]]; then - update-bash-preexec() { - local workdir="$SZ_ENV_ROOT/lib/bash-preexec" - [ -d "$workdir" ] && rm -fR "$workdir" - mkdir -p "$workdir" - - cd "$workdir" - - # Pull down our file from GitHub and write it to your home directory as a hidden file. - curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ./bash-preexec.sh - # Source our file to bring it into our environment - source .bash-preexec.sh - - source "$workdir/ble-nightly/ble.sh" - } - - # shellcheck disable=SC1091 source=$HOME/.bash-preexec.sh - if [[ -f "$SZ_ENV_ROOT/lib/bash-preexec/.bash-preexec.sh" ]]; then - SZ_ENV_BASH_LOAD_PREEXEC='. "$SZ_ENV_ROOT/lib/bash-preexec/.bash-preexec.sh"' - - [[ -n "${DBG}" ]] && echo "Bash-preexec will be loaded." - fi -fi - diff --git a/_home/private_dot_config/sz.env/bbb_bash_preexec.env b/_home/private_dot_config/sz.env/bbb_bash_preexec.env new file mode 120000 index 0000000..b13a0db --- /dev/null +++ b/_home/private_dot_config/sz.env/bbb_bash_preexec.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/bbb_bash_preexec.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/bbb_ble.sh.env b/_home/private_dot_config/sz.env/bbb_ble.sh.env deleted file mode 100644 index 7c2e99e..0000000 --- a/_home/private_dot_config/sz.env/bbb_ble.sh.env +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} - -if [[ "${BASE_SHELL}" == "bash" ]]; then - update-ble.sh() { - [[ -n "${DBG}" ]] && set -x - local workdir="$SZ_ENV_ROOT/lib/ble.sh.curl" - [ -d "$workdir" ] && rm -fR "$workdir" - mkdir -p "$workdir" - - cd "$workdir" - curl -L https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - - - source "$workdir/ble-nightly/ble.sh" - [[ -n "${DBG}" ]] && set +x - } - if [ -f "$SZ_ENV_ROOT/lib/ble.sh.curl/ble-nightly/ble.sh" ]; then - source "$SZ_ENV_ROOT/lib/ble.sh.curl/ble-nightly/ble.sh" --noattach - fi - - if [[ -n "${DBG}" && -n "${BLE_VERSION-}" ]]; then - echo "ble.sh will be loaded." - fi -fi - diff --git a/_home/private_dot_config/sz.env/bbb_ble.sh.env b/_home/private_dot_config/sz.env/bbb_ble.sh.env new file mode 120000 index 0000000..75fb560 --- /dev/null +++ b/_home/private_dot_config/sz.env/bbb_ble.sh.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/bbb_ble.sh.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/broot.env b/_home/private_dot_config/sz.env/broot.env deleted file mode 100644 index 8919977..0000000 --- a/_home/private_dot_config/sz.env/broot.env +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -if is_cmd broot; then - source /mnt/szmedia/USERDATA/home/sz/.config/broot/launcher/bash/br -fi - diff --git a/_home/private_dot_config/sz.env/broot.env b/_home/private_dot_config/sz.env/broot.env new file mode 120000 index 0000000..b2316c2 --- /dev/null +++ b/_home/private_dot_config/sz.env/broot.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/broot.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/envman-and-webi.env b/_home/private_dot_config/sz.env/envman-and-webi.env deleted file mode 100644 index f59d5de..0000000 --- a/_home/private_dot_config/sz.env/envman-and-webi.env +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -export ENVMAN_LOAD='' - -if [ -s "$HOME/.config/envman/load.sh" ]; then - [[ -n "${DBG}" ]] && echo "Loading envman" - source "$HOME/.config/envman/load.sh" - - [[ -n "${DBG}" ]] && echo "${PATH//:/\n}" -fi - -if is_cmd webi; then - . <(webi --init "${SHELL##*/}") -fi - diff --git a/_home/private_dot_config/sz.env/envman-and-webi.env b/_home/private_dot_config/sz.env/envman-and-webi.env new file mode 120000 index 0000000..bc3184a --- /dev/null +++ b/_home/private_dot_config/sz.env/envman-and-webi.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/envman-and-webi.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/executable__.load.sh b/_home/private_dot_config/sz.env/executable__.load.sh deleted file mode 100644 index b1c95bd..0000000 --- a/_home/private_dot_config/sz.env/executable__.load.sh +++ /dev/null @@ -1,89 +0,0 @@ -#! /usr/bin/env bash - -# Helper function -is_sourced() { - if [ -n "$ZSH_VERSION" ]; then - case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac - else # Add additional POSIX-compatible shell names here, if needed. - case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac - fi - return 1; # NOT sourced. -} - -BASE_0=${BASE_0:-$0} -BASE_SHELL=$(basename "$SHELL") - -is_cmd() { -type -- "${@}" 2> /dev/null 1> /dev/null -} - -if is_sourced; then - # shellcheck disable=SC2139 # This expands when defined, not when used. - alias _r="unset DBG; exec $SHELL -l " - # shellcheck disable=SC2139 # This expands when defined, not when used. - alias _rdbg="exec sh -c 'DBG=1 $SHELL -l '" - - SZ_ENV_ROOT=$( cd -- "$( dirname -- "${BASE_0}" )" &> /dev/null && pwd ) - USER_HOME=$HOME - [[ -n "${SUDO_USER}" ]] && USER_HOME="$(eval "echo ~${SUDO_USER}")" - - load_next() { - [ "$LOAD_EXIT" != "0" ] && return 1 - - if [[ -n "${DBG}" ]]; then - echo "Loading ${1}..." 1>&2 - #shellcheck disable=SC2086 - ${DBG/%1/:} 1>&2 - fi - #shellcheck source=/dev/null - . "${1}" - } - - load_all() { - local ALL_ENV_FILES - if [ -z "$SZ_ENV_LOADED" ]; then - SZ_ENV_LOADED=1 - LOAD_EXIT=0 - - # The following constructs a list of load_next ... commands - ALL_ENV_FILES="$( - find ~/.config/sz.env -xdev -type d -not -name '*.off' \ - -exec sh -c ' - find "$1" -xdev -maxdepth 1 -type f -name "ID_*.env" | sort - ' shell '{}' ';' \ - -exec sh -c ' - find "$1" -xdev -maxdepth 1 -type f -name "PATH_*.env" | sort - ' shell '{}' ';' \ - -exec sh -c ' - find "$1" -xdev -maxdepth 1 -type f -name "*.env" -not -name "ID_*" -not -name "PATH_*" -print | sort - ' shell '{}' ';' \ - -exec sh -c ' - find "$1" -xdev -maxdepth 1 -type f -name "PATH_zz_cleanup.env" - ' shell '{}' ';' \ - | sed -e 's/^/load_next "/; s/$/";/' - )" - if [ -n "$DBG_NO_SZ_LOAD" ]; then - ALL_ENV_FILES=$(<<<"$ALL_ENV_FILES" sed -Ee ' - /PATH_/!s/^(load_next )/# \1/ - ') - printf 'Loading limited environment...\n' - fi - # Run the constructed (see above) list - eval "$ALL_ENV_FILES" - fi - } - load_all -elif [[ "$1" == '-' ]]; then - echo "BASE_0=${BASE_0}" - cat "${0}" -else - is_cmd "${BASE_0##*/}" && SCRIPT_NAME="${BASE_0##*/}" || SCRIPT_NAME="${BASE_0/$HOME/\~}" - printf '%s\n' \ - "It seems '$SCRIPT_NAME' was invoked as a standalone script." \ - 'This script is designed to produce output that is sourced.' \ - '' \ - 'The recommended way is to use calling pattern below:' \ - " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ - '' -fi - diff --git a/_home/private_dot_config/sz.env/executable__.load.sh b/_home/private_dot_config/sz.env/executable__.load.sh new file mode 120000 index 0000000..7e4dc65 --- /dev/null +++ b/_home/private_dot_config/sz.env/executable__.load.sh @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/executable__.load.sh \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/fix-kubectl.env b/_home/private_dot_config/sz.env/fix-kubectl.env deleted file mode 100644 index 88adcd6..0000000 --- a/_home/private_dot_config/sz.env/fix-kubectl.env +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -if is_cmd szetup-kubectl4k3s && [ "$(systemctl is-active k3s.service)" = "active" ]; then - . <( szetup-kubectl4k3s - ) - - [[ -n "${DBG}" ]] && echo "kubectl for k3s setup complete." -fi diff --git a/_home/private_dot_config/sz.env/fix-kubectl.env b/_home/private_dot_config/sz.env/fix-kubectl.env new file mode 120000 index 0000000..2f5b699 --- /dev/null +++ b/_home/private_dot_config/sz.env/fix-kubectl.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/fix-kubectl.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/fix-nvim.env b/_home/private_dot_config/sz.env/fix-nvim.env deleted file mode 100644 index 4f2bb96..0000000 --- a/_home/private_dot_config/sz.env/fix-nvim.env +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -if [[ -x "${CUSTOM_NVIM_PATH:-$HOME/.local/bin/nvim}" ]]; then - fix_nvim () { - CUSTOM_NVIM_PATH="${CUSTOM_NVIM_PATH:-$HOME/.local/bin/nvim}" - printf '%s\n' \ - "update-alternatives --install /usr/bin/editor editor '${CUSTOM_NVIM_PATH}' 110" \ - "update-alternatives --install /usr/bin/edit edit '${CUSTOM_NVIM_PATH}' 110" \ - "update-alternatives --install /usr/bin/ex ex '${CUSTOM_NVIM_PATH}' 110" \ - "update-alternatives --install /usr/bin/vi vi '${CUSTOM_NVIM_PATH}' 110" \ - "update-alternatives --install /usr/bin/view view '${CUSTOM_NVIM_PATH}' 110" \ - "update-alternatives --install /usr/bin/vim vim '${CUSTOM_NVIM_PATH}' 110" \ - "update-alternatives --install /usr/bin/vimdiff vimdiff '${CUSTOM_NVIM_PATH}' 110" \ - "update-alternatives --set editor '${CUSTOM_NVIM_PATH}'" \ - "update-alternatives --set edit '${CUSTOM_NVIM_PATH}'" \ - "update-alternatives --set ex '${CUSTOM_NVIM_PATH}'" \ - "update-alternatives --set vi '${CUSTOM_NVIM_PATH}'" \ - "update-alternatives --set view '${CUSTOM_NVIM_PATH}'" \ - "update-alternatives --set vim '${CUSTOM_NVIM_PATH}'" \ - "update-alternatives --set vimdiff '${CUSTOM_NVIM_PATH}'" - } -fi diff --git a/_home/private_dot_config/sz.env/fix-nvim.env b/_home/private_dot_config/sz.env/fix-nvim.env new file mode 120000 index 0000000..4f47730 --- /dev/null +++ b/_home/private_dot_config/sz.env/fix-nvim.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/fix-nvim.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/truenas-scale.env b/_home/private_dot_config/sz.env/truenas-scale.env deleted file mode 100644 index 1ca907a..0000000 --- a/_home/private_dot_config/sz.env/truenas-scale.env +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -if is_cmd midclt; then - if [ -n "$SCALE_POOL_ROOT" ]; then - if [ -e "$SCALE_POOL_ROOT/jailmaker/jlmkr.py" ]; then - #alias jlmkr="bash -c '_jlmkr() { $SCALE_POOL_ROOT/jailmaker/jlmkr.py \${@:---help}; }; _jlmkr \$@' " - function jlmkr() { sudo VISUAL="${VISUAL:-}" EDITOR="${EDITOR:-}" $SCALE_POOL_ROOT/jailmaker/jlmkr.py "${@:---help}"; } - - jlmkr-zellij() { - zellij action go-to-tab-name --create "jailmkr" - zellij action new-pane --name "${1:?must pass jail name}@jlmkr" -- sh -ci "reset; sudo $SCALE_POOL_ROOT/jailmaker/jlmkr.py shell --uid ${UID} ${1}" - zellij action focus-previous-pane - zellij action close-pane - } - - fi - fi -fi - diff --git a/_home/private_dot_config/sz.env/truenas-scale.env b/_home/private_dot_config/sz.env/truenas-scale.env new file mode 120000 index 0000000..001f9a6 --- /dev/null +++ b/_home/private_dot_config/sz.env/truenas-scale.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/truenas-scale.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/zza_atuin.env b/_home/private_dot_config/sz.env/zza_atuin.env deleted file mode 100644 index 03c93ca..0000000 --- a/_home/private_dot_config/sz.env/zza_atuin.env +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} - -if is_cmd atuin; then - if [[ "${BASE_SHELL}" == "bash" ]] && ! [[ -n "$SZ_ENV_BASH_LOAD_PREEXEC$BLE_VERSION" ]]; then - printf '%s\n' \ - 'atuin was found, but bash-preexec or ble.sh are not loaded,' \ - 'to load atuin, first run update-ble.sh or update-bash-preexec ' \ - 'then relaod (_r) the shell.' - fi - - . <( atuin init "${BASE_SHELL}" ) - . <( atuin gen-completions --shell ${BASE_SHELL} ) - - [[ -n "${DBG}" ]] && echo "atuin loaded." -fi diff --git a/_home/private_dot_config/sz.env/zza_atuin.env b/_home/private_dot_config/sz.env/zza_atuin.env new file mode 120000 index 0000000..12dba93 --- /dev/null +++ b/_home/private_dot_config/sz.env/zza_atuin.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zza_atuin.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/zza_starship.env b/_home/private_dot_config/sz.env/zza_starship.env deleted file mode 100644 index 83653e8..0000000 --- a/_home/private_dot_config/sz.env/zza_starship.env +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -if is_cmd load-starship; then - . <( load-starship - ) - [[ -n "${DBG}" ]] && echo "starship loaded." -elif [[ -n "${DBG}" ]]; then - >&2 printf '%s\n' \ - 'starship is not installed, you can install by running:' \ - '\tcurl -sS https://starship.rs/install.sh | FORCE=1 BIN_DIR=$HOME/bin sh > /dev/null' \ - '' - -fi - diff --git a/_home/private_dot_config/sz.env/zza_starship.env b/_home/private_dot_config/sz.env/zza_starship.env new file mode 120000 index 0000000..2a51f2d --- /dev/null +++ b/_home/private_dot_config/sz.env/zza_starship.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zza_starship.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/zzz_bash_post.env b/_home/private_dot_config/sz.env/zzz_bash_post.env deleted file mode 100644 index 9139b36..0000000 --- a/_home/private_dot_config/sz.env/zzz_bash_post.env +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} - -if [[ "${BASE_SHELL}" == "bash" ]]; then - eval "${SZ_ENV_BASH_LOAD_PREEXEC}" - if [[ -n "${BLE_VERSION-}" ]]; then - [[ -n "${DBG}" ]] && echo "attaching ble.sh" - ble-attach - fi -fi - diff --git a/_home/private_dot_config/sz.env/zzz_bash_post.env b/_home/private_dot_config/sz.env/zzz_bash_post.env new file mode 120000 index 0000000..227f00e --- /dev/null +++ b/_home/private_dot_config/sz.env/zzz_bash_post.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zzz_bash_post.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/zzz_chezmoi.env b/_home/private_dot_config/sz.env/zzz_chezmoi.env deleted file mode 100644 index 1aa08ae..0000000 --- a/_home/private_dot_config/sz.env/zzz_chezmoi.env +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' -# shellcheck disable=SC1090 - -if is_cmd 'chezmoi'; then - alias cz="chezmoi " - eval "$( chezmoi completion "${SHELL##*/}" | sed -Ee 's/(complete -o default .* chezmoi)/\1 cz/' )" - - czcd() { - cd "$(chezmoi source-path "${@}")" - } -fi diff --git a/_home/private_dot_config/sz.env/zzz_chezmoi.env b/_home/private_dot_config/sz.env/zzz_chezmoi.env new file mode 120000 index 0000000..fb97cec --- /dev/null +++ b/_home/private_dot_config/sz.env/zzz_chezmoi.env @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zzz_chezmoi.env \ No newline at end of file diff --git a/_home/private_dot_config/sz.env/zzz_fzf.env.off b/_home/private_dot_config/sz.env/zzz_fzf.env.off deleted file mode 100644 index 71b9b42..0000000 --- a/_home/private_dot_config/sz.env/zzz_fzf.env.off +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' - -if ! is_cmd atuin && is_cmd load-fzf; then - . <( load-fzf - ) -fi diff --git a/_home/private_dot_config/sz.env/zzz_fzf.env.off b/_home/private_dot_config/sz.env/zzz_fzf.env.off new file mode 120000 index 0000000..1db551d --- /dev/null +++ b/_home/private_dot_config/sz.env/zzz_fzf.env.off @@ -0,0 +1 @@ +../../../_src.posix/private_dot_config/sz.env/zzz_fzf.env.off \ No newline at end of file diff --git a/_home/private_dot_local/bin/executable_get-github-release.sh b/_home/private_dot_local/bin/executable_get-github-release.sh deleted file mode 100644 index dd16b97..0000000 --- a/_home/private_dot_local/bin/executable_get-github-release.sh +++ /dev/null @@ -1,20 +0,0 @@ -#! /usr/bin/env bash - -GH_PROJECT="${1}" -GH_DL_TAG="${2:-latest}" -GH_FILTER="${3:-deb}" -if [[ ! "$GH_FILTER" =~ '(' ]]; then - GH_FILTER="contains(\"${GH_FILTER}\")" -fi -SRC_URL=https://api.github.com/repos/${GH_PROJECT}/releases/${GH_DL_TAG} -DL_URL=$( \ - curl -sL curl ${SRC_URL} \ - | jq -r " \ - .assets[] \ - | select(.browser_download_url \ - | ${GH_FILTER} ) \ - | .browser_download_url \ - ") -[[ -n "$DL_URL" ]] \ - && printf "%s\n" $DL_URL \ - || return 1 2>/dev/null || exit 1 diff --git a/_home/private_dot_local/bin/executable_get-github-release.sh b/_home/private_dot_local/bin/executable_get-github-release.sh new file mode 120000 index 0000000..8166e11 --- /dev/null +++ b/_home/private_dot_local/bin/executable_get-github-release.sh @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_get-github-release.sh \ No newline at end of file diff --git a/_home/private_dot_local/bin/executable_load-starship b/_home/private_dot_local/bin/executable_load-starship deleted file mode 100644 index 43487ea..0000000 --- a/_home/private_dot_local/bin/executable_load-starship +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env bash - -# Helper function -is_sourced() { - if [ -n "$ZSH_VERSION" ]; then - case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac - else # Add additional POSIX-compatible shell names here, if needed. - case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac - fi - return 1; # NOT sourced. -} - -BASE_0=${BASE_0:-$0} -BASE_SHELL=$(basename "$SHELL") - -if is_sourced; then - starship() { - if [[ ! -x "$HOME/bin/starship" ]]; then - curl -sS https://starship.rs/install.sh | FORCE=1 BIN_DIR="$HOME/bin" sh > /dev/null - fi - "$HOME/bin/starship" "${@}" - } - # shellcheck disable=SC1090 - . <( starship init "$BASE_SHELL" ) 2> /dev/null - . <( starship completions ${BASE_SHELL} ) 2> /dev/null - -elif [[ "$1" == '-' ]]; then - echo "BASE_0=${BASE_0}" - cat "${0}" -else - SCRIPT_NAME="$BASE_0" - printf '%s\n' \ - "It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \ - 'The easiest way is to call it like this:' \ - " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ - '' -fi - diff --git a/_home/private_dot_local/bin/executable_load-starship b/_home/private_dot_local/bin/executable_load-starship new file mode 120000 index 0000000..22d7305 --- /dev/null +++ b/_home/private_dot_local/bin/executable_load-starship @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_load-starship \ No newline at end of file diff --git a/_home/private_dot_local/bin/executable_load-webi b/_home/private_dot_local/bin/executable_load-webi deleted file mode 100644 index 32e58fd..0000000 --- a/_home/private_dot_local/bin/executable_load-webi +++ /dev/null @@ -1,40 +0,0 @@ -#! /usr/bin/env bash - -# Helper function -is_sourced() { - if [ -n "$ZSH_VERSION" ]; then - case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac - else # Add additional POSIX-compatible shell names here, if needed. - case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac - fi - return 1; # NOT sourced. -} - -BASE_0=${BASE_0:-$0} -BASE_SHELL=$(basename "$SHELL") - -if is_sourced; then - webi() { - if [[ ! -x "${HOME}/.local/bin/webi" ]]; then - printf '%s\n' \ - "webi isn't installed, install by running:" \ - " curl -sS https://webi.sh/webi | sh" - return - fi - ${HOME}/.local/bin/webi "${@}" - } - if is_cmd webi; then - webi - fi - -elif [[ "$1" == '-' ]]; then - cat "${BASH_SOURCE[0]}" -else - SCRIPT_NAME="$BASE_0" - printf '%s\n' \ - "It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \ - 'The easiest way is to call it like this:' \ - " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ - '' -fi - diff --git a/_home/private_dot_local/bin/executable_load-webi b/_home/private_dot_local/bin/executable_load-webi new file mode 120000 index 0000000..7e8ee5b --- /dev/null +++ b/_home/private_dot_local/bin/executable_load-webi @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_load-webi \ No newline at end of file diff --git a/_home/private_dot_local/bin/executable_load-zellij b/_home/private_dot_local/bin/executable_load-zellij deleted file mode 100644 index 6b2428b..0000000 --- a/_home/private_dot_local/bin/executable_load-zellij +++ /dev/null @@ -1,79 +0,0 @@ -#! /usr/bin/env bash - -# Helper function -is_sourced() { - if [ -n "$ZSH_VERSION" ]; then - case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac - else # Add additional POSIX-compatible shell names here, if needed. - case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac - fi - return 1; # NOT sourced. -} - -BASE_0=${BASE_0:-$0} -BASE_SHELL=$(basename "$SHELL") - -if is_sourced; then - zellij-cleanup() { - env which zellij > /dev/null && env which zellij | grep -E "^$HOME" | ${SUDO:-} xargs -tr rm - [[ -d "$HOME/.cache/zellij" ]] && echo "$HOME/.cache/zellij" | ${SUDO:-} xargs -tr rm -fR - find /tmp -maxdepth 1 -mindepth 1 -type d -name 'zellij*' -print0 | ${SUDO:-} xargs -r0t rm -fR - if [[ -d "$HOME/.cache/zellij" ]]; then - printf 'Zellij cleanup failed to remove the cache directory, you might still have a zellij session active.\n' - else - printf 'Zellij has been cleaned up, you can now reinstall it.\n' - unset zellij-cleanup - fi - } - refresh-zellij() { -${SET:-:} -x - if [ -z "$(env which zellij)" ] && ! [ -x ~/.local/bin/zellij ]; then - if [[ ! -r /tmp/zellij/bootstrap/zellij ]]; then - printf "Grabbing zellij from the web!\n" - bash <(curl -sL zellij.dev/launch) "--help" > /dev/null 2>&1 || true - fi - if [[ -r /tmp/zellij/bootstrap/zellij ]]; then - mv /tmp/zellij/bootstrap/zellij ~/.local/bin/zellij - rm -fR /tmp/zellij - fi - fi - refresh-zellij() { :; } - } - zellij() { - refresh-zellij - if [[ $# -eq 0 ]]; then - env zellij attach -c $USER@$(hostname) - else - env zellij "${@}" - fi - } - zellij-completion() { - if [[ "${BASE_SHELL}" == "zsh" ]]; then - type _zellij > /dev/null \ - || . <( env zellij setup --generate-completion zsh | sed -Ee 's/^(_(zellij) ).*/compdef \1\2/' ) - else - . <( env zellij setup --generate-completion "$BASE_SHELL" ) - fi - } -${SET:-:} -x - if [[ -n "$(env which zellij)" ]]; then - zellij-completion - fi -${SET:-:} -x - # Was needed when zsh would load - # . <( zellij setup --generate-completion "$BASE_SHELL" | sed -ne '/^function/,$p' ) - if [[ -z "$ZELLIJ_SESSION_NAME" ]]; then - zellij attach -c $USER@$(hostname) - fi - -elif [[ "$1" == '-' ]]; then - cat "${BASH_SOURCE[0]}" -else - SCRIPT_NAME="$BASE_0" - printf '%s\n' \ - "It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \ - 'The easiest way is to call it like this:' \ - " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ - '' -fi - diff --git a/_home/private_dot_local/bin/executable_load-zellij b/_home/private_dot_local/bin/executable_load-zellij new file mode 120000 index 0000000..8aae9a8 --- /dev/null +++ b/_home/private_dot_local/bin/executable_load-zellij @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_load-zellij \ No newline at end of file diff --git a/_home/private_dot_local/bin/executable_szetup-kubectl4k3s b/_home/private_dot_local/bin/executable_szetup-kubectl4k3s deleted file mode 100644 index bdeb8ab..0000000 --- a/_home/private_dot_local/bin/executable_szetup-kubectl4k3s +++ /dev/null @@ -1,123 +0,0 @@ -#! /usr/bin/env bash -# shellcheck disable=SC2034,SC1090 -# SC2034 variables appear unsued. export if used externally -# - uneeded, as this checked whether script is sourced -# SC1090 Can't follow non-constant source - -# Use basename instead of ${0:##*/} to be POSIX compliant -# Some shells return - in $0 when sourced, ${0#-} drops that initial dash -BASE_0=${BASE_0:-$(basename -- "${0#-}")} -SCRIPT_DIR=${SCRIPT_DIR:-"$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )"} -BASE_SHELL=$(basename "$SHELL") - -# Helper function -is_sourced() { - DBG_="$( - printf '\n\t\t%-12s%s' '$0:' "$0" BASE_0: "$BASE_0" BASE_SHELL: "$BASE_SHELL" - )" - if [ -n "$ZSH_VERSION" ]; then - case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac - else - case "$(basename -- "${0}")" in $BASE_SHELL|-$BASE_SHELL) return 0;; esac - fi - return 1; # NOT sourced. -} - -if [[ "$1" == '-' ]]; then - printf 'BASE_0="%s"\nSCRIPT_DIR=%s\n' "${BASE_0}" "${SCRIPT_DIR}" - cat "${BASH_SOURCE[0]}" -elif is_sourced; then - # This part is sourced, and might run in a non-bash shell - DBG_="Is Sourced" - USER_HOME=$HOME - [[ -n "${SUDO_USER}" ]] && USER_HOME="$(eval "echo ~${SUDO_USER}")" - - [[ -n "$KUBECONFIG" && -r "$KUBECONFIG" ]] || unset KUBECONFIG - - [[ ! -r "$HOME/.kube/config" ]] \ - || export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}" - - if [[ -z "$KUBECONFIG" && -z "$FIX_KUBECTL_RECALL" ]]; then - (unset kubectl 2>/dev/null) || (unalias kubectl 2>/dev/null) || true - - export KUBECONFIG=/etc/rancher/k3s/k3s.yaml - fi - - (unset kubectl-fix 2> /dev/null) || true - - DBG_="Check if k3s exists, but kubectl isn't available" - if (type 'k3s' >/dev/null 2>&1) && ! (type 'kubectl' >/dev/null 2>&1); then - DBG_="Define kubectl" - if [[ -r "${KUBECONFIG}" ]]; then - kubectl() { k3s kubectl "${@}"; } - elif [[ -n "${KUBECONFIG}" && -e "${KUBECONFIG}" ]]; then - eval " - kubectl-fix() { - mkdir \"$HOME/.kube\" -p - if [[ -e \"\${KUBECONFIG}\" && ! -r \"$HOME/.kube/config\" ]]; then - sudo install --mod 600 --owner \"$USER\" \"\${KUBECONFIG}\" \"$HOME/.kube/config\" - unset KUBECONFIG - fi - FIX_KUBECTL_RECALL=1 . \"${SCRIPT_DIR}/${BASE_0}\" - }" - printf '%s\n' \ - "KUBECONFIG[${KUBECONFIG}] exsits, but is unreadable." \ - 'Run kubectl-fix (which will invoke sudo) to fix' - fi - fi - - if (type 'kubectl' >/dev/null 2>&1); then - - . <( kubectl completion "${BASE_SHELL}" ) - - if (type 'kubectl-cnpg' >/dev/null 2>&1 ); then - . <( kubectl cnpg completion "${BASE_SHELL}" ) - fi - if ! (type 'kubectl-cnpg' >/dev/null 2>&1) || [[ -n "$UPGRADE" ]]; then - DL_VER=1.22.0 - GH_URL=https://github.com/cloudnative-pg/cloudnative-pg - DL_FILE="kubectl-cnpg_${DL_VER}_linux_x86_64.deb" - URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE} - printf '%s\n' \ - 'To download and install cnpg kubectl plugin, run:' \ - " curl -sSLO ${URL}" \ - " sudo dpkg -i $DL_FILE" - fi - - if ! (type 'kubetui' >/dev/null 2>&1) || [[ -n "$UPGRADE" ]]; then - DL_VER=1.5.0 - GH_URL=https://github.com/sarub0b0/kubetui - DL_FILE=kubetui-x86_64-unknown-linux-musl-rustls - URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE} - printf '%s\n' \ - 'To download and install kubetui, run:' \ - " curl -sSL ${URL} > ~/bin/kubetui" \ - " chmod +x ~/bin/kubetui" - fi - - if ! (type 'k9s' >/dev/null 2>&1) || [[ -n "$UPGRADE" ]]; then - printf '%s\n' \ - 'To download and install k9s, run:' \ - " curl -sS https://webinstall.dev/k9s | bash" - fi - - if (type 'k3s' >/dev/null 2>&1 ); then - . <( k3s completion "${SHELL##*/}" ) - fi - - if (type 'helm' >/dev/null 2>&1); then - . <( helm completion "${SHELL##*/}" 2>/dev/null ) - fi - - kg() { - kubectl get "${NS:+--namespace=}${NS:---all-namespaces}" "${@:-pods}" | { sed -u 1q; sort; } - } - fi -else - SCRIPT_NAME="$BASE_0" - printf '%s\n' \ - "It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \ - 'The easiest way is to call it like this:' \ - " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ - '' -fi diff --git a/_home/private_dot_local/bin/executable_szetup-kubectl4k3s b/_home/private_dot_local/bin/executable_szetup-kubectl4k3s new file mode 120000 index 0000000..e263800 --- /dev/null +++ b/_home/private_dot_local/bin/executable_szetup-kubectl4k3s @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_szetup-kubectl4k3s \ No newline at end of file diff --git a/_home/private_dot_local/bin/executable_update-atuin b/_home/private_dot_local/bin/executable_update-atuin deleted file mode 100644 index 816f97f..0000000 --- a/_home/private_dot_local/bin/executable_update-atuin +++ /dev/null @@ -1,32 +0,0 @@ -#! /usr/bin/env bash - -set -e - -BASE_0=${BASE_0:-$0} -BASE_SHELL=$(basename "$SHELL") - -#! /usr/bin/env bash - -_update-atuin() { ( - set -e - - local LatestURL="$( - get-github-release.sh \ - atuinsh/atuin \ - latest atuin-x86_64-unknown-linux-musl.tar.gz \ - | grep -E 'tar\.gz$' - )" - local dlPath="$(mktemp --directory --suffix atuin)" - local appPath="$HOME/.local/bin" - printf 'Downloading from %s... ' "${LatestURL#*/download/}" - curl -sLO --output-dir "$dlPath" "$LatestURL" && printf 'Done' - printf '\n' - ( cd "$dlPath"; curl -sL "$LatestURL.sha256" | sha256sum --check ) - ( cd "$appPath"; tar zxf "$dlPath"/*.tar.gz --strip-components=1 --no-anchored 'atuin' ) - rm -R "$dlPath" - - printf '%s\n' \ - 'atuin binary installed, please restart you shell' -); } - -_update-atuin "${@}" diff --git a/_home/private_dot_local/bin/executable_update-atuin b/_home/private_dot_local/bin/executable_update-atuin new file mode 120000 index 0000000..58200fa --- /dev/null +++ b/_home/private_dot_local/bin/executable_update-atuin @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_update-atuin \ No newline at end of file diff --git a/_home/private_dot_local/bin/executable_update-nvim b/_home/private_dot_local/bin/executable_update-nvim deleted file mode 100644 index 512d4d0..0000000 --- a/_home/private_dot_local/bin/executable_update-nvim +++ /dev/null @@ -1,57 +0,0 @@ -#! /usr/bin/env bash - -set -e - -BASE_0=${BASE_0:-$0} -BASE_SHELL=$(basename "$SHELL") - -_update-nvim() { - local LatestURL="$(get-github-release.sh \ - neovim/neovim latest appimage \ - | grep appimage\$ - )" - local appDir="${HOME}/.local/bin" - if [ "$USER" = "root" ]; then - appDir="${HOME}/usr-local-bin" - while umount --types overlay /usr/local/bin 2>/dev/null; do - : - done - mkdir -pm 755 "$appDir" \ - && mount -t overlay overlay -o "lowerdir=$appDir:/usr/local/bin" /usr/local/bin - update-alternatives --remove vim.tiny /usr/bin/vim.tiny - fi - local appPath="${appDir}/nvim.AppImage" - - rm "${appDir}/"{nvim.AppImage,nvim,vi,vim,vim.tiny,vimdiff} 2>/dev/null || true - - printf 'Downloading from %s... ' "${LatestURL#*/download/}" - curl -sLo "$appPath" "$LatestURL" && printf 'Done' - printf '\n' - chmod +x "$appPath" - - ln -rs "$appPath" "${appDir}/nvim" - ln -rs "$appPath" "${appDir}/vi" - ln -rs "$appPath" "${appDir}/vim" - ln -rs "$appPath" "${appDir}/vim.tiny" - ln -rs "$appPath" "${appDir}/vimdiff" - - if [ "$USER" = "root" ]; then - update-alternatives --install /usr/bin/editor editor "$appPath" 110 - update-alternatives --install /usr/bin/edit edit "$appPath" 110 - update-alternatives --install /usr/bin/ex ex "$appPath" 110 - update-alternatives --install /usr/bin/vi vi "$appPath" 110 - update-alternatives --install /usr/bin/view view "$appPath" 110 - update-alternatives --install /usr/bin/vim vim "$appPath" 110 - update-alternatives --install /usr/bin/vimdiff vimdiff "$appPath" 110 - update-alternatives --set editor "$appPath" - update-alternatives --set edit "$appPath" - update-alternatives --set ex "$appPath" - update-alternatives --set vi "$appPath" - update-alternatives --set view "$appPath" - update-alternatives --set vim "$appPath" - update-alternatives --set vimdiff "$appPath" - - fi -} - -_update-nvim "${@}" diff --git a/_home/private_dot_local/bin/executable_update-nvim b/_home/private_dot_local/bin/executable_update-nvim new file mode 120000 index 0000000..1e6967f --- /dev/null +++ b/_home/private_dot_local/bin/executable_update-nvim @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/executable_update-nvim \ No newline at end of file diff --git a/_home/private_dot_local/bin/symlink_nvim b/_home/private_dot_local/bin/symlink_nvim deleted file mode 100644 index f280f47..0000000 --- a/_home/private_dot_local/bin/symlink_nvim +++ /dev/null @@ -1 +0,0 @@ -nvim.AppImage diff --git a/_home/private_dot_local/bin/symlink_nvim b/_home/private_dot_local/bin/symlink_nvim new file mode 120000 index 0000000..0c7503f --- /dev/null +++ b/_home/private_dot_local/bin/symlink_nvim @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/symlink_nvim \ No newline at end of file diff --git a/_home/private_dot_local/bin/symlink_vi b/_home/private_dot_local/bin/symlink_vi deleted file mode 100644 index 732ff53..0000000 --- a/_home/private_dot_local/bin/symlink_vi +++ /dev/null @@ -1 +0,0 @@ -nvim diff --git a/_home/private_dot_local/bin/symlink_vi b/_home/private_dot_local/bin/symlink_vi new file mode 120000 index 0000000..5173085 --- /dev/null +++ b/_home/private_dot_local/bin/symlink_vi @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/symlink_vi \ No newline at end of file diff --git a/_home/private_dot_local/bin/symlink_vim b/_home/private_dot_local/bin/symlink_vim deleted file mode 100644 index 732ff53..0000000 --- a/_home/private_dot_local/bin/symlink_vim +++ /dev/null @@ -1 +0,0 @@ -nvim diff --git a/_home/private_dot_local/bin/symlink_vim b/_home/private_dot_local/bin/symlink_vim new file mode 120000 index 0000000..eb45531 --- /dev/null +++ b/_home/private_dot_local/bin/symlink_vim @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/symlink_vim \ No newline at end of file diff --git a/_home/private_dot_local/bin/symlink_vim.tiny b/_home/private_dot_local/bin/symlink_vim.tiny deleted file mode 100644 index 732ff53..0000000 --- a/_home/private_dot_local/bin/symlink_vim.tiny +++ /dev/null @@ -1 +0,0 @@ -nvim diff --git a/_home/private_dot_local/bin/symlink_vim.tiny b/_home/private_dot_local/bin/symlink_vim.tiny new file mode 120000 index 0000000..638793a --- /dev/null +++ b/_home/private_dot_local/bin/symlink_vim.tiny @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/symlink_vim.tiny \ No newline at end of file diff --git a/_home/private_dot_local/bin/symlink_vimdiff b/_home/private_dot_local/bin/symlink_vimdiff deleted file mode 100644 index 732ff53..0000000 --- a/_home/private_dot_local/bin/symlink_vimdiff +++ /dev/null @@ -1 +0,0 @@ -nvim diff --git a/_home/private_dot_local/bin/symlink_vimdiff b/_home/private_dot_local/bin/symlink_vimdiff new file mode 120000 index 0000000..d1e0ef1 --- /dev/null +++ b/_home/private_dot_local/bin/symlink_vimdiff @@ -0,0 +1 @@ +../../../_src.posix/private_dot_local/bin/symlink_vimdiff \ No newline at end of file diff --git a/_src.all/private_dot_local/bin/.keep b/_src.all/private_dot_local/bin/.keep new file mode 100644 index 0000000..e69de29 diff --git a/_src.posix/.chezmoi.toml.tmpl b/_src.posix/.chezmoi.toml.tmpl new file mode 100644 index 0000000..56873e0 --- /dev/null +++ b/_src.posix/.chezmoi.toml.tmpl @@ -0,0 +1,32 @@ +{{- $sysname := promptStringOnce . "sysname" "System name" -}} +{{- $sysgroup := promptStringOnce . "sysgroup" "System group" -}} +{{- $sysarea := promptStringOnce . "sysarea" "System area" -}} +{{- $gitEmail := promptStringOnce . "gitEmail" "email address (for git commits)" -}} +{{- $gitName := promptStringOnce . "gitName" "Full name (for git commits)" -}} + +[data] +{{- if ($sysname) }} + sysname = {{ $sysname | quote }} +{{- end -}} +{{- if ($sysgroup) }} + sysgroup = {{ $sysgroup | quote }} +{{- end -}} +{{- if ($sysarea) }} + sysarea = {{ $sysarea | quote }} +{{ end -}} + +{{ if ($gitEmail) }} + gitEmail = {{ $gitEmail | quote }} +{{- end -}} +{{- if ($gitName) }} + gitName = {{ $gitName | quote }} +{{- end }} + +[diff] +# command = "nvim" +# args = ["-d", "{{- "{{ .Destination }}" -}}", "{{- "{{ .Target }}" -}}"] + + command = "delta" + args = ["--paging=never", "{{ "{{ .Destination }}" }}", "{{ "{{ .Target }}" }}"] + pager = "delta" + diff --git a/_src.posix/.chezmoiexternal.yaml b/_src.posix/.chezmoiexternal.yaml new file mode 100644 index 0000000..12ee019 --- /dev/null +++ b/_src.posix/.chezmoiexternal.yaml @@ -0,0 +1,120 @@ +# https://www.chezmoi.io/reference/special-files-and-directories/chezmoiexternal-format/ +# +# The externals are checked based on the refreshPeriod whenever an `apply` (or `update`) operations run +# +# The simplest form to update all externals: +# ```sh +# chezmoi apply --include externals +# ``` +# +# Variable Type Default Description +# type string none External type (file, archive, archive-file, or git-repo) +# url string none URL +# refreshPeriod duration 0 Refresh period (Examples: one day (24h), one week (168h), or four weeks (672h)) +# executable bool false Add executable_ attribute to file +# path string none Path to file in archive + +{{ $defaultRefresh := "168h" -}} +{{- $externals := dict -}} + +{{ $myArch := "x86_64-unknown-linux-musl" }} + +{{- with $repo := "zellij-org/zellij" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".cache/chezmoi/tmp/zellij" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/%s/zellij-%s.tar.gz" $repo $version $myArch) + "path" "zellij" + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end }} + +{{- with $repo := "dandavison/delta" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/delta" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/%s/delta-%s-%s.tar.gz" $repo $version $version $myArch) + "path" (printf "delta-%s-%s/delta" $version $myArch) + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end -}} + +{{ $myArch = "linux_amd64" }} + +{{- with $repo := "hickford/git-credential-oauth" -}} +{{- with $version := trimPrefix "v" (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/git-credential-oauth" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/v%s/git-credential-oauth_%s_%s.tar.gz" $repo $version $version $myArch) + "path" "git-credential-oauth" + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end -}} + +{{ $myArch = "linux-x86_64" }} + +{{- with $repo := "extrawurst/gitui" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/gitui" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/%s/gitui-%s.tar.gz" $repo $version $myArch) + "path" "./gitui" + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end }} + +{{ $myArch = "linux_x86_64" }} + +{{- with $repo := "theimpostor/osc" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/osc" (dict + "type" "archive-file" + "url" (printf "https://github.com/%s/releases/download/%s/osc_%s.tar.gz" $repo $version $myArch) + "path" "osc" + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end }} + +{{ $myArch = "linux-amd64" }} + +{{- with $repo := "Lifailon/lazyjournal" -}} +{{- with $version := (gitHubLatestRelease $repo).GetTagName -}} +{{- $_ := set $externals ".local/bin/lazyjournal" (dict + "type" "file" + "url" (printf "https://github.com/%s/releases/download/%s/lazyjournal-%s-%s" $repo $version $version $myArch) + "executable" true + "refreshPeriod" $defaultRefresh +) -}} +{{- end -}} +{{- end }} + +{{- $externals | toYaml }} +".config/sz.env/lib/ble.sh.curl": + type: "archive" + url: "https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz" + refreshPeriod: "{{ $defaultRefresh }}" + +".config/sz.env/lib/delta.themes.gitconfig": + type: "file" + url: "https://raw.githubusercontent.com/dandavison/delta/refs/heads/main/themes.gitconfig" + refreshPeriod: "{{ $defaultRefresh }}" + +".config/sz.env/lib/bash-preexec/bash-preexec.sh": + type: "file" + url: "https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh" + refreshPeriod: "{{ $defaultRefresh }}" + +".local/bin/nvim.AppImage": + type: "file" + url: "https://github.com/neovim/neovim/releases/download/stable/nvim.appimage" + executable: true + refreshPeriod: "{{ $defaultRefresh }}" diff --git a/_src.posix/.chezmoiignore b/_src.posix/.chezmoiignore new file mode 100644 index 0000000..7e110d2 --- /dev/null +++ b/_src.posix/.chezmoiignore @@ -0,0 +1,3 @@ +/**/.git +/**/.git/** + diff --git a/_src.posix/.chezmoiscripts/run_once_init.sh.tmpl b/_src.posix/.chezmoiscripts/run_once_init.sh.tmpl new file mode 100755 index 0000000..92cc9ab --- /dev/null +++ b/_src.posix/.chezmoiscripts/run_once_init.sh.tmpl @@ -0,0 +1,3 @@ +#! /usr/bin/env bash + +printf '_home init\s' diff --git a/_src.posix/dot_bashrc b/_src.posix/dot_bashrc new file mode 100644 index 0000000..13ebe78 --- /dev/null +++ b/_src.posix/dot_bashrc @@ -0,0 +1,24 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples +[ -z "${DBG_SHRC}" ] || echo "Entered .bashrc" + +## Generated for envman. Do not edit. +#[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh" +# +## Generated by Webi. Do not edit. +#eval "$(webi --init zsh)" + +[ -s "$HOME/.config/sz.env/_.load.sh" ] && . <( "$HOME/.config/sz.env/_.load.sh" - ) + +[ -z "${DBG_SHRC}" ] || echo "Exiting .bashrc" +# This will prevent atuin's setup script from adding itself: atuin init bash + +#eval "${SZ_ENV_BASH_LOAD_PREEXEC}" +#if [[ -n "${BLE_VERSION-}" ]]; then +# [[ -n "${DBG}" ]] && echo "attaching ble.sh" +# ble-attach +#fi + diff --git a/_src.posix/dot_gitconfig.tmpl b/_src.posix/dot_gitconfig.tmpl new file mode 100644 index 0000000..960e3c9 --- /dev/null +++ b/_src.posix/dot_gitconfig.tmpl @@ -0,0 +1,70 @@ +# This is Git's per-user configuration file. +# It is recommended to edit this using chezmoi: +# cz edit ~/.gitconfig + +[include] + path = .config/sz.env/lib/delta.themes.gitconfig + +[user] + name = {{ .gitName }} + email = {{ .gitEmail }} + +# Information on how to set this up: +# https://github.com/hickford/git-credential-oauth?tab=readme-ov-file#git-credential-oauth +[credential] + helper = cache --timeout 21600 + helper = oauth +# helper = osxkeychain +# helper = oauth -device + +# Raed only OAuth2 authorization +[credential "https://git.vastdata.com"] + oauthClientId = 45fddd19ac1e3828f6caca2087dd78383477f0fc94164920476db536ac618beb + oauthClientSecret = 98958d78931d8f02be1ab9c4fd4f718dcce357be3b609e771ba26f500ddd6196 + # oauthScopes = "read_repository write_repository" + oauthScopes = "read_repository" + oauthAuthURL = /oauth/authorize + oauthTokenURL = /oauth/token + oauthDeviceAuthURL = /oauth/authorize_device + +[credential "https://code.lksz.me"] + oauthClientId = a4792ccc-144e-407e-86c9-5e7d8d9c3269 + oauthAuthURL = /login/oauth/authorize + oauthTokenURL = /login/oauth/access_token +# oauthDeviceAuthURL = /login/oauth/authorize +# oauthDeviceAuthURL = /login/oauth/authorize_device +# oauthScopes = read_repository +[core] + editor = vim + pager = delta + +[init] + defaultBranch = main + +[core] + pager = delta + +[interactive] + diffFilter = delta --color-only + +[delta] + features = colibri + navigate = true # use n and N to move between diff sections + line-numbers = true + side-by-side = true + +[diff] + tool = nvimdiff +[difftool] + prompt = false +[difftool "nvimdiff"] + cmd = "nvim -d \"$LOCAL\" \"$REMOTE\"" + +[merge] + tool = nvimdiff + conflictstyle = zdiff3 +[mergetool] + prompt = true +[mergetool "nvimdiff"] + cmd = "nvim -d \"$LOCAL\" \"$REMOTE\" \"$MERGED\" -c 'wincmd w' -c 'wincmd J'" + diff --git a/_src.posix/dot_profile b/_src.posix/dot_profile new file mode 100644 index 0000000..88fa551 --- /dev/null +++ b/_src.posix/dot_profile @@ -0,0 +1,31 @@ +# ~/.profile: executed by the command interpreter for login shells. +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login +# exists. +# see /usr/share/doc/bash/examples/startup-files for examples. +# the files are located in the bash-doc package. + +# the default umask is set in /etc/profile; for setting the umask +# for ssh logins, install and configure the libpam-umask package. +#umask 022 + +# if running bash +if [ -n "$BASH_VERSION" ]; then + # include .bashrc if it exists + if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi +fi + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/.local/bin" ] ; then + PATH="$HOME/.local/bin:$PATH" +fi + +# Generated for envman. Do not edit. +# [ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh" +[ -s "$HOME/.config/sz.env/_.load.sh" ] && . <( "$HOME/.config/sz.env/_.load.sh" - ) diff --git a/_src.posix/dot_zshrc b/_src.posix/dot_zshrc new file mode 100644 index 0000000..7742f46 --- /dev/null +++ b/_src.posix/dot_zshrc @@ -0,0 +1,8 @@ +## Generated for envman. Do not edit. +#[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh" +# +## Generated by Webi. Do not edit. +#eval "$(webi --init zsh)" + +[ -s "$HOME/.config/sz.env/_.load.sh" ] && . <( "$HOME/.config/sz.env/_.load.sh" - ) + diff --git a/_src.posix/private_dot_config/atuin/config.toml b/_src.posix/private_dot_config/atuin/config.toml new file mode 100644 index 0000000..bda65c2 --- /dev/null +++ b/_src.posix/private_dot_config/atuin/config.toml @@ -0,0 +1,142 @@ +## where to store your database, default is your system data directory +## linux/mac: ~/.local/share/atuin/history.db +## windows: %USERPROFILE%/.local/share/atuin/history.db +# db_path = "~/.history.db" + +## where to store your encryption key, default is your system data directory +## linux/mac: ~/.local/share/atuin/key +## windows: %USERPROFILE%/.local/share/atuin/key +# key_path = "~/.key" + +## where to store your auth session token, default is your system data directory +## linux/mac: ~/.local/share/atuin/session +## windows: %USERPROFILE%/.local/share/atuin/session +# session_path = "~/.session" + +## date format used, either "us" or "uk" +# dialect = "us" + +## enable or disable automatic sync +# auto_sync = true + +## enable or disable automatic update checks +# update_check = true + +## address of the sync server +# sync_address = "http://192.168.222.65" + +## how often to sync history. note that this is only triggered when a command +## is ran, so sync intervals may well be longer +## set it to 0 to sync after every command +# sync_frequency = "10m" + +## which search mode to use +## possible values: prefix, fulltext, fuzzy, skim +# search_mode = "fuzzy" + +## which filter mode to use +## possible values: global, host, session, directory +# filter_mode = "global" + +## With workspace filtering enabled, Atuin will filter for commands executed +## in any directory within a git repository tree (default: false) +# workspaces = false + +## which filter mode to use when atuin is invoked from a shell up-key binding +## the accepted values are identical to those of "filter_mode" +## leave unspecified to use same mode set in "filter_mode" +# filter_mode_shell_up_key_binding = "directory" + +## which search mode to use when atuin is invoked from a shell up-key binding +## the accepted values are identical to those of "search_mode" +## leave unspecified to use same mode set in "search_mode" +# search_mode_shell_up_key_binding = "fuzzy" + +## which style to use +## possible values: auto, full, compact +# style = "auto" + +## the maximum number of lines the interface should take up +## set it to 0 to always go full screen +inline_height = 20 + +## Invert the UI - put the search bar at the top , Default to `false` +# invert = false + +## enable or disable showing a preview of the selected command +## useful when the command is longer than the terminal width and is cut off +show_preview = true + +## what to do when the escape key is pressed when searching +## possible values: return-original, return-query +# exit_mode = "return-original" + +## possible values: emacs, subl +# word_jump_mode = "emacs" + +## characters that count as a part of a word +# word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + +## number of context lines to show when scrolling by pages +# scroll_context_lines = 1 + +## use ctrl instead of alt as the shortcut modifier key for numerical UI shortcuts +## alt-0 .. alt-9 +# ctrl_n_shortcuts = false + +## prevent commands matching any of these regexes from being written to history. +## Note that these regular expressions are unanchored, i.e. if they don't start +## with ^ or end with $, they'll match anywhere in the command. +## For details on the supported regular expression syntax, see +## https://docs.rs/regex/latest/regex/#syntax +# history_filter = [ +# "^secret-cmd", +# "^innocuous-cmd .*--secret=.+" +# ] + +## prevent commands run with cwd matching any of these regexes from being written +## to history. Note that these regular expressions are unanchored, i.e. if they don't +## start with ^ or end with $, they'll match anywhere in CWD. +## For details on the supported regular expression syntax, see +## https://docs.rs/regex/latest/regex/#syntax +# cwd_filter = [ +# "^/very/secret/area" +# ] + +## Configure the maximum height of the preview to show. +## Useful when you have long scripts in your history that you want to distinguish +## by more than the first few lines. +max_preview_height = 8 + +## Configure whether or not to show the help row, which includes the current Atuin +## version (and whether an update is available), a keymap hint, and the total +## amount of commands in your history. +show_help = true + +## Defaults to true. This matches history against a set of default regex, and will not save it if we get a match. Defaults include +## 1. AWS key id +## 2. Github pat (old and new) +## 3. Slack oauth tokens (bot, user) +## 4. Slack webhooks +## 5. Stripe live/test keys +# secrets_filter = true + +## Defaults to true. If enabled, upon hitting enter Atuin will immediately execute the command. Press tab to return to the shell and edit. +# This applies for new installs. Old installs will keep the old behaviour unless configured otherwise. +enter_accept = false + +#[stats] +# Set commands where we should consider the subcommand for statistics. Eg, kubectl get vs just kubectl +common_subcommands = [ + "cargo", + "go", + "git", + "npm", + "yarn", + "pnpm", + "kubectl", + "apt" +] +# +# Set commands that should be totally stripped and ignored from stats +#common_prefix = ["sudo"] diff --git a/_src.posix/private_dot_config/starship.toml b/_src.posix/private_dot_config/starship.toml new file mode 100644 index 0000000..45402f4 --- /dev/null +++ b/_src.posix/private_dot_config/starship.toml @@ -0,0 +1,101 @@ +# Customized, based on tokyo-night + +# global prompt configuration ( https://starship.rs/config/#prompt ) +format = """ +[β–‘β–’β–“](#a3aed2)\ +$os\ +[ξ‚΄](bg:#769ff0 fg:#a3aed2)\ +$directory\ +[ξ‚΄](fg:#769ff0 bg:#394260)\ +$git_branch\ +$git_status\ +[ξ‚΄](fg:#394260 bg:#212736)\ +$nodejs\ +$rust\ +$golang\ +[ξ‚΄](fg:#212736 bg:#1d2230)\ +$time\ +[ξ‚΄](fg:#212736 bg:#1d2230)\ +$cmd_duration\ +$status\ +[ξ‚΄ ](fg:#1d2230)\ +$line_break$character""" + +command_timeout = 1500 # milliseconds; default is 500 + +[profiles] +transient = """ +$time\ +[ξ‚΄](fg:#212736 bg:#1d2230)\ +$character""" + + +[os] +style = "bg:#a3aed2 fg:#090c0c" +disabled = false + +# Without NerdFont +#[os.symbols] +#Windows = " Win" + +# NerdFont - see https://www.nerdfonts.com/cheat-sheet +[os.symbols] +Windows = " ο…Ί" + +[directory] +style = "fg:#e3e5e5 bg:#769ff0" +format = "[ $path ]($style)" +truncation_length = 3 +truncation_symbol = "…/" + +[directory.substitutions] +"Documents" = "σ°ˆ™ " +"Downloads" = "ο€™ " +"Music" = " " +"Pictures" = "ο€Ύ " + +[git_branch] +symbol = "" +style = "bg:#394260" +format = '[[ $symbol $branch ](fg:#769ff0 bg:#394260)]($style)' + +[git_status] +style = "bg:#394260" +format = '[[($all_status$ahead_behind )](fg:#769ff0 bg:#394260)]($style)' + +[nodejs] +symbol = "" +style = "bg:#212736" +format = '[[ $symbol ($version) ](fg:#769ff0 bg:#212736)]($style)' + +[rust] +symbol = "" +style = "bg:#212736" +format = '[[ $symbol ($version) ](fg:#769ff0 bg:#212736)]($style)' + +[golang] +symbol = "" +style = "bg:#212736" +format = '[[ $symbol ($version) ](fg:#769ff0 bg:#212736)]($style)' + +[time] +disabled = false +time_format = "%R" # Hour:Minute Format +style = "bg:#1d2230" +format = '[[  $time ](fg:#a0a9cb bg:#1d2230)]($style)' + +[cmd_duration] +min_time = 500 # milliseconds +# nerd font version: +format = 'prev: [[ ο‰’ $duration ](fg:#a0a9cb bg:#1d2230)]($style)' +# General UNICODE font version: +# format = '[[ β§— $duration ](fg:#a0a9cb bg:#1d2230)]($style)' +# Emoji version: +# format = '[[ βŒ› $duration ](fg:#a0a9cb bg:#1d2230)]($style)' + +[status] +disabled = false + +[character] +disabled = false + diff --git a/_src.posix/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env b/_src.posix/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env new file mode 100644 index 0000000..6e83c75 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env @@ -0,0 +1,8 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +if [[ ! "$-" =~ i ]]; then + LOAD_EXIT=1 + echo "Non interactive session ($-) , stopping load of shell environment" 1>&2 +else + reset +fi diff --git a/_src.posix/private_dot_config/sz.env/ID_truenas_scale.env b/_src.posix/private_dot_config/sz.env/ID_truenas_scale.env new file mode 100644 index 0000000..8aa90e1 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/ID_truenas_scale.env @@ -0,0 +1,8 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +function is_truenas() { + local TRUENAS_TARGET="truenas.target" + [ "$(systemctl get-default)" = "$TRUENAS_TARGET" ] \ + && [ "$(systemctl is-active "$TRUENAS_TARGET")" = "active" ] +} + diff --git a/_src.posix/private_dot_config/sz.env/PATH_home_bin.env b/_src.posix/private_dot_config/sz.env/PATH_home_bin.env new file mode 100644 index 0000000..72f28fd --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/PATH_home_bin.env @@ -0,0 +1,4 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +PATH="$HOME/bin:$PATH" +PATH="$HOME/.local/bin:$PATH" diff --git a/_src.posix/private_dot_config/sz.env/PATH_node.env b/_src.posix/private_dot_config/sz.env/PATH_node.env new file mode 100644 index 0000000..2c440cb --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/PATH_node.env @@ -0,0 +1,3 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +export PATH="$HOME/.local/opt/node/bin:$PATH" diff --git a/_src.posix/private_dot_config/sz.env/PATH_truestuff.env b/_src.posix/private_dot_config/sz.env/PATH_truestuff.env new file mode 100644 index 0000000..0095c06 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/PATH_truestuff.env @@ -0,0 +1,16 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +if is_cmd midclt && [ -z "$SCALE_POOL" ]; then + export SCALE_POOL=szmedia + + export SCALE_POOL="$(midclt call "kubernetes.config" 2>/dev/null | jq -r '.pool')" + [ -n "$SCALE_POOL" ] && [ "$SCALE_POOL" != "null" ] || export SCALE_POOL="$(midclt call "pool.query" 2>/dev/null | jq -r '.[0].name')" + [ -d "/mnt/$SCALE_POOL" ] || unset SCALE_POOL +fi + +[ -n "$SCALE_POOL" ] \ +&& export SCALE_POOL_ROOT=/mnt/$SCALE_POOL \ +&& PATH="$SCALE_POOL_ROOT/_apps.data/_scripts/truestuff:$PATH" \ +&& PATH="$SCALE_POOL_ROOT/data/scripts/truestuff:$PATH" \ +&& export PATH + diff --git a/_src.posix/private_dot_config/sz.env/PATH_zz_cleanup.env b/_src.posix/private_dot_config/sz.env/PATH_zz_cleanup.env new file mode 100644 index 0000000..7556855 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/PATH_zz_cleanup.env @@ -0,0 +1,15 @@ +#!/usr/bin/env -S sh -c 'echo "Not a user script. source(aka .) only"' + +# Remove duplicates from PATH +OLDPATH="$PATH"; NEWPATH=""; colon="" +while [ "${OLDPATH#*:}" != "$OLDPATH" ]; do + entry="${OLDPATH%%:*}"; search=":${OLDPATH#*:}:" + [ "${search#*:"$entry":}" = "$search" ] && [[ -d $entry ]] && NEWPATH="$NEWPATH$colon$entry" && colon=: + OLDPATH="${OLDPATH#*:}" +done +NEWPATH="$NEWPATH:$OLDPATH" +export PATH="$NEWPATH" +unset NEWPATH OLDPATH colon entry search + +[[ -n "${DBG}" ]] && echo "${PATH//:/\n}" + diff --git a/_src.posix/private_dot_config/sz.env/aaa_zsh_0_perp.env b/_src.posix/private_dot_config/sz.env/aaa_zsh_0_perp.env new file mode 100644 index 0000000..f39c09e --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/aaa_zsh_0_perp.env @@ -0,0 +1,67 @@ +#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"' + +BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} + +if [[ "${BASE_SHELL}" == "zsh" ]]; then + + [ -z "$ZSH_CACHE_DIR" ] && export ZSH_CACHE_DIR=$HOME/.cache/zsh + mkdir -p $ZSH_CACHE_DIR/completions + mkdir -p "$HOME/.local/share/zsh/completions" + + # Remove duplicates from fpath, and add local completion dir + fpath=( $( + for d in $( + awk '!seen[$0]++' <( + echo "$HOME/.local/share/zsh/completions" + printf '%s\n' $fpath + ) + ); do + [ -d "$d" ] && echo "$d" + done + ) ) + + skip_global_compinit=1 + + # # Jump to the bottom of the screen + # SZ_TPUT_END=$(tput cup 9999 0) + # echo $SZ_TPUT_END + + PS1="$(zsh -c '. <([ -n "$(echo /etc/*-release(N))" ] && cat /etc/*-release(N) | uniq -u || NAME="$VENDOR" ); echo "$NAME $VERSION_ID "')| ZSH ${ZSH_VERSION} LOADING >" + + #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + #""" Shell Settings """ + #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + typeset -g HISTFILE="$HOME/.zsh_history" + typeset -g HISTSIZE=1000000 + typeset -g SAVEHIST=$HISTSIZE + typeset -g COMPLETION_WAITING_DOTS="true" + setopt hist_ignore_dups # ignore duplicated commands history list + export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES # fix "+[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called" issue + + ##################### + # SETOPT # + ##################### + setopt promptsubst + setopt extended_history # record timestamp of command in HISTFILE + setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE + setopt hist_ignore_all_dups # ignore duplicated commands history list + setopt hist_ignore_space # ignore commands that start with space + setopt hist_verify # show command with history expansion to user before running it + setopt inc_append_history # add commands to HISTFILE in order of execution + setopt share_history # share command history data + setopt always_to_end # cursor moved to the end in full completion + setopt hash_list_all # hash everything before completion + setopt nocompletealiases # no complete alisases - no need for specific compdef for aliases + setopt always_to_end # when completing from the middle of a word, move the cursor to the end of the word + setopt complete_in_word # allow completion from within a word/phrase + setopt nocorrect # spelling correction for commands + setopt list_ambiguous # complete as much of a completion until it gets ambiguous. + setopt auto_cd # changing directories without cd + setopt nolisttypes + setopt listpacked + setopt automenu + setopt vi + + [[ -n "${DBG}" ]] && echo "ZSH preped" +fi + diff --git a/_src.posix/private_dot_config/sz.env/aaa_zsh_2_zinit.env b/_src.posix/private_dot_config/sz.env/aaa_zsh_2_zinit.env new file mode 100644 index 0000000..6024fa0 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/aaa_zsh_2_zinit.env @@ -0,0 +1,58 @@ +#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"' + +BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} + +if [[ "${BASE_SHELL}" == "zsh" ]]; then + # true = install zdharma-continuum/zinit + # false = install z-shell/zi + + if false; then + # Auto install zdharma-continuum/zinit + ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/bin" + if [[ ! -d "$ZINIT_HOME/.git" ]]; then + print -P "%F{33}β–“β–’β–‘ %F{220}Installing DHARMA Initiative Plugin Manager (zdharma-continuum/zinit)…%f" + command mkdir -p "$(dirname "$ZINIT_HOME")" \ + && command chmod go-rwX "$(dirname "$ZINIT_HOME")" + command git clone -q --depth=1 --branch "main" \ + https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" \ + && print -P "%F{33}β–“β–’β–‘ %F{34}Installation successful.%f%b" \ + || print -P "%F{160}β–“β–’β–‘ The clone has failed.%f%b" + fi + source "${ZINIT_HOME}/zinit.zsh" + + autoload -Uz _zinit + (( ${+_comps} )) && _comps[zinit]=_zinit + ### End of Zinit installer's chunk + alias zi='zinit ' + + [[ -n "${DBG}" ]] && echo "zinit ready" + else + #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + #""" z-shell/zi """ + #"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + # + # ### Added by z-shell/zi's installer + ZI_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zi/bin" + mkdir -p "$(dirname "$ZI_HOME")" + if [[ ! -d "$ZI_HOME/.git" ]]; then + print -P "%F{33}β–“β–’β–‘ %F{160}Installing (%F{33}z-shell/zi%F{160})…%f" + command mkdir -p "$(dirname "$ZINIT_HOME")" \ + && command chmod go-rwX "$(dirname "$ZI_HOME")" + command git clone -q --depth=1 --branch "main" \ + https://github.com/z-shell/zi.git "$ZI_HOME" \ + && print -P "%F{33}β–“β–’β–‘ %F{34}Installation successful.%f%b" \ + || print -P "%F{160}β–“β–’β–‘ The clone has failed.%f%b" + fi + source "${ZI_HOME}/zi.zsh" + autoload -Uz _zi + (( ${+_comps} )) && _comps[zi]=_zi + # examples here -> https://wiki.zshell.dev/ecosystem/category/-annexes + zicompinit # <- https://wiki.zshell.dev/docs/guides/commands + ### End of z-shell/zi installer's chunk + alias zinit=zi + + [[ -n "${DBG}" ]] && echo "zi ready" + fi + +fi + diff --git a/_src.posix/private_dot_config/sz.env/aaa_zsh_3_completion_system.env b/_src.posix/private_dot_config/sz.env/aaa_zsh_3_completion_system.env new file mode 100644 index 0000000..714e502 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/aaa_zsh_3_completion_system.env @@ -0,0 +1,10 @@ +#!/usr/bin/env -S zsh -c 'echo "Not a user script. source(aka .) only"' + +BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} + +if [[ "${BASE_SHELL}" == "zsh" ]]; then + autoload -Uz +X compinit bashcompinit && compinit && bashcompinit + + zstyle ':completion:*' menu yes select +fi + diff --git a/_src.posix/private_dot_config/sz.env/aab_zellij.env b/_src.posix/private_dot_config/sz.env/aab_zellij.env new file mode 100644 index 0000000..d3999ff --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/aab_zellij.env @@ -0,0 +1,8 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +if is_cmd load-zellij && [ -z "${VSCODE_PROFILE_INITIALIZED}" ]; then + # zellij will need to allow reload of the enviornment + [[ -z "$ZELLIJ_SESSION_NAME" ]] && unset SZ_ENV_LOADED + . <( load-zellij - ) + [[ -z "$ZELLIJ_SESSION_NAME" ]] && SZ_ENV_LOADED=1 +fi diff --git a/_src.posix/private_dot_config/sz.env/aliases.env b/_src.posix/private_dot_config/sz.env/aliases.env new file mode 100644 index 0000000..deab518 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/aliases.env @@ -0,0 +1,9 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +alias l='ls -lahF --color=auto --group-directories-first ' +alias lu='l -U ' +alias lold='l --sort=time ' +alias lnew='l --sort=time --reverse ' +alias ll='l -A' + +alias sudo='sudo ' diff --git a/_src.posix/private_dot_config/sz.env/bbb_bash_preexec.env b/_src.posix/private_dot_config/sz.env/bbb_bash_preexec.env new file mode 100644 index 0000000..bde5808 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/bbb_bash_preexec.env @@ -0,0 +1,28 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} + +if [[ "${BASE_SHELL}" == "bash" ]]; then + update-bash-preexec() { + local workdir="$SZ_ENV_ROOT/lib/bash-preexec" + [ -d "$workdir" ] && rm -fR "$workdir" + mkdir -p "$workdir" + + cd "$workdir" + + # Pull down our file from GitHub and write it to your home directory as a hidden file. + curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ./bash-preexec.sh + # Source our file to bring it into our environment + source .bash-preexec.sh + + source "$workdir/ble-nightly/ble.sh" + } + + # shellcheck disable=SC1091 source=$HOME/.bash-preexec.sh + if [[ -f "$SZ_ENV_ROOT/lib/bash-preexec/.bash-preexec.sh" ]]; then + SZ_ENV_BASH_LOAD_PREEXEC='. "$SZ_ENV_ROOT/lib/bash-preexec/.bash-preexec.sh"' + + [[ -n "${DBG}" ]] && echo "Bash-preexec will be loaded." + fi +fi + diff --git a/_src.posix/private_dot_config/sz.env/bbb_ble.sh.env b/_src.posix/private_dot_config/sz.env/bbb_ble.sh.env new file mode 100644 index 0000000..7c2e99e --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/bbb_ble.sh.env @@ -0,0 +1,26 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} + +if [[ "${BASE_SHELL}" == "bash" ]]; then + update-ble.sh() { + [[ -n "${DBG}" ]] && set -x + local workdir="$SZ_ENV_ROOT/lib/ble.sh.curl" + [ -d "$workdir" ] && rm -fR "$workdir" + mkdir -p "$workdir" + + cd "$workdir" + curl -L https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - + + source "$workdir/ble-nightly/ble.sh" + [[ -n "${DBG}" ]] && set +x + } + if [ -f "$SZ_ENV_ROOT/lib/ble.sh.curl/ble-nightly/ble.sh" ]; then + source "$SZ_ENV_ROOT/lib/ble.sh.curl/ble-nightly/ble.sh" --noattach + fi + + if [[ -n "${DBG}" && -n "${BLE_VERSION-}" ]]; then + echo "ble.sh will be loaded." + fi +fi + diff --git a/_src.posix/private_dot_config/sz.env/broot.env b/_src.posix/private_dot_config/sz.env/broot.env new file mode 100644 index 0000000..8919977 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/broot.env @@ -0,0 +1,6 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +if is_cmd broot; then + source /mnt/szmedia/USERDATA/home/sz/.config/broot/launcher/bash/br +fi + diff --git a/_src.posix/private_dot_config/sz.env/envman-and-webi.env b/_src.posix/private_dot_config/sz.env/envman-and-webi.env new file mode 100644 index 0000000..f59d5de --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/envman-and-webi.env @@ -0,0 +1,15 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +export ENVMAN_LOAD='' + +if [ -s "$HOME/.config/envman/load.sh" ]; then + [[ -n "${DBG}" ]] && echo "Loading envman" + source "$HOME/.config/envman/load.sh" + + [[ -n "${DBG}" ]] && echo "${PATH//:/\n}" +fi + +if is_cmd webi; then + . <(webi --init "${SHELL##*/}") +fi + diff --git a/_src.posix/private_dot_config/sz.env/executable__.load.sh b/_src.posix/private_dot_config/sz.env/executable__.load.sh new file mode 100644 index 0000000..b1c95bd --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/executable__.load.sh @@ -0,0 +1,89 @@ +#! /usr/bin/env bash + +# Helper function +is_sourced() { + if [ -n "$ZSH_VERSION" ]; then + case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac + else # Add additional POSIX-compatible shell names here, if needed. + case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac + fi + return 1; # NOT sourced. +} + +BASE_0=${BASE_0:-$0} +BASE_SHELL=$(basename "$SHELL") + +is_cmd() { +type -- "${@}" 2> /dev/null 1> /dev/null +} + +if is_sourced; then + # shellcheck disable=SC2139 # This expands when defined, not when used. + alias _r="unset DBG; exec $SHELL -l " + # shellcheck disable=SC2139 # This expands when defined, not when used. + alias _rdbg="exec sh -c 'DBG=1 $SHELL -l '" + + SZ_ENV_ROOT=$( cd -- "$( dirname -- "${BASE_0}" )" &> /dev/null && pwd ) + USER_HOME=$HOME + [[ -n "${SUDO_USER}" ]] && USER_HOME="$(eval "echo ~${SUDO_USER}")" + + load_next() { + [ "$LOAD_EXIT" != "0" ] && return 1 + + if [[ -n "${DBG}" ]]; then + echo "Loading ${1}..." 1>&2 + #shellcheck disable=SC2086 + ${DBG/%1/:} 1>&2 + fi + #shellcheck source=/dev/null + . "${1}" + } + + load_all() { + local ALL_ENV_FILES + if [ -z "$SZ_ENV_LOADED" ]; then + SZ_ENV_LOADED=1 + LOAD_EXIT=0 + + # The following constructs a list of load_next ... commands + ALL_ENV_FILES="$( + find ~/.config/sz.env -xdev -type d -not -name '*.off' \ + -exec sh -c ' + find "$1" -xdev -maxdepth 1 -type f -name "ID_*.env" | sort + ' shell '{}' ';' \ + -exec sh -c ' + find "$1" -xdev -maxdepth 1 -type f -name "PATH_*.env" | sort + ' shell '{}' ';' \ + -exec sh -c ' + find "$1" -xdev -maxdepth 1 -type f -name "*.env" -not -name "ID_*" -not -name "PATH_*" -print | sort + ' shell '{}' ';' \ + -exec sh -c ' + find "$1" -xdev -maxdepth 1 -type f -name "PATH_zz_cleanup.env" + ' shell '{}' ';' \ + | sed -e 's/^/load_next "/; s/$/";/' + )" + if [ -n "$DBG_NO_SZ_LOAD" ]; then + ALL_ENV_FILES=$(<<<"$ALL_ENV_FILES" sed -Ee ' + /PATH_/!s/^(load_next )/# \1/ + ') + printf 'Loading limited environment...\n' + fi + # Run the constructed (see above) list + eval "$ALL_ENV_FILES" + fi + } + load_all +elif [[ "$1" == '-' ]]; then + echo "BASE_0=${BASE_0}" + cat "${0}" +else + is_cmd "${BASE_0##*/}" && SCRIPT_NAME="${BASE_0##*/}" || SCRIPT_NAME="${BASE_0/$HOME/\~}" + printf '%s\n' \ + "It seems '$SCRIPT_NAME' was invoked as a standalone script." \ + 'This script is designed to produce output that is sourced.' \ + '' \ + 'The recommended way is to use calling pattern below:' \ + " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ + '' +fi + diff --git a/_src.posix/private_dot_config/sz.env/fix-kubectl.env b/_src.posix/private_dot_config/sz.env/fix-kubectl.env new file mode 100644 index 0000000..88adcd6 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/fix-kubectl.env @@ -0,0 +1,7 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +if is_cmd szetup-kubectl4k3s && [ "$(systemctl is-active k3s.service)" = "active" ]; then + . <( szetup-kubectl4k3s - ) + + [[ -n "${DBG}" ]] && echo "kubectl for k3s setup complete." +fi diff --git a/_src.posix/private_dot_config/sz.env/fix-nvim.env b/_src.posix/private_dot_config/sz.env/fix-nvim.env new file mode 100644 index 0000000..4f2bb96 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/fix-nvim.env @@ -0,0 +1,22 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +if [[ -x "${CUSTOM_NVIM_PATH:-$HOME/.local/bin/nvim}" ]]; then + fix_nvim () { + CUSTOM_NVIM_PATH="${CUSTOM_NVIM_PATH:-$HOME/.local/bin/nvim}" + printf '%s\n' \ + "update-alternatives --install /usr/bin/editor editor '${CUSTOM_NVIM_PATH}' 110" \ + "update-alternatives --install /usr/bin/edit edit '${CUSTOM_NVIM_PATH}' 110" \ + "update-alternatives --install /usr/bin/ex ex '${CUSTOM_NVIM_PATH}' 110" \ + "update-alternatives --install /usr/bin/vi vi '${CUSTOM_NVIM_PATH}' 110" \ + "update-alternatives --install /usr/bin/view view '${CUSTOM_NVIM_PATH}' 110" \ + "update-alternatives --install /usr/bin/vim vim '${CUSTOM_NVIM_PATH}' 110" \ + "update-alternatives --install /usr/bin/vimdiff vimdiff '${CUSTOM_NVIM_PATH}' 110" \ + "update-alternatives --set editor '${CUSTOM_NVIM_PATH}'" \ + "update-alternatives --set edit '${CUSTOM_NVIM_PATH}'" \ + "update-alternatives --set ex '${CUSTOM_NVIM_PATH}'" \ + "update-alternatives --set vi '${CUSTOM_NVIM_PATH}'" \ + "update-alternatives --set view '${CUSTOM_NVIM_PATH}'" \ + "update-alternatives --set vim '${CUSTOM_NVIM_PATH}'" \ + "update-alternatives --set vimdiff '${CUSTOM_NVIM_PATH}'" + } +fi diff --git a/_src.posix/private_dot_config/sz.env/truenas-scale.env b/_src.posix/private_dot_config/sz.env/truenas-scale.env new file mode 100644 index 0000000..1ca907a --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/truenas-scale.env @@ -0,0 +1,19 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +if is_cmd midclt; then + if [ -n "$SCALE_POOL_ROOT" ]; then + if [ -e "$SCALE_POOL_ROOT/jailmaker/jlmkr.py" ]; then + #alias jlmkr="bash -c '_jlmkr() { $SCALE_POOL_ROOT/jailmaker/jlmkr.py \${@:---help}; }; _jlmkr \$@' " + function jlmkr() { sudo VISUAL="${VISUAL:-}" EDITOR="${EDITOR:-}" $SCALE_POOL_ROOT/jailmaker/jlmkr.py "${@:---help}"; } + + jlmkr-zellij() { + zellij action go-to-tab-name --create "jailmkr" + zellij action new-pane --name "${1:?must pass jail name}@jlmkr" -- sh -ci "reset; sudo $SCALE_POOL_ROOT/jailmaker/jlmkr.py shell --uid ${UID} ${1}" + zellij action focus-previous-pane + zellij action close-pane + } + + fi + fi +fi + diff --git a/_src.posix/private_dot_config/sz.env/zza_atuin.env b/_src.posix/private_dot_config/sz.env/zza_atuin.env new file mode 100644 index 0000000..03c93ca --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/zza_atuin.env @@ -0,0 +1,17 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} + +if is_cmd atuin; then + if [[ "${BASE_SHELL}" == "bash" ]] && ! [[ -n "$SZ_ENV_BASH_LOAD_PREEXEC$BLE_VERSION" ]]; then + printf '%s\n' \ + 'atuin was found, but bash-preexec or ble.sh are not loaded,' \ + 'to load atuin, first run update-ble.sh or update-bash-preexec ' \ + 'then relaod (_r) the shell.' + fi + + . <( atuin init "${BASE_SHELL}" ) + . <( atuin gen-completions --shell ${BASE_SHELL} ) + + [[ -n "${DBG}" ]] && echo "atuin loaded." +fi diff --git a/_src.posix/private_dot_config/sz.env/zza_starship.env b/_src.posix/private_dot_config/sz.env/zza_starship.env new file mode 100644 index 0000000..83653e8 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/zza_starship.env @@ -0,0 +1,13 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +if is_cmd load-starship; then + . <( load-starship - ) + [[ -n "${DBG}" ]] && echo "starship loaded." +elif [[ -n "${DBG}" ]]; then + >&2 printf '%s\n' \ + 'starship is not installed, you can install by running:' \ + '\tcurl -sS https://starship.rs/install.sh | FORCE=1 BIN_DIR=$HOME/bin sh > /dev/null' \ + '' + +fi + diff --git a/_src.posix/private_dot_config/sz.env/zzz_bash_post.env b/_src.posix/private_dot_config/sz.env/zzz_bash_post.env new file mode 100644 index 0000000..9139b36 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/zzz_bash_post.env @@ -0,0 +1,12 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +BASE_SHELL=${BASE_SHELL:-${SHELL##*/}} + +if [[ "${BASE_SHELL}" == "bash" ]]; then + eval "${SZ_ENV_BASH_LOAD_PREEXEC}" + if [[ -n "${BLE_VERSION-}" ]]; then + [[ -n "${DBG}" ]] && echo "attaching ble.sh" + ble-attach + fi +fi + diff --git a/_src.posix/private_dot_config/sz.env/zzz_chezmoi.env b/_src.posix/private_dot_config/sz.env/zzz_chezmoi.env new file mode 100644 index 0000000..1aa08ae --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/zzz_chezmoi.env @@ -0,0 +1,11 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' +# shellcheck disable=SC1090 + +if is_cmd 'chezmoi'; then + alias cz="chezmoi " + eval "$( chezmoi completion "${SHELL##*/}" | sed -Ee 's/(complete -o default .* chezmoi)/\1 cz/' )" + + czcd() { + cd "$(chezmoi source-path "${@}")" + } +fi diff --git a/_src.posix/private_dot_config/sz.env/zzz_fzf.env.off b/_src.posix/private_dot_config/sz.env/zzz_fzf.env.off new file mode 100644 index 0000000..71b9b42 --- /dev/null +++ b/_src.posix/private_dot_config/sz.env/zzz_fzf.env.off @@ -0,0 +1,5 @@ +#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' + +if ! is_cmd atuin && is_cmd load-fzf; then + . <( load-fzf - ) +fi diff --git a/_src.posix/private_dot_local/bin/executable_get-github-release.sh b/_src.posix/private_dot_local/bin/executable_get-github-release.sh new file mode 100644 index 0000000..dd16b97 --- /dev/null +++ b/_src.posix/private_dot_local/bin/executable_get-github-release.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env bash + +GH_PROJECT="${1}" +GH_DL_TAG="${2:-latest}" +GH_FILTER="${3:-deb}" +if [[ ! "$GH_FILTER" =~ '(' ]]; then + GH_FILTER="contains(\"${GH_FILTER}\")" +fi +SRC_URL=https://api.github.com/repos/${GH_PROJECT}/releases/${GH_DL_TAG} +DL_URL=$( \ + curl -sL curl ${SRC_URL} \ + | jq -r " \ + .assets[] \ + | select(.browser_download_url \ + | ${GH_FILTER} ) \ + | .browser_download_url \ + ") +[[ -n "$DL_URL" ]] \ + && printf "%s\n" $DL_URL \ + || return 1 2>/dev/null || exit 1 diff --git a/_src.posix/private_dot_local/bin/executable_load-starship b/_src.posix/private_dot_local/bin/executable_load-starship new file mode 100644 index 0000000..43487ea --- /dev/null +++ b/_src.posix/private_dot_local/bin/executable_load-starship @@ -0,0 +1,38 @@ +#! /usr/bin/env bash + +# Helper function +is_sourced() { + if [ -n "$ZSH_VERSION" ]; then + case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac + else # Add additional POSIX-compatible shell names here, if needed. + case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac + fi + return 1; # NOT sourced. +} + +BASE_0=${BASE_0:-$0} +BASE_SHELL=$(basename "$SHELL") + +if is_sourced; then + starship() { + if [[ ! -x "$HOME/bin/starship" ]]; then + curl -sS https://starship.rs/install.sh | FORCE=1 BIN_DIR="$HOME/bin" sh > /dev/null + fi + "$HOME/bin/starship" "${@}" + } + # shellcheck disable=SC1090 + . <( starship init "$BASE_SHELL" ) 2> /dev/null + . <( starship completions ${BASE_SHELL} ) 2> /dev/null + +elif [[ "$1" == '-' ]]; then + echo "BASE_0=${BASE_0}" + cat "${0}" +else + SCRIPT_NAME="$BASE_0" + printf '%s\n' \ + "It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \ + 'The easiest way is to call it like this:' \ + " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ + '' +fi + diff --git a/_src.posix/private_dot_local/bin/executable_load-webi b/_src.posix/private_dot_local/bin/executable_load-webi new file mode 100644 index 0000000..32e58fd --- /dev/null +++ b/_src.posix/private_dot_local/bin/executable_load-webi @@ -0,0 +1,40 @@ +#! /usr/bin/env bash + +# Helper function +is_sourced() { + if [ -n "$ZSH_VERSION" ]; then + case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac + else # Add additional POSIX-compatible shell names here, if needed. + case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac + fi + return 1; # NOT sourced. +} + +BASE_0=${BASE_0:-$0} +BASE_SHELL=$(basename "$SHELL") + +if is_sourced; then + webi() { + if [[ ! -x "${HOME}/.local/bin/webi" ]]; then + printf '%s\n' \ + "webi isn't installed, install by running:" \ + " curl -sS https://webi.sh/webi | sh" + return + fi + ${HOME}/.local/bin/webi "${@}" + } + if is_cmd webi; then + webi + fi + +elif [[ "$1" == '-' ]]; then + cat "${BASH_SOURCE[0]}" +else + SCRIPT_NAME="$BASE_0" + printf '%s\n' \ + "It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \ + 'The easiest way is to call it like this:' \ + " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ + '' +fi + diff --git a/_src.posix/private_dot_local/bin/executable_load-zellij b/_src.posix/private_dot_local/bin/executable_load-zellij new file mode 100644 index 0000000..6b2428b --- /dev/null +++ b/_src.posix/private_dot_local/bin/executable_load-zellij @@ -0,0 +1,79 @@ +#! /usr/bin/env bash + +# Helper function +is_sourced() { + if [ -n "$ZSH_VERSION" ]; then + case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac + else # Add additional POSIX-compatible shell names here, if needed. + case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac + fi + return 1; # NOT sourced. +} + +BASE_0=${BASE_0:-$0} +BASE_SHELL=$(basename "$SHELL") + +if is_sourced; then + zellij-cleanup() { + env which zellij > /dev/null && env which zellij | grep -E "^$HOME" | ${SUDO:-} xargs -tr rm + [[ -d "$HOME/.cache/zellij" ]] && echo "$HOME/.cache/zellij" | ${SUDO:-} xargs -tr rm -fR + find /tmp -maxdepth 1 -mindepth 1 -type d -name 'zellij*' -print0 | ${SUDO:-} xargs -r0t rm -fR + if [[ -d "$HOME/.cache/zellij" ]]; then + printf 'Zellij cleanup failed to remove the cache directory, you might still have a zellij session active.\n' + else + printf 'Zellij has been cleaned up, you can now reinstall it.\n' + unset zellij-cleanup + fi + } + refresh-zellij() { +${SET:-:} -x + if [ -z "$(env which zellij)" ] && ! [ -x ~/.local/bin/zellij ]; then + if [[ ! -r /tmp/zellij/bootstrap/zellij ]]; then + printf "Grabbing zellij from the web!\n" + bash <(curl -sL zellij.dev/launch) "--help" > /dev/null 2>&1 || true + fi + if [[ -r /tmp/zellij/bootstrap/zellij ]]; then + mv /tmp/zellij/bootstrap/zellij ~/.local/bin/zellij + rm -fR /tmp/zellij + fi + fi + refresh-zellij() { :; } + } + zellij() { + refresh-zellij + if [[ $# -eq 0 ]]; then + env zellij attach -c $USER@$(hostname) + else + env zellij "${@}" + fi + } + zellij-completion() { + if [[ "${BASE_SHELL}" == "zsh" ]]; then + type _zellij > /dev/null \ + || . <( env zellij setup --generate-completion zsh | sed -Ee 's/^(_(zellij) ).*/compdef \1\2/' ) + else + . <( env zellij setup --generate-completion "$BASE_SHELL" ) + fi + } +${SET:-:} -x + if [[ -n "$(env which zellij)" ]]; then + zellij-completion + fi +${SET:-:} -x + # Was needed when zsh would load + # . <( zellij setup --generate-completion "$BASE_SHELL" | sed -ne '/^function/,$p' ) + if [[ -z "$ZELLIJ_SESSION_NAME" ]]; then + zellij attach -c $USER@$(hostname) + fi + +elif [[ "$1" == '-' ]]; then + cat "${BASH_SOURCE[0]}" +else + SCRIPT_NAME="$BASE_0" + printf '%s\n' \ + "It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \ + 'The easiest way is to call it like this:' \ + " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ + '' +fi + diff --git a/_src.posix/private_dot_local/bin/executable_szetup-kubectl4k3s b/_src.posix/private_dot_local/bin/executable_szetup-kubectl4k3s new file mode 100644 index 0000000..bdeb8ab --- /dev/null +++ b/_src.posix/private_dot_local/bin/executable_szetup-kubectl4k3s @@ -0,0 +1,123 @@ +#! /usr/bin/env bash +# shellcheck disable=SC2034,SC1090 +# SC2034 variables appear unsued. export if used externally +# - uneeded, as this checked whether script is sourced +# SC1090 Can't follow non-constant source + +# Use basename instead of ${0:##*/} to be POSIX compliant +# Some shells return - in $0 when sourced, ${0#-} drops that initial dash +BASE_0=${BASE_0:-$(basename -- "${0#-}")} +SCRIPT_DIR=${SCRIPT_DIR:-"$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )"} +BASE_SHELL=$(basename "$SHELL") + +# Helper function +is_sourced() { + DBG_="$( + printf '\n\t\t%-12s%s' '$0:' "$0" BASE_0: "$BASE_0" BASE_SHELL: "$BASE_SHELL" + )" + if [ -n "$ZSH_VERSION" ]; then + case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac + else + case "$(basename -- "${0}")" in $BASE_SHELL|-$BASE_SHELL) return 0;; esac + fi + return 1; # NOT sourced. +} + +if [[ "$1" == '-' ]]; then + printf 'BASE_0="%s"\nSCRIPT_DIR=%s\n' "${BASE_0}" "${SCRIPT_DIR}" + cat "${BASH_SOURCE[0]}" +elif is_sourced; then + # This part is sourced, and might run in a non-bash shell + DBG_="Is Sourced" + USER_HOME=$HOME + [[ -n "${SUDO_USER}" ]] && USER_HOME="$(eval "echo ~${SUDO_USER}")" + + [[ -n "$KUBECONFIG" && -r "$KUBECONFIG" ]] || unset KUBECONFIG + + [[ ! -r "$HOME/.kube/config" ]] \ + || export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}" + + if [[ -z "$KUBECONFIG" && -z "$FIX_KUBECTL_RECALL" ]]; then + (unset kubectl 2>/dev/null) || (unalias kubectl 2>/dev/null) || true + + export KUBECONFIG=/etc/rancher/k3s/k3s.yaml + fi + + (unset kubectl-fix 2> /dev/null) || true + + DBG_="Check if k3s exists, but kubectl isn't available" + if (type 'k3s' >/dev/null 2>&1) && ! (type 'kubectl' >/dev/null 2>&1); then + DBG_="Define kubectl" + if [[ -r "${KUBECONFIG}" ]]; then + kubectl() { k3s kubectl "${@}"; } + elif [[ -n "${KUBECONFIG}" && -e "${KUBECONFIG}" ]]; then + eval " + kubectl-fix() { + mkdir \"$HOME/.kube\" -p + if [[ -e \"\${KUBECONFIG}\" && ! -r \"$HOME/.kube/config\" ]]; then + sudo install --mod 600 --owner \"$USER\" \"\${KUBECONFIG}\" \"$HOME/.kube/config\" + unset KUBECONFIG + fi + FIX_KUBECTL_RECALL=1 . \"${SCRIPT_DIR}/${BASE_0}\" + }" + printf '%s\n' \ + "KUBECONFIG[${KUBECONFIG}] exsits, but is unreadable." \ + 'Run kubectl-fix (which will invoke sudo) to fix' + fi + fi + + if (type 'kubectl' >/dev/null 2>&1); then + + . <( kubectl completion "${BASE_SHELL}" ) + + if (type 'kubectl-cnpg' >/dev/null 2>&1 ); then + . <( kubectl cnpg completion "${BASE_SHELL}" ) + fi + if ! (type 'kubectl-cnpg' >/dev/null 2>&1) || [[ -n "$UPGRADE" ]]; then + DL_VER=1.22.0 + GH_URL=https://github.com/cloudnative-pg/cloudnative-pg + DL_FILE="kubectl-cnpg_${DL_VER}_linux_x86_64.deb" + URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE} + printf '%s\n' \ + 'To download and install cnpg kubectl plugin, run:' \ + " curl -sSLO ${URL}" \ + " sudo dpkg -i $DL_FILE" + fi + + if ! (type 'kubetui' >/dev/null 2>&1) || [[ -n "$UPGRADE" ]]; then + DL_VER=1.5.0 + GH_URL=https://github.com/sarub0b0/kubetui + DL_FILE=kubetui-x86_64-unknown-linux-musl-rustls + URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE} + printf '%s\n' \ + 'To download and install kubetui, run:' \ + " curl -sSL ${URL} > ~/bin/kubetui" \ + " chmod +x ~/bin/kubetui" + fi + + if ! (type 'k9s' >/dev/null 2>&1) || [[ -n "$UPGRADE" ]]; then + printf '%s\n' \ + 'To download and install k9s, run:' \ + " curl -sS https://webinstall.dev/k9s | bash" + fi + + if (type 'k3s' >/dev/null 2>&1 ); then + . <( k3s completion "${SHELL##*/}" ) + fi + + if (type 'helm' >/dev/null 2>&1); then + . <( helm completion "${SHELL##*/}" 2>/dev/null ) + fi + + kg() { + kubectl get "${NS:+--namespace=}${NS:---all-namespaces}" "${@:-pods}" | { sed -u 1q; sort; } + } + fi +else + SCRIPT_NAME="$BASE_0" + printf '%s\n' \ + "It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \ + 'The easiest way is to call it like this:' \ + " $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \ + '' +fi diff --git a/_src.posix/private_dot_local/bin/executable_update-atuin b/_src.posix/private_dot_local/bin/executable_update-atuin new file mode 100644 index 0000000..816f97f --- /dev/null +++ b/_src.posix/private_dot_local/bin/executable_update-atuin @@ -0,0 +1,32 @@ +#! /usr/bin/env bash + +set -e + +BASE_0=${BASE_0:-$0} +BASE_SHELL=$(basename "$SHELL") + +#! /usr/bin/env bash + +_update-atuin() { ( + set -e + + local LatestURL="$( + get-github-release.sh \ + atuinsh/atuin \ + latest atuin-x86_64-unknown-linux-musl.tar.gz \ + | grep -E 'tar\.gz$' + )" + local dlPath="$(mktemp --directory --suffix atuin)" + local appPath="$HOME/.local/bin" + printf 'Downloading from %s... ' "${LatestURL#*/download/}" + curl -sLO --output-dir "$dlPath" "$LatestURL" && printf 'Done' + printf '\n' + ( cd "$dlPath"; curl -sL "$LatestURL.sha256" | sha256sum --check ) + ( cd "$appPath"; tar zxf "$dlPath"/*.tar.gz --strip-components=1 --no-anchored 'atuin' ) + rm -R "$dlPath" + + printf '%s\n' \ + 'atuin binary installed, please restart you shell' +); } + +_update-atuin "${@}" diff --git a/_src.posix/private_dot_local/bin/executable_update-nvim b/_src.posix/private_dot_local/bin/executable_update-nvim new file mode 100644 index 0000000..512d4d0 --- /dev/null +++ b/_src.posix/private_dot_local/bin/executable_update-nvim @@ -0,0 +1,57 @@ +#! /usr/bin/env bash + +set -e + +BASE_0=${BASE_0:-$0} +BASE_SHELL=$(basename "$SHELL") + +_update-nvim() { + local LatestURL="$(get-github-release.sh \ + neovim/neovim latest appimage \ + | grep appimage\$ + )" + local appDir="${HOME}/.local/bin" + if [ "$USER" = "root" ]; then + appDir="${HOME}/usr-local-bin" + while umount --types overlay /usr/local/bin 2>/dev/null; do + : + done + mkdir -pm 755 "$appDir" \ + && mount -t overlay overlay -o "lowerdir=$appDir:/usr/local/bin" /usr/local/bin + update-alternatives --remove vim.tiny /usr/bin/vim.tiny + fi + local appPath="${appDir}/nvim.AppImage" + + rm "${appDir}/"{nvim.AppImage,nvim,vi,vim,vim.tiny,vimdiff} 2>/dev/null || true + + printf 'Downloading from %s... ' "${LatestURL#*/download/}" + curl -sLo "$appPath" "$LatestURL" && printf 'Done' + printf '\n' + chmod +x "$appPath" + + ln -rs "$appPath" "${appDir}/nvim" + ln -rs "$appPath" "${appDir}/vi" + ln -rs "$appPath" "${appDir}/vim" + ln -rs "$appPath" "${appDir}/vim.tiny" + ln -rs "$appPath" "${appDir}/vimdiff" + + if [ "$USER" = "root" ]; then + update-alternatives --install /usr/bin/editor editor "$appPath" 110 + update-alternatives --install /usr/bin/edit edit "$appPath" 110 + update-alternatives --install /usr/bin/ex ex "$appPath" 110 + update-alternatives --install /usr/bin/vi vi "$appPath" 110 + update-alternatives --install /usr/bin/view view "$appPath" 110 + update-alternatives --install /usr/bin/vim vim "$appPath" 110 + update-alternatives --install /usr/bin/vimdiff vimdiff "$appPath" 110 + update-alternatives --set editor "$appPath" + update-alternatives --set edit "$appPath" + update-alternatives --set ex "$appPath" + update-alternatives --set vi "$appPath" + update-alternatives --set view "$appPath" + update-alternatives --set vim "$appPath" + update-alternatives --set vimdiff "$appPath" + + fi +} + +_update-nvim "${@}" diff --git a/_src.posix/private_dot_local/bin/symlink_nvim b/_src.posix/private_dot_local/bin/symlink_nvim new file mode 100644 index 0000000..f280f47 --- /dev/null +++ b/_src.posix/private_dot_local/bin/symlink_nvim @@ -0,0 +1 @@ +nvim.AppImage diff --git a/_src.posix/private_dot_local/bin/symlink_vi b/_src.posix/private_dot_local/bin/symlink_vi new file mode 100644 index 0000000..732ff53 --- /dev/null +++ b/_src.posix/private_dot_local/bin/symlink_vi @@ -0,0 +1 @@ +nvim diff --git a/_src.posix/private_dot_local/bin/symlink_vim b/_src.posix/private_dot_local/bin/symlink_vim new file mode 100644 index 0000000..732ff53 --- /dev/null +++ b/_src.posix/private_dot_local/bin/symlink_vim @@ -0,0 +1 @@ +nvim diff --git a/_src.posix/private_dot_local/bin/symlink_vim.tiny b/_src.posix/private_dot_local/bin/symlink_vim.tiny new file mode 100644 index 0000000..732ff53 --- /dev/null +++ b/_src.posix/private_dot_local/bin/symlink_vim.tiny @@ -0,0 +1 @@ +nvim diff --git a/_src.posix/private_dot_local/bin/symlink_vimdiff b/_src.posix/private_dot_local/bin/symlink_vimdiff new file mode 100644 index 0000000..732ff53 --- /dev/null +++ b/_src.posix/private_dot_local/bin/symlink_vimdiff @@ -0,0 +1 @@ +nvim diff --git a/base.chezmoiroot.linux b/base.chezmoiroot.linux new file mode 120000 index 0000000..1bb9fa1 --- /dev/null +++ b/base.chezmoiroot.linux @@ -0,0 +1 @@ +base.chezmoiroot.posix \ No newline at end of file diff --git a/base.chezmoiroot.macos b/base.chezmoiroot.macos new file mode 100644 index 0000000..b42b5ea --- /dev/null +++ b/base.chezmoiroot.macos @@ -0,0 +1 @@ +_home.macos diff --git a/base.chezmoiroot.macos.laptop b/base.chezmoiroot.macos.laptop new file mode 120000 index 0000000..9db2158 --- /dev/null +++ b/base.chezmoiroot.macos.laptop @@ -0,0 +1 @@ +base.chezmoiroot.macos \ No newline at end of file diff --git a/.chezmoiroot b/base.chezmoiroot.posix similarity index 100% rename from .chezmoiroot rename to base.chezmoiroot.posix diff --git a/symclone.sh b/symclone.sh new file mode 100755 index 0000000..e855fad --- /dev/null +++ b/symclone.sh @@ -0,0 +1,58 @@ +#! /usr/bin/env bash + +set -e + +# Source directory (existing structure with files) +SRC_DIR=_src.posix + +# Target directory (new structure with symlinks) +DEST_DIR="${1:?}" + +# Check if both arguments are provided +if [[ -z "$SRC_DIR" || -z "$DEST_DIR" ]]; then + echo "Usage: $0 " + exit 1 +fi + +# Ensure source directory exists +if [[ ! -d "$SRC_DIR" ]]; then + echo "Error: Source directory '$SRC_DIR' does not exist." + exit 1 +fi + +# Create destination directory if it does not exist +mkdir -p "$DEST_DIR" + +# Find all directories and recreate them in the destination +find "$SRC_DIR" -type d -mindepth 1 | while read -r dir; do + mkdir -p "$DEST_DIR/${dir#$SRC_DIR/}" +done + +# Function to get relative path without realpath or python +relpath() { + local target=$1 + local base=$2 + local target_abs=$(cd "$(dirname "$target")" && pwd)/$(basename "$target") + local base_abs=$(cd "$base" && pwd) + local common_part="$base_abs" + local back="" + + while [[ "${target_abs#$common_part}" == "$target_abs" ]]; do + common_part=$(dirname "$common_part") + back="../$back" + done + + echo "${back}${target_abs#$common_part/}" +} + +# Find all files and create symbolic links in the destination +find "$SRC_DIR" -type f | while read -r file; do + # Determine the relative path for the symlink + target_file="${file#$SRC_DIR/}" + src_relative_path=$(relpath "$file" "$(dirname "$DEST_DIR/$target_file")") + + # Create the symlink with relative path + ln -vs "$src_relative_path" "$DEST_DIR/$target_file" +done + +echo "Symbolic links created successfully in '$DEST_DIR'."