diff options
| author | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2023-07-20 21:19:29 +0100 |
|---|---|---|
| committer | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2023-07-20 21:20:55 +0100 |
| commit | 0a07704d6dc53bf3a35d4aadfa240586f55e9487 (patch) | |
| tree | dc7d45dfd0b74b58fa7f19d09c61b4981cd7dc25 | |
| parent | 961c56632ba5c2e3937bced415697096ef8c8344 (diff) | |
Replace python installer
| -rw-r--r-- | README.md | 48 | ||||
| -rw-r--r-- | alacritty/.install.yml | 6 | ||||
| -rwxr-xr-x | bootstrap.sh | 5 | ||||
| -rwxr-xr-x | deploy.py | 81 | ||||
| -rw-r--r-- | git/.install-macos.yml | 10 | ||||
| -rw-r--r-- | info.yml | 236 | ||||
| -rw-r--r-- | install-arch.yml | 16 | ||||
| -rw-r--r-- | install-macos.yml | 8 | ||||
| -rw-r--r-- | mako/.install.yml | 6 | ||||
| -rw-r--r-- | requirements.txt | 2 | ||||
| -rw-r--r-- | sway/.install.yml | 22 | ||||
| -rw-r--r-- | sway/config | 2 | ||||
| -rw-r--r-- | swaylock/.install.yml | 6 | ||||
| -rw-r--r-- | tmux/.install.yml | 6 | ||||
| -rw-r--r-- | util/exceptions.py | 2 | ||||
| -rw-r--r-- | util/helpers.py | 13 | ||||
| -rw-r--r-- | util/prompt.py | 12 | ||||
| -rw-r--r-- | util/runners.py | 41 | ||||
| -rw-r--r-- | vim/.install.yml | 41 | ||||
| -rw-r--r-- | waybar/.install.yml | 14 | ||||
| -rw-r--r-- | wofi/.install.yml | 10 | ||||
| -rw-r--r-- | zsh/.install.yml | 18 |
22 files changed, 206 insertions, 399 deletions
@@ -1,14 +1,50 @@ # dotfiles -Dotfiles for my machines. While I don't recommend using them (since everybody has highly specific needs), you're welcome to look around. +Dotfiles for my machines. These configurations have been tested on a regular PC, M1 Mac running Asahi Linux, and even a Steam Deck. -## Usage +## Programs -For fast installation, I wrote a small script to copy the dotfiles to their destinations. +This repository contains configurations for the following programs, intended to be run on either Arch Linux or Asahi Linux (/Arch Linux ARM). Some (but not all) configurations will also work without any further editing on macOS. -The script also installs some utilities that I use. This is all defined in `info.yml`. +### Text-based -To use this script, simply run: +* [git](https://git-scm.com/) +* [neovim](https://neovim.io/) (*editor*) + * [onedark.vim](https://github.com/joshdick/onedark.vim) (*theme*) + * [vim-airline](https://github.com/vim-airline/vim-airline) (*status bar*) +* [tmux](https://github.com/tmux/tmux) (*multiplexer*) +* [zsh](https://www.zsh.org/) (*shell*) + * [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) + +### Graphical + +* [alacritty](https://alacritty.org/) (*terminal emulator*) +* [mako](https://github.com/emersion/mako) (*notifications*) +* [sway](https://swaywm.org/) (*WM*) +* [swaylock](https://github.com/swaywm/swaylock) +* [swayidle](https://github.com/swaywm/swayidle) +* [waybar](https://github.com/Alexays/Waybar) (*status bar*) +* [wofi](https://sr.ht/~scoopta/wofi/) (*launcher*) +* ~~[iTerm2](https://iterm2.com/)~~ (*terminal emulator, not currently in use*) +* ~~[rofi](https://github.com/davatorium/rofi)~~ (*launcher, not currently in use*) + +## Install + +This repository is designed to be installed with my own [dotfiles-installer](https://github.com/LMBishop/dotfiles-installer) program. Unless you happen to be me, I wouldn't suggest using this. + +Arch / Asahi: ``` -$ ./deploy.py +$ dotfiles-installer -f install-arch.yml ``` + +macOS - requires the Xcode command line tools: + +``` +$ dotfiles-installer -f install-macos.yml +``` + +## Screenshots + + + +
\ No newline at end of file diff --git a/alacritty/.install.yml b/alacritty/.install.yml new file mode 100644 index 0000000..877fe15 --- /dev/null +++ b/alacritty/.install.yml @@ -0,0 +1,6 @@ +name: Configure alacritty +steps: + - !Link + from: "alacritty.yml" + to: "~/.config/alacritty/alacritty.yml" + recursive: false
\ No newline at end of file diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index 0cdae57..0000000 --- a/bootstrap.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -python -m pip install -r requirements.txt - -python deploy.sh diff --git a/deploy.py b/deploy.py deleted file mode 100755 index 4f373ee..0000000 --- a/deploy.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/python3 -import os - -from util.runners import run_step -from util.exceptions import StepFailedError -from util.helpers import check_preconditions -from util.prompt import query_yes_no - -import yaml -from termcolor import colored - -CWD = os.getcwd() -OVERWRITE_FILES = os.getenv("OVERWRITE_FILES") - - -def get_sections_meeting_preconditions(yaml): - sections = {} - for key, section in yaml["sections"].items(): - if not check_preconditions(section): - continue - - sections[key] = section - - return sections - - -def run_section(title, section): - os.chdir(CWD) - if "directory" in section: - os.chdir(section["directory"]) - elif os.path.exists(title): - os.chdir(title) - - for step in section["steps"]: - if not check_preconditions(step): - continue - - run_step(step) - - -with open("info.yml", "r") as f: - yaml = yaml.safe_load(f) - -sections = get_sections_meeting_preconditions(yaml) - -print("Sections to run: " + ", ".join( - map(lambda x: colored(x, "green"), sections.keys()) -)) -print() - -if OVERWRITE_FILES == "1": - print(colored("Warning: ", "red") + "you have requested overwrite mode!") - print() - -if not query_yes_no("Proceed with install?", False): - exit(1) - -section_count = 0 -total = len(sections.keys()) -notes = {} -for key, section in sections.items(): - section_count += 1 - print(colored(f"[{section_count}/{total}] ", "white", attrs=["bold"]) - + "Section " - + colored(key, "green")) - try: - run_section(key, section) - if "notes" in section: - notes[key] = section["notes"] - except StepFailedError as e: - print(colored("Step failed: ", "red") + str(e)) - print() - -if len(notes) > 0: - print(colored(f"[Notes]", "white", attrs=["bold"])) - print() - for key, note in notes.items(): - print("From " + colored(key, "green") + ":") - for message in note: - print(f"- {message}") - print() diff --git a/git/.install-macos.yml b/git/.install-macos.yml new file mode 100644 index 0000000..808796a --- /dev/null +++ b/git/.install-macos.yml @@ -0,0 +1,10 @@ +name: Configure git (macOS) +steps: + - !Link + from: ".gitignore_global" + to: "~/.gitignore_global" + recursive: false + - !Link + from: ".gitconfig-macos" + to: "~/.gitconfig" + recursive: false
\ No newline at end of file diff --git a/info.yml b/info.yml deleted file mode 100644 index c6f80ca..0000000 --- a/info.yml +++ /dev/null @@ -1,236 +0,0 @@ -sections: - - # Installs brew on macOS - install-brew: - preconditions: - os: "macos" - not-installed: - - "brew" - steps: - - ==: run - command: "/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"" - - # Install oh-my-zsh - install-oh-my-zsh: - tags: ["config"] - preconditions: - not-present: - - ~/.oh-my-zsh - steps: - - ==: run - command: "sh -c \"$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\"" - - # Copy zsh configurations - configure-zsh: - tags: ["config"] - directory: "zsh" - steps: - - ==: link - from: .zshrc - to: ~/.zshrc - - ==: run - command: "mkdir -p ~/.config/zsh" - - ==: link - from: config/aliases.zsh - to: ~/.config/zsh/aliases.zsh - - ==: link - from: config/environment.zsh - to: ~/.config/zsh/environment.zsh - - ==: link - from: config/prompt.zsh - to: ~/.config/zsh/prompt.zsh - - ==: run - command: "mkdir -p ~/.config/zsh/other" - notes: - - "Remember to change shell to zsh" - - # Copy vim configurations - configure-vim: - directory: "vim" - tags: ["config"] - steps: - - ==: run - command: "mkdir -p ~/.config/nvim/" - - ==: run - command: "mkdir -p ~/.config/nvim/lua" - - ==: run - command: "mkdir -p ~/.config/nvim/lua/config" - - ==: link - from: .vimrc - to: ~/.vimrc - - ==: link - from: nvim/init.lua - to: ~/.config/nvim/init.lua - - ==: link - from: nvim/lua/plugins.lua - to: ~/.config/nvim/lua/plugins.lua - - ==: link - from: nvim/lua/keybindings.lua - to: ~/.config/nvim/lua/keybindings.lua - - ==: link - from: nvim/lua/config/init.lua - to: ~/.config/nvim/lua/config/init.lua - - ==: link - from: nvim/lua/config/autocomplete.lua - to: ~/.config/nvim/lua/config/autocomplete.lua - - ==: link - from: nvim/lua/config/diagnostic.lua - to: ~/.config/nvim/lua/config/diagnostic.lua - - ==: link - from: nvim/lua/config/lsp.lua - to: ~/.config/nvim/lua/config/lsp.lua - - ==: link - from: nvim/lua/config/treesitter.lua - to: ~/.config/nvim/lua/config/treesitter.lua - notes: - - "For nvim, run :PackerInstall" - - # Install packer.nvim - install-packer-nvim: - tags: ["config"] - steps: - - ==: run - command: "git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim" - - # Copy iterm2 configurations for macOS - configure-iterm2: - directory: "iterm2" - tags: ["config"] - preconditions: - os: "macosdsakjghajsdhlsjg" - - # Copy iterm2 configurations for macOS - configure-git: - directory: "git" - tags: ["config"] - steps: - - ==: link - preconditions: - os: "macos" - from: .gitconfig-macos - to: ~/.gitconfig - - ==: link - from: .gitignore_global - to: ~/.gitignore_global - - # Copy tmux configurations - configure-tmux: - directory: "tmux" - tags: ["config"] - steps: - - ==: link - from: .tmux.conf - to: ~/.tmux.conf - - # Copy alacritty configurations - configure-alacritty: - directory: "alacritty" - tags: ["config"] - preconditions: - os: "linux" - steps: - - ==: run - command: "mkdir -p ~/.config/alacritty" - - ==: link - from: alacritty.yml - to: ~/.config/alacritty/alacritty.yml - - # Copy mako configurations - configure-mako: - directory: "mako" - tags: ["config"] - preconditions: - os: "linux" - steps: - - ==: run - command: "mkdir -p ~/.config/mako" - - ==: link - from: config - to: ~/.config/mako/config - - # Copy rofi configurations - #configure-rofi: - # directory: "rofi" - # tags: ["config"] - # preconditions: - # os: "linux" - # steps: - # - ==: run - # command: "mkdir -p ~/.config/rofi" - # - ==: link - # from: config.rasi - # to: ~/.config/rofi/config.rasi - - # Copy wofi configurations - configure-wofi: - directory: "wofi" - tags: ["config"] - preconditions: - os: "linux" - steps: - - ==: run - command: "mkdir -p ~/.config/wofi" - - ==: link - from: config - to: ~/.config/wofi/config - - ==: link - from: style.css - to: ~/.config/wofi/style.css - - # Copy sway configurations - configure-sway: - directory: "sway" - tags: ["config"] - preconditions: - os: "linux" - steps: - - ==: run - command: "mkdir -p ~/.config/sway/scripts" - - ==: link - from: config - to: ~/.config/sway/config - - ==: link - from: wallpaper.jpg - to: ~/.config/sway/wallpaper.jpg - - ==: run - command: "cp input.cfg ~/.config/sway/input.cfg" - - ==: run - command: "cp output.cfg ~/.config/sway/output.cfg" - - ==: link - from: scripts/exit-menu.sh - to: ~/.config/sway/scripts/exit-menu.sh - - # Copy waybar configurations - configure-waybar: - directory: "waybar" - tags: ["config"] - preconditions: - os: "linux" - steps: - - ==: run - command: "mkdir -p ~/.config/waybar" - - ==: run - command: "mkdir -p ~/.config/waybar/scripts" - - ==: link - from: config - to: ~/.config/waybar/config - - ==: link - from: style.css - to: ~/.config/waybar/style.css - - ==: link - from: scripts/mediaplayer.py - to: ~/.config/waybar/scripts/mediaplayer.py - - # Copy swaylock configurations - configure-swaylock: - directory: "swaylock" - tags: ["config"] - preconditions: - os: "linux" - steps: - - ==: run - command: "mkdir -p ~/.config/swaylock" - - ==: link - from: config - to: ~/.config/swaylock/config - diff --git a/install-arch.yml b/install-arch.yml new file mode 100644 index 0000000..1e0840d --- /dev/null +++ b/install-arch.yml @@ -0,0 +1,16 @@ +stages: + - from_file: alacritty/.install.yml + + - from_file: mako/.install.yml + + - from_file: sway/.install.yml + + - from_file: swaylock/.install.yml + + - from_file: vim/.install.yml + + - from_file: waybar/.install.yml + + - from_file: wofi/.install.yml + + - from_file: zsh/.install.yml
\ No newline at end of file diff --git a/install-macos.yml b/install-macos.yml new file mode 100644 index 0000000..d1c0af8 --- /dev/null +++ b/install-macos.yml @@ -0,0 +1,8 @@ +stages: + - from_file: git/.install-macos.yml + + - from_file: tmux/.install.yml + + - from_file: vim/.install.yml + + - from_file: zsh/.install.yml
\ No newline at end of file diff --git a/mako/.install.yml b/mako/.install.yml new file mode 100644 index 0000000..5d124c9 --- /dev/null +++ b/mako/.install.yml @@ -0,0 +1,6 @@ +name: Configure mako +steps: + - !Link + from: "config" + to: "~/.config/mako/config" + recursive: false
\ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index a6e4c4f..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -PyYAML==6.0 -termcolor==2.1.1 diff --git a/sway/.install.yml b/sway/.install.yml new file mode 100644 index 0000000..6924383 --- /dev/null +++ b/sway/.install.yml @@ -0,0 +1,22 @@ +name: Configure sway +steps: + - !Link + from: "config" + to: "~/.config/sway/config" + recursive: false + - !Link + from: "scripts/exit-menu.sh" + to: "~/.config/sway/scripts/exit-menu.sh" + recursive: false + - !Copy + from: "wallpaper.jpg" + to: "~/.config/sway/wallpaper.jpg" + recursive: false + - !Copy + from: "input.cfg" + to: "~/.config/sway/input.cfg" + recursive: false + - !Copy + from: "output.cfg" + to: "~/.config/sway/output.cfg" + recursive: false
\ No newline at end of file diff --git a/sway/config b/sway/config index 363e666..8d8a8d7 100644 --- a/sway/config +++ b/sway/config @@ -183,7 +183,7 @@ exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DE exec swayidle -w \ timeout 300 "notify-send 'Power' 'System will suspend very soon due to inactivity.'" \ timeout 310 "swaylock" \ - timeout 315 "systemctl suspend" \ + timeout 313 "swaymsg 'output * power off'" resume "swaymsg 'output * power on'" \ before-sleep "swaylock" exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 diff --git a/swaylock/.install.yml b/swaylock/.install.yml new file mode 100644 index 0000000..f8f47dd --- /dev/null +++ b/swaylock/.install.yml @@ -0,0 +1,6 @@ +name: Configure swaylock +steps: + - !Link + from: "config" + to: "~/.config/swaylock/config" + recursive: false
\ No newline at end of file diff --git a/tmux/.install.yml b/tmux/.install.yml new file mode 100644 index 0000000..bf7c8cf --- /dev/null +++ b/tmux/.install.yml @@ -0,0 +1,6 @@ +name: Configure tmux +steps: + - !Link + from: ".tmux.conf" + to: "~/.tmux.conf" + recursive: false
\ No newline at end of file diff --git a/util/exceptions.py b/util/exceptions.py deleted file mode 100644 index b14896d..0000000 --- a/util/exceptions.py +++ /dev/null @@ -1,2 +0,0 @@ -class StepFailedError(Exception): - pass diff --git a/util/helpers.py b/util/helpers.py deleted file mode 100644 index 5f970df..0000000 --- a/util/helpers.py +++ /dev/null @@ -1,13 +0,0 @@ -import os - -OS_TYPE = os.getenv("OS_TYPE") - - -# Returns True if all preconditions pass -def check_preconditions(obj): - if "preconditions" in obj: - if ("os" in obj["preconditions"] - and obj["preconditions"]["os"] != OS_TYPE): - return False - - return True diff --git a/util/prompt.py b/util/prompt.py deleted file mode 100644 index d6eb17b..0000000 --- a/util/prompt.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - - -def query_yes_no(question, default): - if default == True: - prompt = " [Y/n] " - else: - prompt = " [y/N] " - - sys.stdout.write(question + prompt) - choice = input().lower() - return True if choice == "y" else (False if choice == "n" else default) diff --git a/util/runners.py b/util/runners.py deleted file mode 100644 index dbfcf1f..0000000 --- a/util/runners.py +++ /dev/null @@ -1,41 +0,0 @@ -import os -import re -from util.exceptions import StepFailedError -from termcolor import colored - -HOME = os.getenv("HOME") -OVERWRITE_FILES = os.getenv("OVERWRITE_FILES") - - -def run_step(step): - step_type = step["=="] - - if step_type == "run": - do_run(step["command"]) - elif step_type == "link": - do_link(step["from"], step["to"]) - - -def do_run(command): - print(f"! {command}") - if not os.system(command) == 0: - raise StepFailedError("Non-zero return code") - - -def do_link(source, destination): - destination = re.sub(r"^~/", HOME + "/", destination) - print(f"Linking {source} -> {destination}") - if os.path.exists(destination): - if OVERWRITE_FILES == "1": - os.remove(destination) - print(colored(" (File overwritten)", "yellow")) - else: - print(colored(" (File already exists)", "yellow")) - return - - try: - os.link(source, destination) - except OSError as e: - raise StepFailedError("Link raised exeption: " + str(e)) from e - except Exception as e: - raise StepFailedError("Link raised exeption: " + str(e)) from e diff --git a/vim/.install.yml b/vim/.install.yml new file mode 100644 index 0000000..edbdc99 --- /dev/null +++ b/vim/.install.yml @@ -0,0 +1,41 @@ +name: Configure vim and nvim +steps: + - !Link + from: ".vimrc" + to: "~/.vimrc" + recursive: false + - !Link + from: "nvim/init.lua" + to: "~/.config/nvim/init.lua" + recursive: false + - !Link + from: "nvim/lua/plugins.lua" + to: "~/.config/nvim/lua/plugins.lua" + recursive: false + - !Link + from: "nvim/lua/keybindings.lua" + to: "~/.config/nvim/lua/keybindings.lua" + recursive: false + - !Link + from: "nvim/lua/config/init.lua" + to: "~/.config/nvim/lua/config/init.lua" + recursive: false + - !Link + from: "nvim/lua/config/autocomplete.lua" + to: "~/.config/nvim/lua/config/autocomplete.lua" + recursive: false + - !Link + from: "nvim/lua/config/diagnostic.lua" + to: "~/.config/nvim/lua/config/diagnostic.lua" + recursive: false + - !Link + from: "nvim/lua/config/lsp.lua" + to: "~/.config/nvim/lua/config/lsp.lua" + recursive: false + - !Link + from: "nvim/lua/config/treesitter.lua" + to: "~/.config/nvim/lua/config/treesitter.lua" + recursive: false + + # Install packer + - !Shell "git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim"
\ No newline at end of file diff --git a/waybar/.install.yml b/waybar/.install.yml new file mode 100644 index 0000000..5afef9c --- /dev/null +++ b/waybar/.install.yml @@ -0,0 +1,14 @@ +name: Configure waybar +steps: + - !Link + from: "config" + to: "~/.config/waybar/config" + recursive: false + - !Link + from: "style.css" + to: "~/.config/waybar/style.css" + recursive: false + - !Link + from: "scripts/mediaplayer.py" + to: "~/.config/waybar/scripts/mediaplayer.py" + recursive: false
\ No newline at end of file diff --git a/wofi/.install.yml b/wofi/.install.yml new file mode 100644 index 0000000..84217d3 --- /dev/null +++ b/wofi/.install.yml @@ -0,0 +1,10 @@ +name: Configure wofi +steps: + - !Link + from: "config" + to: "~/.config/wofi/config" + recursive: false + - !Link + from: "style.css" + to: "~/.config/wofi/style.css" + recursive: false
\ No newline at end of file diff --git a/zsh/.install.yml b/zsh/.install.yml new file mode 100644 index 0000000..0ea43db --- /dev/null +++ b/zsh/.install.yml @@ -0,0 +1,18 @@ +name: Configure zsh +steps: + - !Link + from: ".zshrc" + to: "~/.zshrc" + recursive: false + - !Link + from: "config/aliases.zsh" + to: "~/.config/zsh/aliases.zsh" + recursive: false + - !Link + from: "config/environment.zsh" + to: "~/.config/zsh/environment.zsh" + recursive: false + - !Link + from: "config/prompt.zsh" + to: "~/.config/zsh/prompt.zsh" + recursive: false
\ No newline at end of file |
