Personal dotfiles for Linux, mostly for Nixpkgs/NixOS-based and Termux setups. Mirrored using GitLab's push mirroring feature. gitlab.com/andreijiroh-dev/dotfiles
linux dotfiles
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(bashrc): get cooked on aliases and ssh-agent-loader

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>

+102 -58
+60 -53
.bashrc
··· 5 5 # portable at least. 6 6 # SPDX-License-Identifier: MPL-2.0 7 7 8 + try_keychain_ssh_agent() { 9 + if [[ $FF_KEYCHAIN == "1" ]]; then 10 + echo "[ssh-agent-loader::keychain] attempting to use keychain for SSH agents" 11 + eval "$(keychain --eval --agents ssh,gpg)" 12 + fi 13 + } 14 + 15 + ssh-agent-loader() { 16 + if [[ $1 == "" || $1 == "auto" ]]; then 17 + if [[ $SSH_CONNECTION != "" ]] && [[ $VSCODE_IPC_HOOK_CLI != "" ]]; then 18 + echo "[ssh-agent-loader] automatic detection disabled while you're in a VS Code Remote SSH session" 19 + return 20 + fi 21 + 22 + export OLD_SSH_AUTH_SOCK="$SSH_AUTH_SOCK" 23 + 24 + unset SSH_AGENT_PID SSH_AUTH_SOCK 25 + if try_1password_ssh_agent; then 26 + return 27 + elif try_keychain_ssh_agent; then 28 + return 29 + else 30 + echo "[ssh-agent-loader] SSH agent seems to be failed to load at the moment" 31 + echo "[ssh-agent-loader] try again later by manually invoking the shell function" 32 + return 1 33 + fi 34 + elif [[ $1 == "1passowrd" || $1 == "op" ]]; then 35 + unset SSH_AGENT_PID SSH_AUTH_SOCK 36 + try_1password_ssh_agent 37 + elif [[ $1 == "keychain" ]]; then 38 + try_keychain_ssh_agent 39 + else 40 + echo "ssh-agent-loader [auto|[1password|op|1p]|keychain]" 41 + return 1 42 + fi 43 + } 44 + 45 + # handle 46 + hm-vars-loader() { 47 + if [ -f "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then 48 + source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" 49 + HM_SESSION_VARS_PATH="$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" 50 + HM_SESSION_VARS_LOADED=true 51 + elif [ -f "$HOME/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh" ]; then 52 + source "$HOME/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh" 53 + HM_SESSION_VARS_PATH="$HOME/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh" 54 + HM_SESSION_VARS_LOADED=true 55 + elif [ -f "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh" ]; then 56 + source "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh" 57 + HM_SESSION_VARS_PATH="/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh" 58 + HM_SESSION_VARS_LOADED=true 59 + else 60 + HM 61 + fi 62 + export HM_SESSION_VARS_LOADED HM_SESSION_VARS_PATH 63 + } 64 + 8 65 ### from Debian and Ubuntu - START ### 9 66 # don't put duplicate lines or lines starting with space in the history. 10 67 # See bash(1) for more options ··· 54 111 ;; 55 112 esac 56 113 57 - # enable color support of ls and also add handy aliases 58 - if [ -x /usr/bin/dircolors ]; then 59 - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 60 - alias ls='ls --color=auto' 61 - #alias dir='dir --color=auto' 62 - #alias vdir='vdir --color=auto' 63 - 64 - alias grep='grep --color=auto' 65 - alias fgrep='fgrep --color=auto' 66 - alias egrep='egrep --color=auto' 67 - fi 68 - 69 114 # colored GCC warnings and errors 70 115 export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' 71 - 72 - alias ll='ls -alF' 73 - alias la='ls -A' 74 - alias l='ls -CF' 75 116 76 117 # enable programmable completion features (you don't need to enable 77 118 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile ··· 109 150 unset OP_SSH_AUTH_SOCK 110 151 } 111 152 112 - try_keychain_ssh_agent() { 113 - if [[ $FF_KEYCHAIN == "1" ]]; then 114 - echo "[ssh-agent-loader::keychain] attempting to use keychain for SSH agents" 115 - eval "$(keychain --eval --agents ssh,gpg)" 116 - fi 117 - } 118 - 119 - ssh-agent-loader() { 120 - if [[ $1 == "" || $1 == "auto" ]]; then 121 - unset SSH_AGENT_PID SSH_AUTH_SOCK 122 - if try_1password_ssh_agent; then 123 - return 124 - elif try_keychain_ssh_agent; then 125 - return 126 - else 127 - echo "[ssh-agent-loader] SSH agent seems to be failed to load at the moment" 128 - echo "[ssh-agent-loader] try again later by manually invoking the shell function" 129 - return 1 130 - fi 131 - elif [[ $1 == "1passowrd" || $1 == "op" ]]; then 132 - unset SSH_AGENT_PID SSH_AUTH_SOCK 133 - try_1password_ssh_agent 134 - elif [[ $1 == "keychain" ]]; then 135 - try_keychain_ssh_agent 136 - else 137 - echo "ssh-agent-loader [auto|[1password|op|1p]|keychain]" 138 - return 1 139 - fi 140 - } 141 - 142 - command -v direnv >> /dev/null && eval "$(direnv hook bash)" 143 - 144 153 # Technically a hack in case we don't use home-manager switch 145 154 if [ -L "$HOME/.nix-profile" ] && [ -e "$HOME/.nix-profile" ]; then 146 155 export PATH="$HOME/.nix-profile/bin:$HOME:$PATH" 147 - if [ -f "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then 148 - source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" 149 - # Don't return yet, since we still do some stuff after that. 150 - #return 151 - fi 156 + hm-vars-loader 152 157 fi 153 158 154 159 export PATH="$HOME/bin:$HOME/.local/bin:$PATH" ··· 168 173 ssh-agent-loader auto 169 174 fi 170 175 export EDITOR GIT_EDITOR=$EDITOR 176 + 177 + command -v direnv >> /dev/null && eval "$(direnv hook bash)"
+35
.config/bash/aliases
··· 1 + #!/usr/bin/env bash 2 + 3 + # enable color support of ls and also add handy aliases 4 + if [ -x /usr/bin/dircolors ]; then 5 + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 6 + alias ls='ls --color=auto' 7 + #alias dir='dir --color=auto' 8 + #alias vdir='vdir --color=auto' 9 + 10 + alias grep='grep --color=auto' 11 + alias fgrep='fgrep --color=auto' 12 + alias egrep='egrep --color=auto' 13 + fi 14 + 15 + alias ll='ls -alF' 16 + alias la='ls -A' 17 + alias l='ls -CF' 18 + 19 + alias ..='cd ..' 20 + alias ...='cd ../..' 21 + 22 + # git 23 + alias clone='git clone' 24 + alias status='git status' 25 + alias stats='git status' 26 + alias stash='git stash' 27 + alias commit='git commit' 28 + alias signoff='git commit --signoff' 29 + alias push='git push' 30 + alias fetch='git fetch' 31 + alias pull='git pull --rebase' 32 + alias remotes='git remote -v' 33 + alias switch-upstream='git branch -u' 34 + alias module="git submodule" 35 + alias update-module="git submodule update --remote --merge"
+7 -5
README.md
··· 1 1 # `@andreijiroh-dev/dotfiles@nixos` - @ajhalili2006's dotfiles under nixos + nixpkgs! 2 2 3 3 Yup, I'm starting a fresh for my dotfiles for 2025 and beyond, now with 4 - [nixpkgs](https://nixos.org) and [home-manager](https://nix-community.github.io/home-manager). 5 - (Don't worry, I'll be maintaining the yadm-era setup for non-Nix setups seperately 6 - as seperate branches for prosperity.) 4 + [nixpkgs](https://nixos.org) and [home-manager](https://nix-community.github.io/home-manager) 5 + in mind. Backwards-compatible with non-nixpkgs setups via `yadm`. 7 6 8 7 ## Usage 9 8 ··· 16 15 git init 17 16 git remote add origin https://mau.dev/andreijiroh-dev/dotfiles 18 17 git checkout -f main 18 + ln -s ./.git ./.local/share/yadm/repo.git # so that we can use yadm later 19 19 ``` 20 20 21 - If you prefer to cook up with yadm: 21 + If you prefer to cook up with `yadm` first: 22 22 23 23 ```bash 24 24 yadm clone https://github.com/andreijiroh-dev/dotfiles 25 - ln -s ./.local/share/yadm/TBD ./.git # so that we can normally use git here 25 + ln -s ./.local/share/yadm/repo.git ./.git # so that we can normally use git here 26 26 ``` 27 27 28 28 ### Using nix flakes + home-manager ··· 51 51 Note that this should work on most desktop apps, although if you're in Nest (and friends 52 52 with RDP access), connect to there first and authenicate. You may need to adjust security 53 53 settings in the desktop app to ensure nothing go wrong. 54 + 55 + Alternatively, you can export the private keys with password encryption 54 56 55 57 ## Directory + File Map 56 58