From 7544e12117bd6a1133504acbbc3acf5bb858c92f Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Mon, 8 Sep 2025 20:41:49 +0200 Subject: [PATCH] chore: revert neovim changes, remove tmux + fish from nix-darwin :hammer: --- nixos/flake.lock | 22 ++++++++ nixos/flake.nix | 6 +- nixos/neovim.nix | 140 +++++++++++++++++++++++------------------------ 3 files changed, 94 insertions(+), 74 deletions(-) diff --git a/nixos/flake.lock b/nixos/flake.lock index 5c4b68b..78b1c2a 100644 --- a/nixos/flake.lock +++ b/nixos/flake.lock @@ -34,6 +34,27 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1757130842, + "narHash": "sha256-4i7KKuXesSZGUv0cLPLfxbmF1S72Gf/3aSypgvVkwuA=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "15f067638e2887c58c4b6ba1bdb65a0b61dc58c5", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "nixos-wsl": { "inputs": { "flake-compat": "flake-compat", @@ -102,6 +123,7 @@ }, "root": { "inputs": { + "nix-darwin": "nix-darwin", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs_2", "vscode-server": "vscode-server" diff --git a/nixos/flake.nix b/nixos/flake.nix index 50b6fdd..5020174 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -57,8 +57,10 @@ darwinConfigurations."Daniel-Macbook-Air" = nix-darwin.lib.darwinSystem { modules = [ ./hosts/macos.nix - ./tmux.nix - ./neovim.nix + # TODO: nix-darwin lacks tmux options; move to Home Manager.x + # ./tmux.nix + # TODO: add neovim via homemanager, that should work the same for NixOS as Nix-Darwin + # ./neovim.nix # NOTE: Option only exists on NixOS. ./fish.nix ]; }; diff --git a/nixos/neovim.nix b/nixos/neovim.nix index 3d2b294..6fc589b 100644 --- a/nixos/neovim.nix +++ b/nixos/neovim.nix @@ -1,84 +1,80 @@ -{ lib, config, pkgs, ... }: +{ config, pkgs, ... }: { - # Only apply the Neovim NixOS module options on Linux. - config = lib.mkIf pkgs.stdenv.isLinux { - programs.neovim = { - enable = true; - defaultEditor = true; + programs.neovim = { + enable = true; + defaultEditor = true; + configure = { + customRC = '' + set title + set go=a + set mouse=a + set nohlsearch + set number + let mapleader="," - configure = { - customRC = '' - set title - set go=a - set mouse=a - set nohlsearch - set number - 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 - 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() - 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:', config_file) - end - else - print('warning: nvim color scheme not found') - print(' expected path:', config_file) - end - EOF + colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha - colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha + " 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 - " 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 - set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:» - set clipboard+=unnamedplus + " Replace-all is aliased to S. + nnoremap S :%s//g - " Replace-all is aliased to S. - nnoremap S :%s//g + " save file with ,w + map w :w - " 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 (disabled for tmux) - # coc-nvim coc-* plugins (disabled for now) - vim-nix # nix highlight - vimtex # latex stuff - fzf-vim # fuzzy finder through vim - nerdtree # file structure inside nvim - rainbow # color parenthesis - # gruvbox-nvim # theme - catppuccin-nvim # theme - goyo-vim # write prose - limelight-vim # prose paragraph highlighter - ]; - opt = []; - }; + " 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 + catppuccin-nvim # theme + goyo-vim # write prose + limelight-vim # prose paragraph highlighter + ]; + opt = []; }; }; };