2023-03-21 14:17:23 -04:00
#!/bin/sh
2023-03-22 14:37:02 -04:00
[ ! -z " ${ DEBUG - } " ] && set -x
2023-03-22 08:59:25 -04:00
cd " $( dirname $0 ) " || exit 1
2023-03-22 14:37:02 -04:00
if ! pgrep nix-daemon > /dev/null 2>& 1 ; then
sh < $( curl -L https://nixos.org/nix/install)
2023-03-22 08:59:25 -04:00
fi
2023-03-21 14:17:23 -04:00
mkdir -p " $HOME /.config "
mkdir -p " $HOME /.config/nix "
if [ ! -f " $HOME /.config/nix/nix.conf " ] ; then
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
echo "trusted-users = root andrew" | sudo tee -a /etc/nix/nix.conf && sudo pkill nix-daemon
2023-03-22 08:59:25 -04:00
nix profile install nixpkgs#cachix
2023-03-21 14:17:23 -04:00
cachix use devenv
fi
2023-03-22 14:37:02 -04:00
function has_bin( ) {
[ -e " $HOME /.nix-profile/bin/ $1 " ]
}
has_bin "bash" || nix profile install nixpkgs#bashInteractive
has_bin "bat" || nix profile install nixpkgs#bat
has_bin "bw" || nix profile install nixpkgs#bitwarden-cli
has_bin "broot" || nix profile install nixpkgs#broot
has_bin "cargo-dist" || nix profile install nixpkgs#cargo-dist
has_bin "cargo-flamegraph" || nix profile install nixpkgs#cargo-flamegraph
has_bin "cargo-release" || nix profile install nixpkgs#cargo-release
has_bin "cargo-udeps" || nix profile install nixpkgs#cargo-udeps
has_bin "cheat" || nix profile install nixpkgs#cheat
has_bin "chezmoi" || nix profile install nixpkgs#chezmoi
has_bin "croc" || nix profile install nixpkgs#croc
has_bin "curlie" || nix profile install nixpkgs#curlie
has_bin "delta" || nix profile install nixpkgs#delta
has_bin "direnv" || nix profile install nixpkgs#direnv
has_bin "dnsproxy" || nix profile install nixpkgs#dnsproxy
has_bin "dust" || nix profile install nixpkgs#du-dust
has_bin "fd" || nix profile install nixpkgs#fd
has_bin "flamegraph" || nix profile install nixpkgs#flamegraph
has_bin "fzf" || nix profile install nixpkgs#fzf
has_bin "git" || nix profile install nixpkgs#git
has_bin "git-gone" || nix profile install nixpkgs#git-gone
has_bin "grep" || nix profile install nixpkgs#gnugrep
has_bin "grex" || nix profile install nixpkgs#grex
has_bin "gron" || nix profile install nixpkgs#gron
has_bin "gum" || nix profile install nixpkgs#gum
has_bin "hx" || nix profile install nixpkgs#helix
has_bin "hexyl" || nix profile install nixpkgs#hexyl
has_bin "htop" || nix profile install nixpkgs#htop
has_bin "httpie" || nix profile install nixpkgs#httpie
has_bin "htmlq" || nix profile install nixpkgs#htmlq
has_bin "hyperfine" || nix profile install nixpkgs#hyperfine
has_bin "jc" || nix profile install nixpkgs#jc
has_bin "jiq" || nix profile install nixpkgs#jiq
has_bin "jq" || nix profile install nixpkgs#jq
has_bin "jqp" || nix profile install nixpkgs#jqp
has_bin "kibi" || nix profile install nixpkgs#kibi
has_bin "kondo" || nix profile install nixpkgs#kondo
has_bin "kubie" || nix profile install nixpkgs#kubie
has_bin "llama" || nix profile install nixpkgs#llama
has_bin "mdbook" || nix profile install nixpkgs#mdbook
has_bin "mosh" || nix profile install nixpkgs#mosh
has_bin "nvim" || nix profile install nixpkgs#neovim
has_bin "ouch" || nix profile install nixpkgs#ouch
2023-03-22 08:59:25 -04:00
#nix profile install nixpkgs#prettylist
2023-03-22 14:37:02 -04:00
has_bin "q" || nix profile install nixpkgs#q
has_bin "rg" || nix profile install nixpkgs#ripgrep
has_bin "rq" || jnix profile install nixpkgs#rq
has_bin "rustfilt" || nix profile install nixpkgs#rustfilt
has_bin "sd" || nix profile install nixpkgs#sd
has_bin "shellcheck" || nix profile install nixpkgs#shellcheck
has_bin "shfmt" || nix profile install nixpkgs#shfmt
has_bin "starship" || nix profile install nixpkgs#starship
has_bin "tldr" || nix profile install nixpkgs#tealdeer
has_bin "tokei" || nix profile install nixpkgs#tokei
has_bin "upterm" || nix profile install nixpkgs#upterm
has_bin "vim" || nix profile install nixpkgs#vim
has_bin "watchexec" || nix profile install nixpkgs#watchexec
has_bin "xcp" || nix profile install nixpkgs#xcp
has_bin "xh" || nix profile install nixpkgs#xh
has_bin "xsv" || nix profile install nixpkgs#xsv
has_bin "zola" || nix profile install nixpkgs#zola
has_bin "zoxide" || nix profile install nixpkgs#zoxide
2023-03-21 14:17:23 -04:00
if [ ! -e /Applications/kitty.app ] ; then
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
fi
mkdir -p " $HOME /.config/kitty "
cat <<EOF > "$HOME /.config/kitty/kitty.conf"
font_family Operator Mono Book
#bold_font Operator Mono Bold
#italic_font Operator Mono Italic
#bold_italic_font Operator Mono Bold Italic
font_size 20.0
cursor_shape block
shell_integration no-cursor
tab_bar_edge top
symbol_map U+23FB-U+23FE,U+2665,U+26A1,U+2B58,U+E000-U+E00A,U+E0A0-U+E0A3,U+E0B0-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+E200-U+E2A9,U+E300-U+E3E3,U+E5FA-U+E62F,U+E700-U+E7C5,U+F000-U+F2E0,U+F300-U+F31C,U+F400-U+F4A9,U+F500-U+F8FF Symbols Nerd Font
remember_window_size yes
initial_window_width 130c
initial_window_height 35c
# BEGIN_KITTY_THEME
# Atom One Light
include current-theme.conf
# END_KITTY_THEME
EOF
2023-03-22 14:37:02 -04:00
curl -sw '%{url_effective}\n' -Lo " $HOME /.config/kitty/current-theme.conf " https://git.penguincoder.org/penguincoder/dotfiles/raw/branch/main/dot_config/kitty/current-theme.conf
2023-03-21 14:17:23 -04:00
2023-03-22 14:37:02 -04:00
curl -sw '%{url_effective}\n' -Lo " $HOME /.config/starship.toml " https://git.penguincoder.org/penguincoder/dotfiles/raw/branch/main/dot_config/starship.toml
2023-03-21 14:17:23 -04:00
mkdir -p " $HOME /.config/helix "
2023-03-22 14:37:02 -04:00
curl -sw '%{url_effective}\n' -Lo " $HOME /.config/helix/config.toml " https://git.penguincoder.org/penguincoder/dotfiles/raw/branch/main/dot_config/helix/config.toml
2023-03-21 14:17:23 -04:00
cat <<EOF > "$HOME /.gitconfig"
[ push]
default = simple
[ user]
name = Andrew Coleman
email = penguincoder@gmail.com
[ advice]
detachedHead = false
[ core]
filemode = true
eol = lf
autocrlf = input
pager = delta
[ init]
defaultBranch = main
[ delta]
2023-03-22 08:59:25 -04:00
line-numbers = true
#line-numbers-zero-style = white
line-numbers-minus-style = bold red
line-numbers-plus-style = bold green
file-style = omit
hunk-header-style = file
syntax-theme = OneHalfLight
2023-03-21 14:17:23 -04:00
[ rebase]
autoStash = true
[ merge]
tool = vimdiff
conflictstyle = diff3
prompt = false
[ pull]
rebase = true
[ color]
branch = auto
diff = auto
status = auto
ui = true
[ color "branch" ]
current = yellow reverse
local = yellow
remote = green
[ color "diff" ]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[ color "status" ]
added = yellow
changed = green
untracked = red
[ alias]
logp = log --pretty= format:'%h %ad | %s%d [%an]' --graph --date= short
lg = log --graph --date-order --first-parent \
--pretty= format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset'
lgb = log --graph --date-order --branches --first-parent \
--pretty= format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset'
lga = log --graph --date-order --all \
--pretty= format:'%C(auto)%h%Creset %C(auto)%d%Creset %s %C(green)(%ad) %C(bold cyan)<%an>%Creset'
up = pull --rebase
branches-last-updated = branch -rv --sort= committerdate --format= '%(HEAD) %(color:green)%(committerdate:relative)%(color:reset)\t%(color:magenta)%(authorname)%(color:reset)\t%(color:yellow)%(refname:short)%(color:reset)'
EOF
if [ ! -d " $HOME /.cargo " ] ; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain stable --profile complete -y
fi
2023-03-22 14:37:02 -04:00
curl -sw '%{url_effective}\n' -Lo " $HOME /.tmux.conf " https://git.penguincoder.org/penguincoder/dotfiles/raw/branch/main/dot_tmux.conf
curl -sw '%{url_effective}\n' -Lo " $HOME /.vimrc " https://git.penguincoder.org/penguincoder/dotfiles/raw/branch/main/dot_vimrc
install -m 640 ./.zshrc " $HOME / "
AUTO_FILE = " $HOME /.zshrc.auto "
PATH = " $PATH : $HOME /.nix-profile/bin "
2023-03-22 15:11:48 -04:00
echo > " $AUTO_FILE "
2023-03-22 14:37:02 -04:00
atuin init zsh >> " $AUTO_FILE "
direnv hook zsh >> " $AUTO_FILE "
2023-03-22 15:11:48 -04:00
#just --completions zsh >> "$AUTO_FILE"
starship init zsh --print-full-init >> " $AUTO_FILE "
2023-03-22 14:37:02 -04:00
zoxide init zsh >> " $AUTO_FILE "
[ -d /usr/local/bin ] || sudo mkdir /usr/local/bin
function install_typst( ) {
echo "manually installing typst"
curl -sLO https://github.com/typst/typst/releases/download/22-03-21-2/typst-x86_64-apple-darwin.tar.gz
ouch d typst*.tar.gz
sudo install -m 755 typst*/typst /usr/local/bin/
rm -rf ./typst*
}
[ -e "/usr/local/bin/typst" ] || install_typst