From 3317d24ebe2db644f9e952b6d306cf7d2e0d73d9 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Thu, 26 Jun 2025 14:30:46 +0200 Subject: [PATCH 1/7] doc: nix-community/NixOS-WSL quickstart :memo: --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3e14a03..35066bd 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ This repo is an extension of [dannydannydanny/methodology](https://github.com/Da ### WSL +Installation: [nix-community/NixOS-WSL Quickstart](https://github.com/nix-community/NixOS-WSL?tab=readme-ov-file#quick-start). ``` wsl --install --web-download -d Debian # From 75fd6193d53009a0a2f401459b95f19ba7f0c117 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Fri, 27 Jun 2025 15:22:50 +0200 Subject: [PATCH 2/7] doc: wsl-nixos setup :snowflake: --- README.md | 43 +++++++++++++------------------------------ 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 35066bd..4f6a3a9 100644 --- a/README.md +++ b/README.md @@ -60,36 +60,19 @@ This repo is an extension of [dannydannydanny/methodology](https://github.com/Da ### WSL -Installation: [nix-community/NixOS-WSL Quickstart](https://github.com/nix-community/NixOS-WSL?tab=readme-ov-file#quick-start). -``` -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 From abf3eeb817af9b8b0bd15ed4f253accb36c3242c Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Tue, 1 Jul 2025 15:33:20 +0200 Subject: [PATCH 3/7] doc: clean up readme top :memo: :art: --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4f6a3a9..060241f 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: From b5c4565519c2e662139375417ae7dbce8f0a54a4 Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Thu, 3 Jul 2025 12:02:55 +0000 Subject: [PATCH 4/7] merge README from WSL branch --- README.md | 54 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 060241f..9ee0315 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,15 @@ # dotfiles -[`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/) - This repo is an extension of [dannydannydanny/methodology](https://github.com/DannyDannyDanny/methodology/) +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, ...) + ## Roadmap: * ~post OS install~ remove [ubuntu.md](ubuntu.md) @@ -54,19 +60,35 @@ This repo is an extension of [dannydannydanny/methodology](https://github.com/Da ### WSL -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/ +``` +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 ``` ### Clone repo SSH method @@ -97,6 +119,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 From 920030ad3db9d28ace9bbbf01afb5e654190e87a Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Thu, 3 Jul 2025 12:05:29 +0000 Subject: [PATCH 5/7] chore: merge wsl theme script from wsl branch --- bashscripts/wsl_theme.sh | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 bashscripts/wsl_theme.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 + From 8bbc550865140bb2c6a83faf3c5b97a4166a57fb Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Thu, 3 Jul 2025 12:11:04 +0000 Subject: [PATCH 6/7] merge fish and neovim from wsl branch --- nixos/fish.nix | 73 ++++++++++++++++++++++++++++++++++++++++ nixos/neovim.nix | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 nixos/fish.nix create mode 100644 nixos/neovim.nix diff --git a/nixos/fish.nix b/nixos/fish.nix new file mode 100644 index 0000000..bb8c104 --- /dev/null +++ b/nixos/fish.nix @@ -0,0 +1,73 @@ +{ config, pkgs, ... }: + +{ + 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 + # ref: stackoverflow.com/a/61262358/5684214 + + function fish_prompt --description 'Write out the prompt' + set -l last_pipestatus $pipestatus + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. + set -l normal (set_color normal) + set -q fish_color_status + or set -g fish_color_status red + + # Color the prompt differently when we're root + set -l color_cwd $fish_color_cwd + set -l suffix '>' + if functions -q fish_is_root_user; and fish_is_root_user + if set -q fish_color_cwd_root + set color_cwd $fish_color_cwd_root + end + set suffix '#' + end + + # Write pipestatus + # If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it. + set -l bold_flag --bold + set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation + if test $__fish_prompt_status_generation = $status_generation + set bold_flag + end + set __fish_prompt_status_generation $status_generation + set -l status_color (set_color $fish_color_status) + set -l statusb_color (set_color $bold_flag $fish_color_status) + set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus) + set -l nix_shell_info ( + if test -n "$IN_NIX_SHELL" + echo -n "🐚 " + end + ) + + echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $nix_shell_info $suffix " " + end + + ''; + }; + + programs.bash = { + interactiveShellInit = '' + # the first arguement in the if statement check that the parent process is not a fish shell. + # this allows spawning a bash shell inside a fish shell without the inner-most bash shell launching a fish shell + # however this also means that nix-shell starts a bash shell unless you use `nix-shell [args] --run fish` + # or run `fish` as the first command when entering nix-shell + + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + }; +} + diff --git a/nixos/neovim.nix b/nixos/neovim.nix new file mode 100644 index 0000000..37af03c --- /dev/null +++ b/nixos/neovim.nix @@ -0,0 +1,86 @@ +{ config, pkgs, ... }: + +{ + programs.neovim = { + enable = true; + defaultEditor = true; + # package = pkgs.neovim; + configure = { + customRC = '' + set title + set go=a + set mouse=a + set nohlsearch + let mapleader="," + + 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 + + " relative line numbering when leaving insert mode + set relativenumber + autocmd InsertEnter * :set number norelativenumber + autocmd InsertLeave * :set nonumber relativenumber + + " netrw (dir listing) settings + let g:netrw_liststyle = 3 + let g:netrw_banner = 0 + let g:netrw_browse_split = 3 + let g:netrw_winsize = 25 " % of page + + set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:» + set clipboard+=unnamedplus + + " 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 + ''; + # vimPlugins inspired from Alexnortung + # https://discourse.nixos.org/t/neovim-no-longer-uses-config-or-plugins/13399/4 + 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 + fzf-vim # fuzzy finder through vim + nerdtree # file structure inside nvim + rainbow # color parenthesis + gruvbox-nvim # theme + goyo-vim # write prose + limelight-vim # prose paragraph highlighter + ]; + opt = []; + }; + }; + }; +} + From e9fd64a7cdfd0a39fbb8b0b66ef164ac576d8184 Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Thu, 3 Jul 2025 14:20:40 +0200 Subject: [PATCH 7/7] doc: heading + NixOS WSL (restore from history) :memo: --- README.md | 52 +++++++++++++++------------------------------------- 1 file changed, 15 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 9ee0315..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