Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .aliases
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,19 @@ if [[ $OS == 'Darwin' ]]; then
# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'

# Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update'
# Get OS X Software Updates and apply nix-darwin / home-manager changes
update() {
sudo softwareupdate -i -a
if command -v darwin-rebuild &>/dev/null; then
nix flake update --flake ~/.dotfiles
darwin-rebuild switch --flake ~/.dotfiles
elif command -v nix &>/dev/null; then
nix flake update --flake ~/.dotfiles
home-manager switch --flake ~/.dotfiles
fi
npm install npm -g && npm update -g
sudo gem update --system && sudo gem update
}

# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
Expand Down
29 changes: 24 additions & 5 deletions .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,23 @@ if [ -r /etc/profile.d/bash_completion.sh ]; then
source /etc/profile.d/bash_completion.sh
fi

# brew
# nix & home-manager
if [ -e "${HOME}/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then
# shellcheck disable=SC1091
source "${HOME}/.nix-profile/etc/profile.d/hm-session-vars.sh"
fi

# brew (managed by nix-darwin on macOS)
if command -v brew &>/dev/null; then
eval "$(brew shellenv)"
fi

# bash completions — Nix profile
if [ -r "${HOME}/.nix-profile/etc/profile.d/bash_completion.sh" ]; then
# shellcheck disable=SC1091
source "${HOME}/.nix-profile/etc/profile.d/bash_completion.sh"
fi

# https://docs.brew.sh/Shell-Completion
if [ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]; then
export BASH_COMPLETION_COMPAT_DIR="${HOMEBREW_PREFIX}/etc/bash_completion.d"
Expand All @@ -67,14 +79,21 @@ fi
PROMPT_COMMAND="history -a;$PROMPT_COMMAND"

# chruby
if [ -f "${HOMEBREW_PREFIX}/share/chruby/chruby.sh" ]; then
CHRUBY_DIR=""
if [ -f "${HOME}/.nix-profile/share/chruby/chruby.sh" ]; then
CHRUBY_DIR="${HOME}/.nix-profile/share/chruby"
elif [ -f "${HOMEBREW_PREFIX}/share/chruby/chruby.sh" ]; then
CHRUBY_DIR="${HOMEBREW_PREFIX}/share/chruby"
fi

if [ -n "$CHRUBY_DIR" ]; then
# shellcheck disable=SC2034
RUBIES=("${HOME}/.rubies/*")

# shellcheck source=/dev/null
source "${HOMEBREW_PREFIX}/share/chruby/chruby.sh"
source "${CHRUBY_DIR}/chruby.sh"
# shellcheck source=/dev/null
source "${HOMEBREW_PREFIX}/share/chruby/auto.sh"
source "${CHRUBY_DIR}/auto.sh"
fi

if command -v zoxide &>/dev/null; then
Expand All @@ -86,7 +105,7 @@ if command -v direnv &>/dev/null; then
fi

# gcloud
# For Homebrew-installed gcloud-cli
# gcloud-cli is managed by nix-darwin's Homebrew module on macOS
if command -v brew &>/dev/null; then
GCLOUD_SDK="${HOMEBREW_PREFIX}/share/google-cloud-sdk"
if [ -f "${GCLOUD_SDK}/path.bash.inc" ] &&
Expand Down
193 changes: 0 additions & 193 deletions .brew

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
.config
.gnupg/
nvim.appimage
result
.direnv
19 changes: 15 additions & 4 deletions .profile
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# Nix
if [ -e "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]; then
# shellcheck disable=SC1091
. "${HOME}/.nix-profile/etc/profile.d/nix.sh"
elif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
# shellcheck disable=SC1091
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi

# PATH
export PATH="$HOME/.homebrew/bin:$HOME/.homebrew/sbin:$HOME/bin:/usr/local/bin:/usr/local/sbin:$PATH"
export PATH="$HOME/.nix-profile/bin:$HOME/.homebrew/bin:$HOME/.homebrew/sbin:$HOME/bin:/usr/local/bin:/usr/local/sbin:$PATH"

# Homebrew prefix
# Homebrew prefix (managed by nix-darwin on macOS)
export HOMEBREW_PREFIX='/usr/local'
if command -v brew >/dev/null 2>&1; then
HOMEBREW_PREFIX="$(brew --prefix)"
Expand Down Expand Up @@ -54,7 +63,7 @@ elif less_pipe=$(command -v lesspipe.sh); then
fi

# man
export MANPATH="$HOME/.homebrew/share/man${MANPATH+:$MANPATH}:"
export MANPATH="$HOME/.nix-profile/share/man:$HOME/.homebrew/share/man${MANPATH+:$MANPATH}:"

# Don't clear the screen after quitting a manual page
export MANPAGER='less -X'
Expand Down Expand Up @@ -101,7 +110,9 @@ if [ ! -d "$TMPDIR" ]; then
fi

# diff-highligh
if [ -d "${HOMEBREW_PREFIX}/share/git-core/contrib/diff-highlight/" ]; then
if [ -d "${HOME}/.nix-profile/share/git-core/contrib/diff-highlight/" ]; then
export PATH="${PATH}:${HOME}/.nix-profile/share/git-core/contrib/diff-highlight"
elif [ -d "${HOMEBREW_PREFIX}/share/git-core/contrib/diff-highlight/" ]; then
export PATH="${PATH}:${HOMEBREW_PREFIX}/share/git-core/contrib/diff-highlight"
fi

Expand Down
Loading