Refactor bash config and env vars, set Zed as git editor
- Move environment variable exports from sessionVariables to bashrc - Add more robust sourcing of .profile and .bashrc.local - Improve SSH_AUTH_SOCK override logic for 1Password - Remove redundant path and pyenv logic from profileExtra - Set git core.editor to "zed" instead of "nvim" - Add DOTFILES_PATH to global session variables
This commit is contained in:
@@ -419,7 +419,9 @@ def main():
|
||||
|
||||
# Execute the Ansible command, passing password via stdin if available
|
||||
if sudo_password:
|
||||
result = subprocess.run(ansible_cmd, input=sudo_password.encode("utf-8"), check=False)
|
||||
result = subprocess.run(
|
||||
ansible_cmd, input=sudo_password.encode("utf-8"), check=False
|
||||
)
|
||||
else:
|
||||
result = subprocess.run(ansible_cmd, check=False)
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
@@ -33,6 +31,37 @@
|
||||
shopt -s no_empty_cmd_completion
|
||||
shopt -s nocaseglob
|
||||
|
||||
# Set various environment variables
|
||||
export NIXPKGS_ALLOW_INSECURE=1
|
||||
export NIXPKGS_ALLOW_UNFREE=1
|
||||
export DOTFILES_PATH="${config.home.homeDirectory}/.dotfiles"
|
||||
export EDITOR="code --wait"
|
||||
export STARSHIP_ENABLE_RIGHT_PROMPT="true"
|
||||
export STARSHIP_ENABLE_BASH_COMPLETION="true"
|
||||
export XDG_DATA_DIRS="/usr/share:/var/lib/flatpak/exports/share:${config.home.homeDirectory}/.local/share/flatpak/exports/share"
|
||||
|
||||
# Source .profile (If exists)
|
||||
if [ -f "${config.home.homeDirectory}/.profile" ]; then
|
||||
source "${config.home.homeDirectory}/.profile"
|
||||
fi
|
||||
|
||||
# Source .bashrc.local (If exists)
|
||||
if [ -f "${config.home.homeDirectory}/.bashrc.local" ]; then
|
||||
source "${config.home.homeDirectory}/.bashrc.local"
|
||||
fi
|
||||
|
||||
# Homebrew (if installed)
|
||||
if [ -d /home/linuxbrew/.linuxbrew ]; then
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
fi
|
||||
|
||||
# PyEnv (if installed)
|
||||
if [ -d "${config.home.homeDirectory}/.pyenv" ]; then
|
||||
export PYENV_ROOT="${config.home.homeDirectory}/.pyenv"
|
||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
eval "$(pyenv init - bash)"
|
||||
fi
|
||||
|
||||
# Detect distribution and set CGO_CFLAGS for Pop!_OS
|
||||
if [ -f /etc/os-release ]; then
|
||||
distro=$(awk -F= '/^NAME/{print $2}' /etc/os-release | tr -d '"')
|
||||
@@ -48,7 +77,8 @@
|
||||
fi
|
||||
|
||||
# Set SSH_AUTH_SOCK to 1Password agent if not already set
|
||||
if [ -z "$SSH_AUTH_SOCK" ]; then
|
||||
# Also block /run/user/1000/gnupg/S.gpg-agent.ssh and override with 1Password
|
||||
if [ -z "$SSH_AUTH_SOCK" ] || [[ "$SSH_AUTH_SOCK" == *"gnupg/S.gpg-agent.ssh"* ]]; then
|
||||
export SSH_AUTH_SOCK=~/.1password/agent.sock
|
||||
fi
|
||||
|
||||
@@ -76,11 +106,6 @@
|
||||
fi
|
||||
fi
|
||||
|
||||
# Source nix home-manager session variables
|
||||
if [ -f "${config.home.homeDirectory}/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then
|
||||
. "${config.home.homeDirectory}/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
fi
|
||||
|
||||
# Source ble.sh if available and configure fzf history search
|
||||
if [[ -f "${config.home.homeDirectory}/.nix-profile/share/blesh/ble.sh" ]]; then
|
||||
source "${config.home.homeDirectory}/.nix-profile/share/blesh/ble.sh"
|
||||
@@ -104,11 +129,6 @@
|
||||
bind -x '"\C-r": fzf_history_search'
|
||||
fi
|
||||
|
||||
# Source local bashrc if it exists
|
||||
if [ -f "${config.home.homeDirectory}/.bashrc.local" ]; then
|
||||
source "${config.home.homeDirectory}/.bashrc.local"
|
||||
fi
|
||||
|
||||
# Display welcome message for interactive shells
|
||||
if [ -t 1 ]; then
|
||||
command -v helloworld &> /dev/null && helloworld
|
||||
@@ -118,11 +138,10 @@
|
||||
# Shell aliases
|
||||
shellAliases = {
|
||||
# Folder navigation
|
||||
"." = "cd .";
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../..";
|
||||
"...." = "cd ../../..";
|
||||
"....." = "cd ../../../..";
|
||||
# "." = "cd .";
|
||||
# ".." = "cd ..";
|
||||
# "..." = "cd ../..";
|
||||
# "...." = "cd ../../..";
|
||||
|
||||
# Docker Compose alias (for old scripts)
|
||||
"docker-compose" = "docker compose";
|
||||
@@ -180,29 +199,12 @@
|
||||
"random" = "openssl rand -base64";
|
||||
};
|
||||
|
||||
# Session variables
|
||||
sessionVariables = {
|
||||
# Basic environment
|
||||
DOTFILES_PATH = "${config.home.homeDirectory}/.dotfiles";
|
||||
|
||||
# Nix configuration
|
||||
NIXPKGS_ALLOW_UNFREE = "1";
|
||||
NIXPKGS_ALLOW_INSECURE = "1";
|
||||
|
||||
# XDG configuration
|
||||
XDG_DATA_DIRS = "$XDG_DATA_DIRS:/usr/share:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share";
|
||||
|
||||
# Starship configuration
|
||||
STARSHIP_ENABLE_RIGHT_PROMPT = "true";
|
||||
STARSHIP_ENABLE_BASH_CONTINUATION = "true";
|
||||
};
|
||||
|
||||
# Profile extra (runs for login shells)
|
||||
profileExtra = ''
|
||||
# PATH manipulation
|
||||
export PATH="$PATH:${config.home.homeDirectory}/.local/bin"
|
||||
export PATH="$PATH:${config.home.homeDirectory}/.cargo/bin"
|
||||
export PATH="$PATH:$DOTFILES_PATH/bin"
|
||||
export PATH="$PATH:${config.home.homeDirectory}/.dotfiles/bin"
|
||||
export PATH="/usr/bin:$PATH"
|
||||
|
||||
# PKG_CONFIG_PATH
|
||||
@@ -210,18 +212,6 @@
|
||||
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH
|
||||
fi
|
||||
|
||||
# Spicetify
|
||||
if [ -d "${config.home.homeDirectory}/.spicetify" ]; then
|
||||
export PATH="$PATH:${config.home.homeDirectory}/.spicetify"
|
||||
fi
|
||||
|
||||
# Pyenv
|
||||
if [ -d "${config.home.homeDirectory}/.pyenv" ]; then
|
||||
export PYENV_ROOT="${config.home.homeDirectory}/.pyenv"
|
||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
eval "$(pyenv init - bash)"
|
||||
fi
|
||||
|
||||
# pnpm
|
||||
if [ -d "${config.home.homeDirectory}/.local/share/pnpm" ]; then
|
||||
export PATH="$PATH:${config.home.homeDirectory}/.local/share/pnpm"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
};
|
||||
|
||||
core = {
|
||||
editor = "nvim";
|
||||
editor = "zed";
|
||||
autocrlf = false;
|
||||
filemode = true;
|
||||
ignorecase = false;
|
||||
|
||||
Reference in New Issue
Block a user