new bins and formatted

main
Andrew Coleman 2023-07-28 08:28:53 -04:00
parent 21d150f665
commit a57c555a3d
1 changed files with 43 additions and 27 deletions

View File

@ -1,24 +1,24 @@
#!/bin/sh
[ ! -z "${DEBUG-}" ] && set -x
[ -n "${DEBUG-}" ] && set -x
cd "$(dirname $0)" || exit 1
cd "$(dirname "$0")" || exit 1
if ! pgrep nix-daemon > /dev/null 2>&1 ; then
sh < $(curl -L https://nixos.org/nix/install)
if ! pgrep nix-daemon >/dev/null 2>&1; then
sh <"$(curl -L https://nixos.org/nix/install)"
fi
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
if [ ! -f "$HOME/.config/nix/nix.conf" ]; then
echo "experimental-features = nix-command flakes" >>"$HOME/.config/nix/nix.conf"
echo "trusted-users = root andrew" | sudo tee -a /etc/nix/nix.conf && sudo pkill nix-daemon
cachix use devenv
nix profile install --accept-flake-config github:cachix/devenv/latest
fi
function has_bin() {
has_bin() {
[ -e "$HOME/.nix-profile/bin/$1" ]
}
@ -67,7 +67,9 @@ 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 "nix-bisect" || nix profile install nixpkgs#nix-bisect
has_bin "nix-doc" || nix profile install nixpkgs#nix-doc
# fails for some odd reason at the moment
#has_bin "nix-doc" || nix profile install nixpkgs#nix-doc
command -v "nix-doc" >/dev/null || cargo install nix-doc
has_bin "nix-init" || nix profile install nixpkgs#nix-init
has_bin "nix-search" || nix profile install github:peterldowns/nix-search-cli --refresh
has_bin "nurl" || nix profile install nixpkgs#nurl
@ -81,6 +83,7 @@ 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 "spacer" || nix profile install nixpkgs#spacer
has_bin "starship" || nix profile install nixpkgs#starship
has_bin "terminal-notifier" || nix profile install nixpkgs#terminal-notifier
has_bin "tig" || nix profile install nixpkgs#tig
@ -92,22 +95,33 @@ 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 "zenith" || nix profile install nixpkgs#zenith
has_bin "zola" || nix profile install nixpkgs#zola
has_bin "zoxide" || nix profile install nixpkgs#zoxide
PATH="$PATH:$HOME/.nix-profile/bin"
function newest_wezterm_release() {
curl -H "Accept: application/vnd.github+json" -L https://api.github.com/repos/wez/wezterm/releases/latest | jq -r '.assets | map(select(.name | startswith("WezTerm-macos"))) | first.browser_download_url'
newest_wezterm_release() {
curl -s -H "Accept: application/vnd.github+json" -L https://api.github.com/repos/wez/wezterm/releases/latest | jq -r '.assets | map(select(.name | startswith("WezTerm-macos"))) | first.browser_download_url'
}
LATEST_WEZTERM=$(newest_wezterm_release)
if [ ! -e /Applications/WezTerm.app ] ; then
curl -Lo wezterm.zip $(latest_wezterm_release)
install_latest_wezterm() {
curl -Lo wezterm.zip "$LATEST_WEZTERM"
ouch d wezterm.zip
mv WezTerm-macos-*/WezTerm.app /Applications/ && rm -rf wezterm.zip WezTerm-macos-*
}
if [ ! -e /Applications/WezTerm.app ]; then
install_latest_wezterm
else
current_wezterm=$(/Applications/WezTerm.app/Contents/MacOS/wezterm -V | awk '{print $2}')
if ! echo $LATEST_WEZTERM | grep "$current_wezterm"; then
install_latest_wezterm
fi
fi
cat <<EOF > "$HOME/.wezterm.lua"
cat <<EOF >"$HOME/.wezterm.lua"
local wezterm = require 'wezterm'
local config = {}
@ -142,13 +156,13 @@ config.keys = {
return config
EOF
cat <<EOF > "$HOME/.config/starship.toml"
cat <<EOF >"$HOME/.config/starship.toml"
[container]
disabled=true
EOF
mkdir -p "$HOME/.config/helix/themes"
cat <<EOF > "$HOME/.config/helix/config.toml"
cat <<EOF >"$HOME/.config/helix/config.toml"
theme = "mylight"
[editor]
@ -176,7 +190,7 @@ tab = "all"
"^" = "goto_line_start"
EOF
cat <<EOF > "$HOME/.config/helix/themes/mylight.toml"
cat <<EOF >"$HOME/.config/helix/themes/mylight.toml"
inherits = "onelight"
"comment" = { fg = "grey" }
@ -185,7 +199,7 @@ inherits = "onelight"
"comment.block.documentation" = { fg = "grey" }
EOF
cat <<EOF > "$HOME/.gitconfig"
cat <<EOF >"$HOME/.gitconfig"
[push]
default = simple
@ -259,15 +273,15 @@ cat <<EOF > "$HOME/.gitconfig"
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
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
cat <<EOF > "$HOME/.tmux.conf"
cat <<EOF >"$HOME/.tmux.conf"
set-option -g update-environment "SSH_AUTH_SOCK SSH_CONNECTION"
EOF
cat <<EOF > "$HOME/.vimrc"
cat <<EOF >"$HOME/.vimrc"
" gratis https://swordandsignals.com/2020/12/13/5-lines-in-vimrc.html
set hlsearch " highlight all search results
set ignorecase " do case insensitive search
@ -287,19 +301,21 @@ EOF
install -m 640 ./.zshrc "$HOME/"
AUTO_FILE="$HOME/.zshrc.auto"
echo > "$AUTO_FILE"
atuin init zsh --disable-up-arrow >> "$AUTO_FILE"
direnv hook zsh >> "$AUTO_FILE"
starship init zsh --print-full-init >> "$AUTO_FILE"
zoxide init zsh >> "$AUTO_FILE"
{
atuin init zsh --disable-up-arrow
direnv hook zsh
starship init zsh --print-full-init
zoxide init zsh
} >"$AUTO_FILE"
[ -d /usr/local/bin ] || sudo mkdir /usr/local/bin
function install_typst() {
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/
sudo install -m 755 typst*/typst /usr/local/bin/
rm -rf ./typst*
}
[ -e "/usr/local/bin/typst" ] || install_typst