mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 04:24:10 -06:00
feat: major dotfiles refactor with documentation and multi-platform improvements
- Add comprehensive CLAUDE.md with chezmoi best practices and AI assistant guidelines - Restructure TODO.md with prioritized tasks and detailed organization - Add PowerShell profile template for Windows platform support - Split git configs into identity-specific templates (ryan/xevion) - Convert nushell env.nu and gitconfig to templates for cross-platform rendering - Refactor chezmoi hooks to TypeScript (.init_pre.ts, .update_pre.ts) - Update .chezmoiignore with better platform-specific file handling - Remove deprecated shellchecker.sh and tasks.json from VS Code config - Add mise integration to shell configs (bash, zsh, nushell, PowerShell) - Clean up commonrc.sh.tmpl WSL-specific code - Disable Deno in VS Code settings, enable simple dialog mode - Add nushell extension recommendation to VS Code This commit establishes better cross-platform support (Windows/WSL/Linux), improves documentation for future maintenance, and standardizes configuration management patterns across the repository.
This commit is contained in:
@@ -54,18 +54,19 @@ args = [
|
||||
cores = {{ $cpuCores }}
|
||||
threads = {{ $cpuThreads }}
|
||||
|
||||
encryption = "age"
|
||||
[age]
|
||||
identity = "{{ .chezmoi.homeDir }}/key.txt"
|
||||
recipient = "age1s3ctpj9lafl6qwyvd89sn448us7gdzd53d8yyhsc7zny78c0k4sqerrkze"
|
||||
|
||||
encryption = "age"
|
||||
|
||||
[doppler]
|
||||
project = "dotfiles"
|
||||
config = "production"
|
||||
|
||||
[hooks.init.pre]
|
||||
command = "{{ .chezmoi.sourceDir }}/hooks/.init_pre.ts"
|
||||
command = "bun"
|
||||
args = ["{{ .chezmoi.sourceDir }}/hooks/.init_pre.ts"]
|
||||
[hooks.update.pre]
|
||||
command = "{{ .chezmoi.sourceDir }}/hooks/.update_pre.sh"
|
||||
[hooks.read-source-state.pre]
|
||||
command = "{{ .chezmoi.sourceDir }}/hooks/.read-source-state_pre.sh"
|
||||
command = "bun"
|
||||
args = ["{{ .chezmoi.sourceDir }}/hooks/.update_pre.ts"]
|
||||
|
||||
+10
-4
@@ -14,21 +14,27 @@ tool-versions
|
||||
.asdf/repository/**
|
||||
|
||||
{{ if eq .chezmoi.os "windows" }}
|
||||
{{/* Ignore Linux/Unix-only files on Windows */}}
|
||||
|
||||
# Shell configs (Linux-only)
|
||||
.oh-my-zsh
|
||||
.scripts
|
||||
*.zsh
|
||||
.zshrc
|
||||
.bashrc
|
||||
.profile
|
||||
.bash_aliases
|
||||
key.txt
|
||||
.passwd-s3fs.age
|
||||
.profile
|
||||
.tmux.conf
|
||||
{{/* this may be pretty broad, will need to be adjusted */}}
|
||||
.config
|
||||
|
||||
# Linux-only config directories
|
||||
.config/kitty
|
||||
|
||||
{{ else }}
|
||||
{{/* Ignore Windows-only files on Linux/macOS */}}
|
||||
|
||||
Documents
|
||||
# Windows-only
|
||||
Documents/PowerShell
|
||||
|
||||
{{ end }}
|
||||
|
||||
@@ -127,9 +127,4 @@ fi
|
||||
# export EDITOR='micro'
|
||||
# else
|
||||
# export EDITOR='nvim'
|
||||
# fi
|
||||
|
||||
# If WSL, add SSH key on startup (once per WSL start)
|
||||
{{- if .data.wsl }}
|
||||
eval `keychain --quiet --eval --agents ssh ~/.ssh/id_rsa`
|
||||
{{ end }}
|
||||
# fi
|
||||
@@ -0,0 +1,134 @@
|
||||
# {{ template "banner.tmpl" .}}
|
||||
# PowerShell Profile for Windows
|
||||
# Managed by chezmoi
|
||||
|
||||
# Disable PowerShell update notifications
|
||||
$env:POWERSHELL_UPDATE_CHECK = "Off"
|
||||
|
||||
# Editor configuration
|
||||
$env:EDITOR = "micro"
|
||||
$env:MICRO_TRUECOLOR = 1
|
||||
|
||||
# OpenAI API Key
|
||||
$env:OPENAI_API_KEY = "{{ dopplerProjectJson.OPENAI_CHATGPT_CLI }}"
|
||||
|
||||
# PATH additions - Windows style
|
||||
# User local bin
|
||||
$env:PATH = "$env:USERPROFILE\.local\bin;$env:PATH"
|
||||
|
||||
# Go
|
||||
if (Test-Path "$env:USERPROFILE\go") {
|
||||
$env:PATH = "$env:USERPROFILE\go\bin;$env:PATH"
|
||||
}
|
||||
if (Test-Path "C:\Program Files\Go") {
|
||||
$env:PATH = "C:\Program Files\Go\bin;$env:PATH"
|
||||
}
|
||||
|
||||
# Rust/Cargo
|
||||
if (Test-Path "$env:USERPROFILE\.cargo") {
|
||||
$env:PATH = "$env:USERPROFILE\.cargo\bin;$env:PATH"
|
||||
}
|
||||
|
||||
# Deno
|
||||
if (Test-Path "$env:USERPROFILE\.deno") {
|
||||
$env:DENO_INSTALL = "$env:USERPROFILE\.deno"
|
||||
$env:PATH = "$env:DENO_INSTALL\bin;$env:PATH"
|
||||
}
|
||||
|
||||
# Node/pnpm
|
||||
if (Test-Path "$env:LOCALAPPDATA\pnpm") {
|
||||
$env:PNPM_HOME = "$env:LOCALAPPDATA\pnpm"
|
||||
$env:PATH = "$env:PNPM_HOME;$env:PATH"
|
||||
}
|
||||
|
||||
# Bun
|
||||
if (Test-Path "$env:USERPROFILE\.bun") {
|
||||
$env:BUN_INSTALL = "$env:USERPROFILE\.bun"
|
||||
$env:PATH = "$env:BUN_INSTALL\bin;$env:PATH"
|
||||
}
|
||||
|
||||
# Python/pyenv (Windows)
|
||||
if (Test-Path "$env:USERPROFILE\.pyenv\pyenv-win") {
|
||||
$env:PYENV = "$env:USERPROFILE\.pyenv\pyenv-win"
|
||||
$env:PYENV_ROOT = "$env:PYENV"
|
||||
$env:PYENV_HOME = "$env:PYENV"
|
||||
$env:PATH = "$env:PYENV\bin;$env:PYENV\shims;$env:PATH"
|
||||
}
|
||||
|
||||
# .NET
|
||||
if (Test-Path "$env:USERPROFILE\.dotnet") {
|
||||
$env:DOTNET_ROOT = "$env:USERPROFILE\.dotnet"
|
||||
$env:PATH = "$env:DOTNET_ROOT;$env:DOTNET_ROOT\tools;$env:PATH"
|
||||
}
|
||||
|
||||
# Java/jenv (if using jenv-for-windows or similar)
|
||||
if (Test-Path "$env:USERPROFILE\.jenv") {
|
||||
$env:PATH = "$env:USERPROFILE\.jenv\bin;$env:PATH"
|
||||
}
|
||||
|
||||
# Bob (Neovim version manager)
|
||||
if (Test-Path "$env:LOCALAPPDATA\bob\nvim-bin") {
|
||||
$env:PATH = "$env:LOCALAPPDATA\bob\nvim-bin;$env:PATH"
|
||||
}
|
||||
|
||||
# Spicetify
|
||||
if (Test-Path "$env:USERPROFILE\.spicetify") {
|
||||
$env:PATH = "$env:USERPROFILE\.spicetify;$env:PATH"
|
||||
}
|
||||
|
||||
# Pulumi
|
||||
if (Test-Path "$env:USERPROFILE\.pulumi\bin") {
|
||||
$env:PATH = "$env:USERPROFILE\.pulumi\bin;$env:PATH"
|
||||
}
|
||||
|
||||
# Scoop (if installed)
|
||||
if (Test-Path "$env:USERPROFILE\scoop\shims") {
|
||||
$env:PATH = "$env:USERPROFILE\scoop\shims;$env:PATH"
|
||||
}
|
||||
|
||||
# Chocolatey profile (if exists)
|
||||
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
||||
if (Test-Path $ChocolateyProfile) {
|
||||
Import-Module $ChocolateyProfile
|
||||
}
|
||||
|
||||
# mise - polyglot tool version manager
|
||||
# Activates mise if installed (provides tools like vault, node, python, etc.)
|
||||
if (Get-Command mise -ErrorAction SilentlyContinue) {
|
||||
Invoke-Expression (& mise activate pwsh | Out-String)
|
||||
}
|
||||
|
||||
# Aliases - PowerShell equivalents of bash aliases
|
||||
Set-Alias -Name nano -Value micro
|
||||
Set-Alias -Name vim -Value nvim
|
||||
Set-Alias -Name lg -Value lazygit
|
||||
|
||||
# Functions
|
||||
function ll { Get-ChildItem -Force | Format-Table -AutoSize }
|
||||
function la { Get-ChildItem -Force }
|
||||
function es { & $PROFILE } # Reload profile
|
||||
|
||||
# Chezmoi aliases
|
||||
function cha { chezmoi apply --interactive }
|
||||
Set-Alias -Name ch -Value chezmoi
|
||||
|
||||
# Git aliases
|
||||
function ga { git add $args }
|
||||
function gaa { git add . }
|
||||
function gc { git commit $args }
|
||||
function gcm { git commit -m $args }
|
||||
function gco { git checkout $args }
|
||||
function gd { git diff $args }
|
||||
function gs { git status $args }
|
||||
function gp { git pull $args }
|
||||
function gst { git stash $args }
|
||||
|
||||
# Initialize completions if available
|
||||
if (Get-Command chezmoi -ErrorAction SilentlyContinue) {
|
||||
# Chezmoi completion can be set up if needed
|
||||
}
|
||||
|
||||
# VSCode integration
|
||||
if ($env:TERM_PROGRAM -eq "vscode") {
|
||||
# VSCode shell integration
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# Ryan Walters identity override
|
||||
# Use this for work/professional repositories
|
||||
#
|
||||
# To use in a repository, run:
|
||||
# git config --local include.path ~/.config/git/config-ryan
|
||||
|
||||
[user]
|
||||
name = Ryan Walters
|
||||
email = ryan@walters.to
|
||||
signingkey = 39538EC79ACF2597
|
||||
{{ if eq .chezmoi.os "windows" }}
|
||||
{{ else }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,13 @@
|
||||
# Xevion identity override
|
||||
# Use this for personal/open-source repositories
|
||||
#
|
||||
# To use in a repository, run:
|
||||
# git config --local include.path ~/.config/git/config-xevion
|
||||
|
||||
[user]
|
||||
name = Xevion
|
||||
email = xevion@xevion.dev
|
||||
signingkey = C217005CF3C00672
|
||||
{{ if eq .chezmoi.os "windows" }}
|
||||
{{ else }}
|
||||
{{ end }}
|
||||
@@ -896,4 +896,20 @@ $env.config = {
|
||||
event: { edit: selectall }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
# mise - polyglot tool version manager
|
||||
# Activates mise if installed (provides tools like vault, node, python, etc.)
|
||||
# This adds mise-managed tool paths to $env.PATH dynamically based on the current directory
|
||||
if (which mise | is-not-empty) {
|
||||
$env.MISE_SHELL = "nu"
|
||||
|
||||
# Create the mise activation directory if it doesn't exist
|
||||
let mise_cache = $"($nu.data-dir)/mise"
|
||||
mkdir $mise_cache
|
||||
|
||||
# Run mise hook to setup environment for current directory
|
||||
$env.PATH = ($env.PATH | split row (char esep))
|
||||
mise hook-env -s nu | save --force $"($mise_cache)/hook-env.nu"
|
||||
source $"($mise_cache)/hook-env.nu"
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
# Nushell Environment Config File
|
||||
#
|
||||
# version = "0.98.0"
|
||||
|
||||
def create_left_prompt [] {
|
||||
let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) {
|
||||
null => $env.PWD
|
||||
'' => '~'
|
||||
$relative_pwd => ([~ $relative_pwd] | path join)
|
||||
}
|
||||
|
||||
let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
|
||||
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
|
||||
let path_segment = $"($path_color)($dir)(ansi reset)"
|
||||
|
||||
$path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)"
|
||||
}
|
||||
|
||||
def create_right_prompt [] {
|
||||
# create a right prompt in magenta with green separators and am/pm underlined
|
||||
let time_segment = ([
|
||||
(ansi reset)
|
||||
(ansi magenta)
|
||||
(date now | format date '%x %X') # try to respect user's locale
|
||||
] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" |
|
||||
str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}")
|
||||
|
||||
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
|
||||
(ansi rb)
|
||||
($env.LAST_EXIT_CODE)
|
||||
] | str join)
|
||||
} else { "" }
|
||||
|
||||
([$last_exit_code, (char space), $time_segment] | str join)
|
||||
}
|
||||
|
||||
# Use nushell functions to define your right and left prompt
|
||||
$env.PROMPT_COMMAND = {|| create_left_prompt }
|
||||
# FIXME: This default is not implemented in rust code as of 2023-09-08.
|
||||
$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
|
||||
|
||||
# The prompt indicators are environmental variables that represent
|
||||
# the state of the prompt
|
||||
$env.PROMPT_INDICATOR = {|| "> " }
|
||||
$env.PROMPT_INDICATOR_VI_INSERT = {|| ": " }
|
||||
$env.PROMPT_INDICATOR_VI_NORMAL = {|| "> " }
|
||||
$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " }
|
||||
|
||||
# If you want previously entered commands to have a different prompt from the usual one,
|
||||
# you can uncomment one or more of the following lines.
|
||||
# This can be useful if you have a 2-line prompt and it's taking up a lot of space
|
||||
# because every command entered takes up 2 lines instead of 1. You can then uncomment
|
||||
# the line below so that previously entered commands show with a single `🚀`.
|
||||
# $env.TRANSIENT_PROMPT_COMMAND = {|| "🚀 " }
|
||||
# $env.TRANSIENT_PROMPT_INDICATOR = {|| "" }
|
||||
# $env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = {|| "" }
|
||||
# $env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = {|| "" }
|
||||
# $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = {|| "" }
|
||||
# $env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| "" }
|
||||
|
||||
# Specifies how environment variables are:
|
||||
# - converted from a string to a value on Nushell startup (from_string)
|
||||
# - converted from a value back to a string when running external commands (to_string)
|
||||
# Note: The conversions happen *after* config.nu is loaded
|
||||
$env.ENV_CONVERSIONS = {
|
||||
"PATH": {
|
||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||
}
|
||||
"Path": {
|
||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||
}
|
||||
}
|
||||
|
||||
# Directories to search for scripts when calling source or use
|
||||
# The default for this is $nu.default-config-dir/scripts
|
||||
$env.NU_LIB_DIRS = [
|
||||
($nu.default-config-dir | path join 'scripts') # add <nushell-config-dir>/scripts
|
||||
($nu.data-dir | path join 'completions') # default home for nushell completions
|
||||
]
|
||||
|
||||
# Directories to search for plugin binaries when calling register
|
||||
# The default for this is $nu.default-config-dir/plugins
|
||||
$env.NU_PLUGIN_DIRS = [
|
||||
($nu.default-config-dir | path join 'plugins') # add <nushell-config-dir>/plugins
|
||||
]
|
||||
|
||||
# To add entries to PATH (on Windows you might use Path), you can use the following pattern:
|
||||
# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path')
|
||||
# An alternate way to add entries to $env.PATH is to use the custom command `path add`
|
||||
# which is built into the nushell stdlib:
|
||||
# use std "path add"
|
||||
# $env.PATH = ($env.PATH | split row (char esep))
|
||||
# path add /some/path
|
||||
# path add ($env.CARGO_HOME | path join "bin")
|
||||
# path add ($env.HOME | path join ".local" "bin")
|
||||
# $env.PATH = ($env.PATH | uniq)
|
||||
|
||||
# To load from a custom file you can use:
|
||||
# source ($nu.default-config-dir | path join 'custom.nu')
|
||||
@@ -0,0 +1,242 @@
|
||||
# {{ template "banner.tmpl" .}}
|
||||
# Nushell Environment Config File
|
||||
# Cross-platform configuration for Windows and Linux
|
||||
# version = "0.98.0"
|
||||
|
||||
def create_left_prompt [] {
|
||||
let dir = match (try { $env.PWD | path relative-to $nu.home-path } catch { null }) {
|
||||
null => $env.PWD
|
||||
'' => '~'
|
||||
$relative_pwd => ([~ $relative_pwd] | path join)
|
||||
}
|
||||
|
||||
let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
|
||||
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
|
||||
let path_segment = $"($path_color)($dir)(ansi reset)"
|
||||
|
||||
$path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)"
|
||||
}
|
||||
|
||||
def create_right_prompt [] {
|
||||
let time_segment = ([
|
||||
(ansi reset)
|
||||
(ansi magenta)
|
||||
(date now | format date '%x %X')
|
||||
] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" |
|
||||
str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}")
|
||||
|
||||
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
|
||||
(ansi rb)
|
||||
($env.LAST_EXIT_CODE)
|
||||
] | str join)
|
||||
} else { "" }
|
||||
|
||||
([$last_exit_code, (char space), $time_segment] | str join)
|
||||
}
|
||||
|
||||
$env.PROMPT_COMMAND = {|| create_left_prompt }
|
||||
$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
|
||||
$env.PROMPT_INDICATOR = {|| "> " }
|
||||
$env.PROMPT_INDICATOR_VI_INSERT = {|| ": " }
|
||||
$env.PROMPT_INDICATOR_VI_NORMAL = {|| "> " }
|
||||
$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " }
|
||||
|
||||
# Environment variable conversions
|
||||
$env.ENV_CONVERSIONS = {
|
||||
"PATH": {
|
||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||
}
|
||||
"Path": {
|
||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||
}
|
||||
}
|
||||
|
||||
# Library and plugin directories
|
||||
$env.NU_LIB_DIRS = [
|
||||
($nu.default-config-dir | path join 'scripts')
|
||||
($nu.data-dir | path join 'completions')
|
||||
]
|
||||
|
||||
$env.NU_PLUGIN_DIRS = [
|
||||
($nu.default-config-dir | path join 'plugins')
|
||||
]
|
||||
|
||||
# Editor configuration
|
||||
$env.EDITOR = "micro"
|
||||
$env.MICRO_TRUECOLOR = 1
|
||||
|
||||
# OpenAI API Key
|
||||
$env.OPENAI_API_KEY = "{{ dopplerProjectJson.OPENAI_CHATGPT_CLI }}"
|
||||
|
||||
# Initialize PATH as a list for easier manipulation
|
||||
$env.PATH = ($env.PATH | split row (char esep))
|
||||
|
||||
# Platform-specific PATH additions
|
||||
{{ if eq .chezmoi.os "windows" }}
|
||||
# Windows PATH additions
|
||||
|
||||
# User local bin
|
||||
$env.PATH = ($env.PATH | prepend ($env.USERPROFILE | path join ".local" "bin"))
|
||||
|
||||
# Go
|
||||
let go_user = ($env.USERPROFILE | path join "go" "bin")
|
||||
let go_system = "C:\\Program Files\\Go\\bin"
|
||||
if ($go_user | path exists) { $env.PATH = ($env.PATH | prepend $go_user) }
|
||||
if ($go_system | path exists) { $env.PATH = ($env.PATH | prepend $go_system) }
|
||||
|
||||
# Rust/Cargo
|
||||
let cargo_bin = ($env.USERPROFILE | path join ".cargo" "bin")
|
||||
if ($cargo_bin | path exists) { $env.PATH = ($env.PATH | prepend $cargo_bin) }
|
||||
|
||||
# Deno
|
||||
let deno_bin = ($env.USERPROFILE | path join ".deno" "bin")
|
||||
if ($deno_bin | path exists) {
|
||||
$env.DENO_INSTALL = ($env.USERPROFILE | path join ".deno")
|
||||
$env.PATH = ($env.PATH | prepend $deno_bin)
|
||||
}
|
||||
|
||||
# Node/pnpm
|
||||
let pnpm_home = ($env.LOCALAPPDATA | path join "pnpm")
|
||||
if ($pnpm_home | path exists) {
|
||||
$env.PNPM_HOME = $pnpm_home
|
||||
$env.PATH = ($env.PATH | prepend $pnpm_home)
|
||||
}
|
||||
|
||||
# Bun
|
||||
let bun_bin = ($env.USERPROFILE | path join ".bun" "bin")
|
||||
if ($bun_bin | path exists) {
|
||||
$env.BUN_INSTALL = ($env.USERPROFILE | path join ".bun")
|
||||
$env.PATH = ($env.PATH | prepend $bun_bin)
|
||||
}
|
||||
|
||||
# Python/pyenv
|
||||
let pyenv_root = ($env.USERPROFILE | path join ".pyenv" "pyenv-win")
|
||||
if ($pyenv_root | path exists) {
|
||||
$env.PYENV_ROOT = $pyenv_root
|
||||
$env.PATH = ($env.PATH | prepend ($pyenv_root | path join "bin"))
|
||||
$env.PATH = ($env.PATH | prepend ($pyenv_root | path join "shims"))
|
||||
}
|
||||
|
||||
# .NET
|
||||
let dotnet_root = ($env.USERPROFILE | path join ".dotnet")
|
||||
if ($dotnet_root | path exists) {
|
||||
$env.DOTNET_ROOT = $dotnet_root
|
||||
$env.PATH = ($env.PATH | prepend $dotnet_root)
|
||||
$env.PATH = ($env.PATH | prepend ($dotnet_root | path join "tools"))
|
||||
}
|
||||
|
||||
# Bob (Neovim version manager)
|
||||
let bob_bin = ($env.LOCALAPPDATA | path join "bob" "nvim-bin")
|
||||
if ($bob_bin | path exists) { $env.PATH = ($env.PATH | prepend $bob_bin) }
|
||||
|
||||
# Spicetify
|
||||
let spicetify = ($env.USERPROFILE | path join ".spicetify")
|
||||
if ($spicetify | path exists) { $env.PATH = ($env.PATH | prepend $spicetify) }
|
||||
|
||||
# Pulumi
|
||||
let pulumi_bin = ($env.USERPROFILE | path join ".pulumi" "bin")
|
||||
if ($pulumi_bin | path exists) { $env.PATH = ($env.PATH | prepend $pulumi_bin) }
|
||||
|
||||
# Scoop
|
||||
let scoop_shims = ($env.USERPROFILE | path join "scoop" "shims")
|
||||
if ($scoop_shims | path exists) { $env.PATH = ($env.PATH | prepend $scoop_shims) }
|
||||
|
||||
{{ else }}
|
||||
# Linux/macOS PATH additions
|
||||
|
||||
# User local bin
|
||||
$env.PATH = ($env.PATH | prepend ($env.HOME | path join ".local" "bin"))
|
||||
|
||||
# System bins
|
||||
$env.PATH = ($env.PATH | prepend "/usr/local/bin")
|
||||
$env.PATH = ($env.PATH | prepend ($env.HOME | path join "bin"))
|
||||
|
||||
# Go
|
||||
let go_bin = "/usr/local/go/bin"
|
||||
let go_user = ($env.HOME | path join "go" "bin")
|
||||
if ($go_bin | path exists) { $env.PATH = ($env.PATH | prepend $go_bin) }
|
||||
if ($go_user | path exists) { $env.PATH = ($env.PATH | prepend $go_user) }
|
||||
|
||||
# Rust/Cargo
|
||||
let cargo_bin = ($env.HOME | path join ".cargo" "bin")
|
||||
if ($cargo_bin | path exists) { $env.PATH = ($env.PATH | prepend $cargo_bin) }
|
||||
|
||||
# Deno
|
||||
let deno_bin = ($env.HOME | path join ".deno" "bin")
|
||||
if ($deno_bin | path exists) { $env.PATH = ($env.PATH | prepend $deno_bin) }
|
||||
|
||||
# Bob (Neovim version manager)
|
||||
let bob_bin = ($env.HOME | path join ".local" "share" "bob" "nvim-bin")
|
||||
if ($bob_bin | path exists) { $env.PATH = ($env.PATH | prepend $bob_bin) }
|
||||
|
||||
# Homebrew (Linux)
|
||||
let brew_bin = "/home/linuxbrew/.linuxbrew/bin"
|
||||
if ($brew_bin | path exists) {
|
||||
$env.PATH = ($env.PATH | prepend $brew_bin)
|
||||
$env.PATH = ($env.PATH | prepend "/home/linuxbrew/.linuxbrew/sbin")
|
||||
}
|
||||
|
||||
# pnpm
|
||||
let pnpm_home = ($env.HOME | path join ".local" "share" "pnpm")
|
||||
if ($pnpm_home | path exists) {
|
||||
$env.PNPM_HOME = $pnpm_home
|
||||
$env.PATH = ($env.PATH | prepend $pnpm_home)
|
||||
}
|
||||
|
||||
# Bun
|
||||
let bun_bin = ($env.HOME | path join ".bun" "bin")
|
||||
if ($bun_bin | path exists) {
|
||||
$env.BUN_INSTALL = ($env.HOME | path join ".bun")
|
||||
$env.PATH = ($env.PATH | prepend $bun_bin)
|
||||
}
|
||||
|
||||
# pyenv
|
||||
let pyenv_root = ($env.HOME | path join ".pyenv")
|
||||
if ($pyenv_root | path exists) {
|
||||
$env.PYENV_ROOT = $pyenv_root
|
||||
$env.PATH = ($env.PATH | prepend ($pyenv_root | path join "bin"))
|
||||
}
|
||||
|
||||
# jenv (Java)
|
||||
let jenv_bin = ($env.HOME | path join ".jenv" "bin")
|
||||
if ($jenv_bin | path exists) { $env.PATH = ($env.PATH | prepend $jenv_bin) }
|
||||
|
||||
# .NET
|
||||
let dotnet_root = ($env.HOME | path join ".dotnet")
|
||||
if ($dotnet_root | path exists) {
|
||||
$env.DOTNET_ROOT = $dotnet_root
|
||||
$env.PATH = ($env.PATH | prepend $dotnet_root)
|
||||
$env.PATH = ($env.PATH | prepend ($dotnet_root | path join "tools"))
|
||||
}
|
||||
|
||||
# Spicetify
|
||||
let spicetify = ($env.HOME | path join ".spicetify")
|
||||
if ($spicetify | path exists) { $env.PATH = ($env.PATH | prepend $spicetify) }
|
||||
|
||||
# Pulumi
|
||||
let pulumi_bin = ($env.HOME | path join ".pulumi" "bin")
|
||||
if ($pulumi_bin | path exists) { $env.PATH = ($env.PATH | prepend $pulumi_bin) }
|
||||
|
||||
# Perl (if installed)
|
||||
let perl_bin = ($env.HOME | path join "perl5" "bin")
|
||||
if ($perl_bin | path exists) {
|
||||
$env.PATH = ($env.PATH | prepend $perl_bin)
|
||||
$env.PERL5LIB = ($env.HOME | path join "perl5" "lib" "perl5")
|
||||
$env.PERL_LOCAL_LIB_ROOT = ($env.HOME | path join "perl5")
|
||||
}
|
||||
|
||||
# hishtory
|
||||
let hishtory_bin = ($env.HOME | path join ".hishtory")
|
||||
if ($hishtory_bin | path exists) { $env.PATH = ($env.PATH | prepend $hishtory_bin) }
|
||||
{{ end }}
|
||||
|
||||
# Remove duplicates from PATH
|
||||
$env.PATH = ($env.PATH | uniq)
|
||||
|
||||
# WSL-specific settings
|
||||
{{ if .wsl }}
|
||||
# Ensure CLI apps open URLs in Windows browser
|
||||
$env.BROWSER = 'powershell.exe /c start'
|
||||
{{ end }}
|
||||
@@ -1,16 +0,0 @@
|
||||
[user]
|
||||
name = Xevion
|
||||
email = xevion@xevion.dev
|
||||
# signingkey = C217005CF3C00672
|
||||
# [commit]
|
||||
# gpgsign = true
|
||||
[credential "https://github.com"]
|
||||
helper =
|
||||
helper = !/usr/bin/gh auth git-credential
|
||||
[credential "https://gist.github.com"]
|
||||
helper =
|
||||
helper = !/usr/bin/gh auth git-credential
|
||||
[core]
|
||||
editor = micro
|
||||
[init]
|
||||
defaultBranch = master
|
||||
@@ -0,0 +1,56 @@
|
||||
# Git Configuration - Platform-aware
|
||||
# Managed by chezmoi
|
||||
|
||||
{{ if eq .chezmoi.os "windows" }}
|
||||
# Windows Configuration
|
||||
[user]
|
||||
name = Ryan Walters
|
||||
email = ryan@walters.to
|
||||
signingkey = 39538EC79ACF2597
|
||||
|
||||
[commit]
|
||||
gpgsign = true
|
||||
|
||||
[gpg]
|
||||
program = C:\\Users\\Xevion\\scoop\\apps\\gpg4win\\current\\GnuPG\\bin\\gpg.exe
|
||||
|
||||
[credential "https://github.com"]
|
||||
helper =
|
||||
helper = !'C:\\Program Files\\GitHub CLI\\gh.exe' auth git-credential
|
||||
|
||||
[credential "https://gist.github.com"]
|
||||
helper =
|
||||
helper = !'C:\\Program Files\\GitHub CLI\\gh.exe' auth git-credential
|
||||
|
||||
{{ else }}
|
||||
# Linux/macOS Configuration
|
||||
[user]
|
||||
name = Xevion
|
||||
email = xevion@xevion.dev
|
||||
signingkey = C217005CF3C00672
|
||||
|
||||
[commit]
|
||||
gpgsign = true
|
||||
|
||||
[credential "https://github.com"]
|
||||
helper =
|
||||
helper = !/usr/bin/gh auth git-credential
|
||||
|
||||
[credential "https://gist.github.com"]
|
||||
helper =
|
||||
helper = !/usr/bin/gh auth git-credential
|
||||
|
||||
{{ end }}
|
||||
|
||||
# Common configuration for all platforms
|
||||
[core]
|
||||
editor = micro
|
||||
|
||||
[init]
|
||||
defaultBranch = master
|
||||
|
||||
[filter.lfs]
|
||||
required = true
|
||||
clean = git-lfs clean -- %f
|
||||
smudge = git-lfs smudge -- %f
|
||||
process = git-lfs filter-process
|
||||
+11
-12
@@ -1,28 +1,27 @@
|
||||
#!/usr/bin/env -S deno run -A
|
||||
#!/usr/bin/env bun
|
||||
console.log("init_pre.ts");
|
||||
|
||||
import { resolve } from "https://deno.land/std/path/mod.ts";
|
||||
import { exists } from "jsr:@std/fs";
|
||||
import { exists } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { $, os } from "npm:zx@8.3.2";
|
||||
import { homedir } from "node:os";
|
||||
import { $ } from "bun";
|
||||
|
||||
const { exit } = Deno;
|
||||
const filePath = join(os.homedir(), "key.txt");
|
||||
const filePath = join(homedir(), "key.txt");
|
||||
|
||||
|
||||
if (await exists(resolve(filePath))) {
|
||||
if (await exists(filePath)) {
|
||||
console.log("key.txt already exists");
|
||||
Deno.exit(0);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Acquire the secret from Doppler
|
||||
const result = await $`doppler secrets get KEY_TXT --plain`;
|
||||
const result = await $`doppler secrets get KEY_TXT --plain`.quiet();
|
||||
|
||||
// Check if the command was successful
|
||||
if (result.exitCode !== 0) {
|
||||
console.error("Failed to get secret KEY_TXT");
|
||||
exit(1);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Write the secret to a file
|
||||
await Deno.writeTextFile(resolve(filePath), result.stdout);
|
||||
await Bun.write(filePath, result.stdout);
|
||||
console.log("key.txt bootstrapped");
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
# Flag variables
|
||||
LATE_FAIL_EXIT=false # Set to true if any installation fails, but only raise an exit at the end
|
||||
DOPPLER_UNAVAILABLE=false # Set to true if Doppler is not available
|
||||
|
||||
apt_update() {
|
||||
# Only run apt update once
|
||||
if [ -f /tmp/.apt-updated ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
sudo apt update >/dev/null
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "chezmoi: Critical issue - failed to update apt!"
|
||||
exit 1
|
||||
else
|
||||
touch /tmp/.apt-updated
|
||||
fi
|
||||
}
|
||||
|
||||
install_age() {
|
||||
# Test if age is installed
|
||||
command -v age >/dev/null 2>&1 && return
|
||||
|
||||
# Install age
|
||||
apt_update
|
||||
sudo apt install age
|
||||
}
|
||||
|
||||
# install_cargo_binstall() {
|
||||
# # Test if cargo binstall is installed
|
||||
# cargo binstall --help >/dev/null 2>&1
|
||||
# if [ $? -eq 0 ]; then
|
||||
# return
|
||||
# fi
|
||||
# curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||
|
||||
# # Test again
|
||||
# cargo binstall --help
|
||||
# if [ $? -ne 0 ]; then
|
||||
# echo "Failed to install cargo binstall"
|
||||
# exit 1
|
||||
# fi
|
||||
# }
|
||||
|
||||
install_inotify() {
|
||||
if ! dpkg -l inotify-tools >/dev/null 2>&1; then
|
||||
echo "Installing inotify-tools"
|
||||
apt_update
|
||||
sudo apt install inotify-tools
|
||||
fi
|
||||
}
|
||||
|
||||
install_doppler() {
|
||||
if ! command -v doppler >/dev/null 2>&1; then
|
||||
echo "You need to install the Doppler CLI manually (for security purposes)."
|
||||
echo "https://docs.doppler.com/docs/cli#installation"
|
||||
|
||||
DOPPLER_UNAVAILABLE=true
|
||||
LATE_FAIL_EXIT=true
|
||||
fi
|
||||
}
|
||||
|
||||
require_doppler_login() {
|
||||
doppler me >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "You need to login to Doppler."
|
||||
echo "https://docs.doppler.com/docs/cli#logging-in"
|
||||
fi
|
||||
}
|
||||
|
||||
install_deno() {
|
||||
if ! command -v deno >/dev/null 2>&1; then
|
||||
echo "Installing Deno"
|
||||
curl -fsSL https://deno.land/install.sh | sh
|
||||
fi
|
||||
}
|
||||
|
||||
install_inotify
|
||||
install_age
|
||||
# install_cargo_binstall
|
||||
if [ $DOPPLER_UNAVAILABLE = false ]; then
|
||||
install_doppler
|
||||
fi
|
||||
|
||||
if [ $LATE_FAIL_EXIT = true ]; then
|
||||
echo "chezmoi: Some installation(s) failed. Please fix the issues detailed before trying again."
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# chezmoi update --init does not invoke the 'hooks.init.pre' hook, so we do it ourselves
|
||||
if grep -q 'init' <<<$CHEZMOI_ARGS; then
|
||||
# CHEZMOI_UPDATE is just a hint in case we need to know if we're updating
|
||||
CHEZMOI_UPDATE=1 $(dirname $0)/.init_pre.ts
|
||||
fi
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
// chezmoi update --init does not invoke the 'hooks.init.pre' hook, so we do it ourselves
|
||||
const chezmoiArgs = process.env.CHEZMOI_ARGS || '';
|
||||
|
||||
if (chezmoiArgs.includes('init')) {
|
||||
// CHEZMOI_UPDATE is just a hint in case we need to know if we're updating
|
||||
const scriptDir = import.meta.dir;
|
||||
const initPreScript = `${scriptDir}/.init_pre.ts`;
|
||||
|
||||
await Bun.spawn(['bun', initPreScript], {
|
||||
env: {
|
||||
...process.env,
|
||||
CHEZMOI_UPDATE: '1'
|
||||
},
|
||||
stdout: 'inherit',
|
||||
stderr: 'inherit'
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user