diff --git a/Makefile b/Makefile index 812d5049..c821d8fb 100644 --- a/Makefile +++ b/Makefile @@ -15,34 +15,31 @@ BIN_ITEMS := $(wildcard bin/*) BIN_TARGETS := $(BIN_ITEMS:bin/%=$(LOCAL_BIN)/%) ZSH_ITEMS := $(wildcard *.zsh) ZSH_TARGETS := $(ZSH_ITEMS:%.zsh=$(ZSH_CUSTOM_DIR)/%.zsh) +INSTALLER_ITEMS := $(wildcard installers/*) +INSTALLER_TARGETS := $(INSTALLER_ITEMS:installers/%.sh=%) PACKER_REPO := https://github.com/wbthomason/packer.nvim PACKER_DIR := $(HOME)/.local/share/nvim/site/pack/packer/start/packer.nvim POWERLEVEL_REPO := https://github.com/romkatv/powerlevel10k.git POWERLEVEL_DIR := $(ZSH_CUSTOM_DIR)/themes/powerlevel10k -.PHONY := all force clean config zsh nvim ssh git +.PHONY := all force clean config zsh nvim ssh git bin $(INSTALLER_TARGETS) -all: config zsh nvim ssh git +config: $(CONFIG_TARGETS) $(SYSTEMD_TARGETS) zsh ssh + +bin: $(BIN_TARGETS) $(INSTALLER_TARGETS) + +all: config bin force: clean all clean: curl -sSL https://install.python-poetry.org | python3 - --uninstall -config: $(CONFIG_TARGETS) $(SYSTEMD_TARGETS) - zsh: $(ZSH_DIR) $(ZSH_CUSTOM_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS) -nvim: $(PACKER_DIR) - ssh: $(HOME)/.ssh/config -git: $(HOME)/.gitconfig - grep "name" $? > /dev/null || git config --global user.name "Evie Litherland-Smith" - grep "editor" $? > /dev/null || git config --global core.editor "nvim" - grep "rebase" $? > /dev/null || git config --global pull.rebase false - $(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/% $(SYSTEMD_TARGETS): $(SYSTEMD_DIR)/%: systemd/% $(FONT_TARGETS): $(FONT_DIR)/%: nerdfont_symbols/% @@ -53,8 +50,8 @@ $(CONFIG_TARGETS) $(SYSTEMD_TARGETS) $(FONT_TARGETS) $(ZSH_TARGETS): $(BIN_TARGETS): $(LOCAL_BIN)/%: bin/% command -v $? 2> /dev/null || ln -s $(PWD)$? $@ -$(LOCAL_BIN)/poetry: $(LOCAL_BIN) - command -v poetry > /dev/null || curl -sSL https://install.python-poetry.org | python3 - +$(INSTALLER_TARGETS): $(LOCAL_BIN) + ./installers/$@.sh $(HOME)/.ssh/config: $(HOME)/.ssh $(HOME)/.ssh/sockets cp -n templates/ssh-config $@ diff --git a/installers/fzf.sh b/installers/fzf.sh new file mode 100755 index 00000000..d82d0108 --- /dev/null +++ b/installers/fzf.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +command -v fzf > /dev/null && exit 0 +git clone --depth 1 https://github.com/junegunn/fzf.git "$HOME/.fzf" +"$HOME/.fzf/install" diff --git a/installers/kitty.sh b/installers/kitty.sh new file mode 100755 index 00000000..49ea07e9 --- /dev/null +++ b/installers/kitty.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# kitty +command -v kitty > /dev/null && exit 0 +curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin +# Create a symbolic link to add kitty to PATH (assuming $HOME/.local/bin is in +# your system-wide PATH) +ln -s "$HOME/.local/kitty.app/bin/kitty" "$HOME/.local/bin/" +# Place the kitty.desktop file somewhere it can be found by the OS +cp "$HOME/.local/kitty.app/share/applications/kitty.desktop" "$HOME/.local/share/applications/" +# If you want to open text files and images in kitty via your file manager also add the kitty-open.desktop file +cp "$HOME/.local/kitty.app/share/applications/kitty-open.desktop" "$HOME/.local/share/applications/" +# Update the paths to the kitty and its icon in the kitty.desktop file(s) +sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" "$HOME/.local/share/applications/kitty.desktop" +sed -i "s|Exec=kitty|Exec=/home/$USER/.local/kitty.app/bin/kitty|g" "$HOME/.local/share/applications/kitty.desktop" diff --git a/installers/neovim.sh b/installers/neovim.sh new file mode 100755 index 00000000..3455d230 --- /dev/null +++ b/installers/neovim.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +command -v nvim > /dev/null && exit 0 +curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage +chmod u+x nvim.appimage +mv nvim.appimage "$HOME/.local/bin/nvim" +ln -s "$HOME/.local/bin/nvim" "$HOME/.local/bin/vim" diff --git a/installers/pipx.sh b/installers/pipx.sh new file mode 100755 index 00000000..c6ccdcd1 --- /dev/null +++ b/installers/pipx.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +command -v pipx > /dev/null || python3 -m pip install --user pipx +command -v poetry > /dev/null || python3 -m pipx install poetry +pipx list | grep -i python-lsp-server && exit 0 +python3 -m pipx install python-lsp-server && python3 -m pipx inject python-lsp-server pylsp-mypy python-lsp-black python-lsp-isort + diff --git a/installers/pyenv.sh b/installers/pyenv.sh new file mode 100755 index 00000000..d5de2f8a --- /dev/null +++ b/installers/pyenv.sh @@ -0,0 +1,11 @@ +#! /usr/bin/env bash + +command -v pyenv > /dev/null && exit 0 +curl https://pyenv.run | bash +# Below are suggested dependencies for python +# command -v apt > /dev/null && { +# sudo apt update +# sudo apt install build-essential libssl-dev zlib1g-dev \ +# libbz2-dev libreadline-dev libsqlite3-dev curl llvm \ +# libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev +# } diff --git a/packages.txt b/packages.txt index 79952365..183650e9 100644 --- a/packages.txt +++ b/packages.txt @@ -2,9 +2,6 @@ kitty neovim fzf pyenv -pyright pipx -black -isort pre-commit ranger diff --git a/software.sh b/software.sh deleted file mode 100755 index 896767c0..00000000 --- a/software.sh +++ /dev/null @@ -1,62 +0,0 @@ -#! /usr/bin/env bash -# Install various programs - -echo "Not for use" -exit 1 - -mkdir -p "$HOME/.local/bin" - -# python -command -v apt > /dev/null && sudo apt install python3 python3-pip python3-venv - -# pyenv -command -v pyenv > /dev/null || { - curl https://pyenv.run | bash - # Below are suggested dependencies for python - command -v apt > /dev/null && { - sudo apt update - sudo apt install build-essential libssl-dev zlib1g-dev \ - libbz2-dev libreadline-dev libsqlite3-dev curl llvm \ - libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev - } -} - -# pipx -command -v pipx > /dev/null || python3 -m pip install --user pipx -command -v pyright > /dev/null || python3 -m pipx install pyright -command -v poetry > /dev/null || python3 -m pipx install poetry -command -v black > /dev/null || python3 -m pipx install black -command -v isort > /dev/null || python3 -m pipx install isort -command -v zimports > /dev/null || python3 -m pipx install zimports -command -v pre-commit > /dev/null || python3 -m pipx install pre-commit -command -v ranger > /dev/null || python3 -m pipx install ranger-fm -command -v euporie > /dev/null || python3 -m pipx install euporie - -# kitty -command -v kitty > /dev/null || { - curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin - # Create a symbolic link to add kitty to PATH (assuming $HOME/.local/bin is in - # your system-wide PATH) - ln -s "$HOME/.local/kitty.app/bin/kitty" "$HOME/.local/bin/" - # Place the kitty.desktop file somewhere it can be found by the OS - cp "$HOME/.local/kitty.app/share/applications/kitty.desktop" "$HOME/.local/share/applications/" - # If you want to open text files and images in kitty via your file manager also add the kitty-open.desktop file - cp "$HOME/.local/kitty.app/share/applications/kitty-open.desktop" "$HOME/.local/share/applications/" - # Update the paths to the kitty and its icon in the kitty.desktop file(s) - sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" "$HOME/.local/share/applications/kitty.desktop" - sed -i "s|Exec=kitty|Exec=/home/$USER/.local/kitty.app/bin/kitty|g" "$HOME/.local/share/applications/kitty.desktop" -} - -# neovim -command -v nvim > /dev/null || { - curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage - chmod u+x nvim.appimage - mv nvim.appimage "$HOME/.local/bin/nvim" - ln -s "$HOME/.local/bin/nvim" "$HOME/.local/bin/vim" -} - -# fzf -command -v fzf > /dev/null || { - git clone --depth 1 https://github.com/junegunn/fzf.git "$HOME/.fzf" - "$HOME/.fzf/install" -}