diff --git a/README.md b/README.md index 3e14a03..88086be 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,8 @@ # dotfiles -This repo is an extension of [dannydannydanny/methodology](https://github.com/DannyDannyDanny/methodology/) +[`nixos`](https://nixos.org/) + [`tmux`](https://github.com/tmux/tmux/?tab=readme-ov-file#welcome-to-tmux) + [`fish`](https://fishshell.com/) + [`neovim`](https://neovim.io/) -1. Debian Setup (+ customizations) - * pure see [issue 3]([url](https://github.com/DannyDannyDanny/dotfiles/issues/3)) - * [wsl](#wsl) - * codespaces - * github actions -2. Core Tool Chain (fish, tmux, nvim, fzf) -3. Customizations (github via ssh, ...) +This repo is an extension of [dannydannydanny/methodology](https://github.com/DannyDannyDanny/methodology/) ## Roadmap: @@ -60,35 +54,19 @@ This repo is an extension of [dannydannydanny/methodology](https://github.com/Da ### WSL -``` -wsl --install --web-download -d Debian -# -# /dev/null -echo generateResolvConf = false | sudo tee -a /etc/wsl.conf > /dev/null - -# fix WSL nameserver -echo 'nameserver 8.8.8.8' | sudo tee -a /etc/resolv.conf > /dev/null -sudo apt update && sudo apt upgrade -y - -# install dependencies for dotfiles installation -sudo apt install -y git curl - -# install dependencies for tmux -sudo apt install -y build-essential ncurses-dev +Install via [nix-community/NixOS-WSL Quickstart](https://github.com/nix-community/NixOS-WSL?tab=readme-ov-file#quick-start) :white_check_mark: +Setup dotfiles / config via github: +```bash +# git and github CLI tool in a temp shell +nix-shell -p gh git +# authenticate +gh auth login +# clone dotfiles +gh repo clone dannydannydanny/dotfiles +# checkout the appropriate branch +git checkout feat/wsl-neovim-update +# rebuild system with +sudo nixos-rebuild switch --flake ~/dotfiles/nixos/ ``` ### Clone repo SSH method @@ -119,6 +97,8 @@ cd dotfiles git config user.name "DannyDannyDanny" git config user.email "dth@taiga.ai" git config pull.rebase false +git config push.autoSetupRemote true +# more git config: https://blog.gitbutler.com/how-git-core-devs-configure-git/ # install dotfiles bash install.sh diff --git a/bashscripts/wsl_theme.sh b/bashscripts/wsl_theme.sh new file mode 100644 index 0000000..51eba02 --- /dev/null +++ b/bashscripts/wsl_theme.sh @@ -0,0 +1,52 @@ +color_scheme=$1 + +# write a file with the current theme here: +nvim_color_theme_path=~/.local/share/nvim_color_scheme + +# validate user input +if [[ "$color_scheme" != "dark" && "$color_scheme" != "light" ]]; then + echo "Error: Color scheme must be 'dark' or 'light'" >&2 + exit 1 +else + echo $color_scheme > $nvim_color_theme_path +fi + +# check that all relevant files exist +windows_username=$(powershell.exe '$env:UserName' | tr -d '\r\n') +dark_mode_config_path=~/python-projects/24_alacritty_windows_setup/gruvbox_material_medium_dark.toml +light_mode_config_path=~/python-projects/24_alacritty_windows_setup/gruvbox_material_medium_light.toml +if [ ! -f $light_mode_config_path ]; then + echo "error: light_mode_config_path missing" + echo "expected: $light_mode_config_path" + exit 1 +fi + +if [ ! -f $dark_mode_config_path ]; then + echo "error: dark_mode_config_path missing" + echo "expected: $dark_mode_config_path" + exit 1 +fi + +windows_alacritty_config_path="/mnt/c/Users/${windows_username}/AppData/Roaming/alacritty/alacritty.toml" +echo 'overwriting windows alacritty config' + +if [ $color_scheme = 'dark' ]; then + echo "going dark" + cp $dark_mode_config_path $windows_alacritty_config_path + + # explorer, browser etc + powershell.exe -Command "Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0" + # taskbar and start menu + powershell.exe -Command "Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0" +fi + +if [ $color_scheme = 'light' ]; then + echo "going light" + cp $light_mode_config_path $windows_alacritty_config_path + + # explorer, browser etc + powershell.exe -Command "Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 1" + # taskbar and start menu + powershell.exe -Command "Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 1" +fi + diff --git a/nixos/fish.nix b/nixos/fish.nix index 440a3db..bb8c104 100644 --- a/nixos/fish.nix +++ b/nixos/fish.nix @@ -3,11 +3,13 @@ { programs.fish = { enable = true; + shellAliases = { + theme = "bash ~/dotfiles/bashscripts/wsl_theme.sh"; + }; interactiveShellInit = '' fish_vi_key_bindings set fish_greeting 🐟: (set_color yellow; date +%T; set_color green; date --iso-8601; set_color normal) - # name: Default # author: Lily Ballard # edits: DannyDannyDanny diff --git a/nixos/neovim.nix b/nixos/neovim.nix index b452eeb..37af03c 100644 --- a/nixos/neovim.nix +++ b/nixos/neovim.nix @@ -11,9 +11,29 @@ set go=a set mouse=a set nohlsearch + let mapleader="," - set bg=dark - " set bg=light + lua << EOF + local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme' + local f=io.open(config_file, "r") + if f~=nil then + local system_theme = f:read() + -- f:close() + io.close(f) + if system_theme == 'dark' then + vim.cmd("set bg=dark") + elseif system_theme == 'light' then + vim.cmd("set bg=light") + else + print('warning: expected value "light" or "dark"') + print(' got:', system_theme) + print(' expected path:', file) + end + else + print('warning: nvim color scheme not found') + print(' expected path:', file) + end + EOF colorscheme gruvbox @@ -34,6 +54,9 @@ " Replace-all is aliased to S. nnoremap S :%s//g + " save file with ,w + map w :w + " spellcheck set spell spelllang=en_us setlocal spell! spelllang=en_us @@ -43,6 +66,8 @@ packages.nix = with pkgs.vimPlugins; { start = [ vim-surround # shortcuts for setting () {} etc. + vim-gitgutter # git diff in sign column + # vim-airline # nice and light status bar # doesn't work nicely with tmux # coc-nvim coc-git coc-highlight coc-python coc-rls coc-vetur coc-vimtex coc-yaml coc-html coc-json # auto completion vim-nix # nix highlight vimtex # latex stuff