Compare commits
17 Commits
17f984c99c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfca731f77 | ||
|
|
2b9d0835f0 | ||
|
|
07e034d5f4 | ||
|
|
7884d4fb61 | ||
|
|
ac6c6203c3 | ||
| 566225ac04 | |||
| 977d11b8de | |||
| a64e7bceff | |||
|
|
7de1042823 | ||
|
|
6982026a88 | ||
|
|
d96ef0af90 | ||
|
|
3049391a4f | ||
|
|
138d76a19f | ||
|
|
57d0ebda20 | ||
|
|
726e6098b2 | ||
|
|
6b963ee277 | ||
|
|
b11baff00e |
5
bin/xvim
Executable file
5
bin/xvim
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
vim "$@" --cmd 'au VimLeave * :!clear'
|
||||
clear
|
||||
|
||||
21
conf/wsl.conf
Normal file
21
conf/wsl.conf
Normal file
@@ -0,0 +1,21 @@
|
||||
# https://learn.microsoft.com/en-us/windows/wsl/wsl-config
|
||||
|
||||
[boot]
|
||||
systemd=false
|
||||
|
||||
[user]
|
||||
default=lachtan
|
||||
|
||||
[automount]
|
||||
enabled = true
|
||||
|
||||
[network]
|
||||
generateHosts = true
|
||||
generateResolvConf = false
|
||||
|
||||
[interop]
|
||||
enabled = false
|
||||
appendWindowsPath = false
|
||||
|
||||
[gpu]
|
||||
enabled = true
|
||||
3
fishrc
Normal file
3
fishrc
Normal file
@@ -0,0 +1,3 @@
|
||||
for file in (dirname (status -f))/rc.fish/*.fish
|
||||
source $file
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
# Linux Workspace Functions
|
||||
# shellcheck shell=bash
|
||||
|
||||
if [ -z "$time_ms" ]; then
|
||||
readonly time_ms='date +%s%3N'
|
||||
@@ -134,3 +135,7 @@ function true_false() {
|
||||
# [[ "${1,,}" =~ ^(1|true|yes)$ ]]
|
||||
[[ "${1@L}" =~ ^(1|true|yes)$ ]]
|
||||
}
|
||||
|
||||
function is_wsl() {
|
||||
grep -q -i wsl /proc/version
|
||||
}
|
||||
|
||||
32
install.sh
32
install.sh
@@ -2,11 +2,29 @@
|
||||
|
||||
set -E -o errexit -o nounset -o pipefail
|
||||
|
||||
if grep -q -e 'source\s+.*/linux-workspace/bashrc\s*$' $HOME/.bashrc; then
|
||||
echo "Linux Workspace configuration already exists in .bashrc !"
|
||||
exit 1
|
||||
else
|
||||
readonly SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
function install_lws() {
|
||||
local LWS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||
|
||||
if grep -q -e "source.*$LWS_DIR/bashrc" $HOME/.bashrc; then
|
||||
echo "SKIP: Linux Workspace configuration already exists in $HOME/.bashrc !"
|
||||
else
|
||||
echo "Adding to $HOME/.bashrc"
|
||||
echo "source '$SCRIPT_DIR/bashrc'" >> "$HOME/.bashrc"
|
||||
fi
|
||||
echo "source '$LWS_DIR/bashrc'" >> "$HOME/.bashrc"
|
||||
fi
|
||||
|
||||
local FISH_CONF_DIR="$HOME/.config/fish"
|
||||
local FISH_CONF_LWS="$FISH_CONF_DIR/conf.d/lws.fish"
|
||||
|
||||
if [[ -d "$FISH_CONF_DIR" ]]; then
|
||||
if [[ -f "$FISH_CONF_LWS" ]]; then
|
||||
echo "SKIP: Linux Workspace configuration already exists in $FISH_CONF_LWS !"
|
||||
else
|
||||
echo "Adding to $FISH_CONF_LWS"
|
||||
echo "source $LWS_DIR/fishrc" > "$FISH_CONF_LWS"
|
||||
fi
|
||||
else
|
||||
echo "Fish configuration directory not found, skipping fish setup."
|
||||
fi
|
||||
}
|
||||
|
||||
install_lws
|
||||
|
||||
9
install/claude-code.sh
Executable file
9
install/claude-code.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# https://code.claude.com/docs/en/setup
|
||||
|
||||
set -E -o errexit -o nounset -o pipefail
|
||||
set -x
|
||||
|
||||
curl -fsSL https://claude.ai/install.sh | bash
|
||||
|
||||
8
install/gemini-cli.sh
Executable file
8
install/gemini-cli.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# https://github.com/google-gemini/gemini-cli
|
||||
|
||||
set -E -o errexit -o nounset -o pipefail
|
||||
set -x
|
||||
|
||||
npm install -g @google/gemini-cli
|
||||
10
install/nvm-npm.sh
Executable file
10
install/nvm-npm.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# https://github.com/nvm-sh/nvm
|
||||
|
||||
set -E -o errexit -o nounset -o pipefail
|
||||
set -x
|
||||
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
||||
nvm install node
|
||||
nvm use node
|
||||
@@ -5,18 +5,21 @@ set -x
|
||||
|
||||
function pwsh_install_dotnet() {
|
||||
# https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux#install-as-a-net-global-tool
|
||||
|
||||
dotnet tool install --global PowerShell
|
||||
dotnet tool update --global PowerShell
|
||||
}
|
||||
|
||||
function pwsh_install_apt() {
|
||||
# https://learn.microsoft.com/en-us/powershell/scripting/install/install-ubuntu
|
||||
# https://learn.microsoft.com/en-us/powershell/scripting/install/install-debian
|
||||
|
||||
deb=/tmp/packages-microsoft-prod.deb
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y wget apt-transport-https software-properties-common
|
||||
wget -O /tmp/packages-microsoft-prod.deb "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
|
||||
sudo dpkg -i /tmp/packages-microsoft-prod.deb
|
||||
rm /tmp/packages-microsoft-prod.deb
|
||||
source /etc/os-release
|
||||
wget -O $deb "https://packages.microsoft.com/config/debian/$VERSION_ID/packages-microsoft-prod.deb"
|
||||
sudo dpkg -i $deb
|
||||
rm $deb
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y powershell
|
||||
}
|
||||
|
||||
5
rc.fish/01-init.fish
Normal file
5
rc.fish/01-init.fish
Normal file
@@ -0,0 +1,5 @@
|
||||
set -gx PAGER less
|
||||
set -g fish_prompt_pwd_dir_length 0
|
||||
|
||||
# set -g fish_autosuggestion_enabled 0
|
||||
# fish_config theme choose "fish default"
|
||||
@@ -1 +1,2 @@
|
||||
prepend_path_try "$HOME/.local/bin"
|
||||
prepend_path_try "$HOME/bin"
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
alias nop=':'
|
||||
|
||||
# Long format, human-readable, with indicators
|
||||
alias ll='ls -lhF'
|
||||
# Same as ll but including hidden files
|
||||
alias la='ls -lhAF'
|
||||
|
||||
|
||||
alias exit-when-error='set -o errexit'
|
||||
alias exit-when-unset-variable='set -o nounset'
|
||||
alias exit-when-pipe-fail='set -o pipefail'
|
||||
@@ -9,6 +15,7 @@ alias clws='cd $LWS'
|
||||
alias chs=cheatsheet
|
||||
|
||||
alias dc=docker-compose
|
||||
alias pc=podman-compose
|
||||
alias dcl='dcm logs'
|
||||
alias dcfilter="sed -r 's/^[^|]+\| //g'"
|
||||
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
if [[ -f "$HOME/.cargo/env" ]]; then
|
||||
source "$HOME/.cargo/env"
|
||||
fi
|
||||
source_try "$HOME/.cargo/env"
|
||||
|
||||
1
rc/claude-code.sh
Normal file
1
rc/claude-code.sh
Normal file
@@ -0,0 +1 @@
|
||||
append_path_try $HOME/.local/bin
|
||||
8
rc/nvm.sh
Normal file
8
rc/nvm.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
NVM_DIR="$HOME/.nvm"
|
||||
if [ -d "$NVM_DIR" ]; then
|
||||
export NVM_DIR
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
||||
else
|
||||
unset NVM_DIR
|
||||
fi
|
||||
1
rc/opencode.sh
Normal file
1
rc/opencode.sh
Normal file
@@ -0,0 +1 @@
|
||||
append_path_try "$HOME/.opencode/bin"
|
||||
@@ -1,9 +1,51 @@
|
||||
# Start ssh agent for private key
|
||||
|
||||
function _log() {
|
||||
xlog "[ssh-agent] $*"
|
||||
}
|
||||
|
||||
_SSH_AGENT_NO_KEYS=1
|
||||
_SSH_AGENT_NOT_RUNNING=2
|
||||
|
||||
for key in id_ecdsa id_rsa; do
|
||||
key_filename="$HOME/.ssh/$key"
|
||||
if [ -f $key_filename ]; then
|
||||
eval $(keychain --eval --quiet --agents ssh $key)
|
||||
|
||||
if [ -f "$key_filename" ]; then
|
||||
_log "SSH key: $key_filename"
|
||||
|
||||
if is_wsl; then
|
||||
_log "WSL ON"
|
||||
|
||||
if [ -z "$SSH_AUTH_SOCK" ]; then
|
||||
export SSH_AUTH_SOCK=$HOME/.ssh/ssh-agent.sock
|
||||
fi
|
||||
|
||||
_log "SSH_AUTH_SOCK: $SSH_AUTH_SOCK"
|
||||
|
||||
ssh-add -L &> /dev/null
|
||||
ssh_add_status=$?
|
||||
|
||||
if [[ -S "$SSH_AUTH_SOCK" && $ssh_add_status -eq $_SSH_AGENT_NOT_RUNNING ]]; then
|
||||
_log "SSH agent does not running, delete $SSH_AUTH_SOCK"
|
||||
rm -f "$SSH_AUTH_SOCK"
|
||||
fi
|
||||
|
||||
if [[ ! -S "$SSH_AUTH_SOCK" || $ssh_add_status -eq $_SSH_AGENT_NOT_RUNNING ]]; then
|
||||
_log "Starting ssh-agent"
|
||||
eval "$(ssh-agent -s -a "$SSH_AUTH_SOCK")"
|
||||
fi
|
||||
|
||||
ssh-add -L &> /dev/null
|
||||
ssh_add_status=$?
|
||||
|
||||
if [[ $ssh_add_status -eq $_SSH_AGENT_NO_KEYS ]]; then
|
||||
_log "Adding SSH key to agent"
|
||||
ssh-add "$key_filename"
|
||||
fi
|
||||
else
|
||||
eval "$(keychain --eval --quiet --agents ssh $key)"
|
||||
fi
|
||||
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user