dotfiles/install.sh

77 lines
2.5 KiB
Bash
Raw Normal View History

2021-03-20 22:36:25 +00:00
#/bin/bash
REPO_DIR=$(dirname $(readlink -f $0))
HOME_DIR=${HOME}
2024-02-01 07:32:07 +00:00
OS_RELEASE=$(cat /etc/os-release | grep -E "^ID=" | cut -d= -f2)
echo_header() {
bold=$(tput bold)
normal=$(tput sgr0)
red=$(tput setaf 1)
echo "${bold}${red}$1${normal}"
}
2021-03-20 22:36:25 +00:00
workspace_link() {
mkdir -p $(dirname $HOME_DIR/$2)
2021-03-20 22:36:25 +00:00
ln -s $REPO_DIR/$1 $HOME_DIR/$2 || true
}
2024-02-01 07:32:07 +00:00
if [ "$OS_RELEASE" = "fedora" ]; then
# We treat fedora install as gui. Think PC, Laptop etc.
echo_header "==[host] Detected Fedora"
# On host we only install minimal dependencies.
# Mostly just GUI applications.
echo_header "==[host] Installing rpm-os tree packages"
rpm-ostree install --idempotent --apply-live --allow-inactive -y \
git git-lfs \
kitty zsh \
podman-docker \
gphoto2 v4l2loopback ffmpeg
2024-01-29 23:30:26 +00:00
2024-02-01 07:32:07 +00:00
echo_header "==[host] Installing flatpaks"
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install -y --user \
com.bitwarden.desktop \
md.obsidian.Obsidian \
org.mozilla.firefox \
org.mozilla.Thunderbird \
org.gnome.Builder \
com.vscodium.codium
echo_header "==[host] Installing fonts"
HOME_FONTS_DIR="${HOME_DIR}/.local/share/fonts"
mkdir -p ${HOME_FONTS_DIR}
rm -rf ${HOME_FONTS_DIR}/dotfiles-fonts
git clone --depth 1 git@github.com:mentos1386/dotfiles-fonts.git ${HOME_FONTS_DIR}/dotfiles-fonts
fc-cache
elif [ "$OS_RELEASE" = "ubuntu" ]; then
# We treat ubuntu install as non gui. Think WSL, VM etc.
echo_header "==[host] Detected Ubuntu"
sudo apt update
sudo apt install -y \
git git-lfs zsh
fi
echo_header "==[host] Installing Nix"
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
2024-01-29 23:30:26 +00:00
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
2024-01-30 18:35:52 +00:00
2024-02-01 07:32:07 +00:00
echo_header "==[host] Installing Home Manager"
2024-01-30 18:35:52 +00:00
workspace_link nix/home.nix .config/home-manager/home.nix
2024-02-01 07:32:07 +00:00
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
2024-01-29 23:30:26 +00:00
2024-02-01 07:32:07 +00:00
echo_header "==[host] Installing Home Manager packages"
2024-01-29 23:30:26 +00:00
home-manager switch
2024-02-01 07:32:07 +00:00
echo_header "==[host] Use zsh as default shell"
2024-01-29 23:30:26 +00:00
sudo chsh $USER --shell=/bin/zsh
2024-02-01 07:32:07 +00:00
echo_header "==[host] Plug for neovim"
2024-01-31 12:29:11 +00:00
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
2024-02-01 07:32:07 +00:00
nvim --headless +'PlugInstall --sync' +qa
nvim --headless +UpdateRemotePlugins +qa