diff --git a/.gitmodules b/.gitmodules index cd3eeb8..13076d8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "nvim"] path = src/user/modules/utils/modules/neovim/config/nvim url = https://github.com/itme-brain/nvim.git +[submodule "vim"] + path = src/user/modules/utils/modules/vim/config + url = https://github.com/itme-brain/vim.git diff --git a/README.md b/README.md index 55aefe4..96a969a 100644 --- a/README.md +++ b/README.md @@ -1,83 +1,54 @@ # My Nix Configurations πŸ’» -My modular Nix configsπŸ”₯ +My modular Nix configs πŸ”₯ + +## Requirements βš™οΈ -## Requirements βš™οΈ - [Nix 2.0 & Flakes enabled](https://nixos.wiki/wiki/Flakes#Enable_flakes_permanently_in_NixOS) +- [NixOS](https://www.nixos.org/) for system configurations +- [Nix Home-Manager](https://nix-community.github.io/home-manager/index.xhtml#sec-flakes-standalone) for user configurations -### NixOS Configurations -- [NixOS](https://www.nixos.org/) -### Home-Manager Configuration -- [Nix Home-Manager](https://nix-community.github.io/home-manager/index.xhtml#sec-flakes-standalone) +## Flake Endpoints ❄️ -# Flake End-Points Exposed ❄️ -NixOS Configurations: - - desktop - - wsl - - server (wip) - - vm +NixOS Configurations: `desktop` Β· `workstation` Β· `server` (wip) Β· `vm` Β· `wsl` -Home-Manager Configurations: - - workstation +## Getting Started πŸ”§ -Fork this repo, take inspiration, borrow ideas and create your own NixOS configs & modules +```bash +git clone --recurse-submodules git@github.com:itme-brain/nixos.git +``` -## Developing & Customizing πŸ”§ -If you need a list of available packages and options: +Enter the dev shell with `nix develop`, then run `just` to see available project scripts. + +Useful resources: - [nixpkgs Packages](https://search.nixos.org/packages) πŸ“¦οΈ - [nixpkgs Options](https://search.nixos.org/options?) πŸ”οΈ - [Home-Manager Options](https://mipmip.github.io/home-manager-option-search/) β˜•οΈ -Invoke `nix develop` to enter a development shell powered by [`just`](https://github.com/casey/just) -Invoke `just` in order to view an available list of project scripts +⚠️ Be sure to tailor any hardware settings to your own β€” replace the `hardware.nix` in `src/system/machines/` with output from `nixos-generate-config` -`user.configs.nix` is a symlink to conveniently access centrally defined common user variables from the repo root +## Submodules πŸ”— -⚠️ Be sure to tailor any hardware settings to your own -⚠️ Replace the `hardware.nix` found in the `src/system/machines/` directory -⚠️ Run `nixos-generate-config` to generate a `hardware-configuration.nix` for your current system +Standalone portable configurations maintained as separate repos. Each can be cloned independently on any system β€” NixOS or not. -## Submodules +| Submodule | Purpose | Repo | Standalone Install | +|-----------|---------|------|--------------------| +| **nvim** | Full IDE (LSP, treesitter, telescope) | [itme-brain/nvim](https://github.com/itme-brain/nvim) | `git clone git@github.com:itme-brain/nvim.git ~/.config/nvim` | +| **vim** | Lightweight editor for headless servers | [itme-brain/vim](https://github.com/itme-brain/vim) | `git clone git@github.com:itme-brain/vim.git ~/.vim` | -This repo uses git submodules for portable cross-platform configurations. - -### Neovim Config -The Neovim configuration is a separate repo for portability across non-NixOS systems. - -**Location:** `src/user/modules/utils/modules/neovim/config/nvim` -**Repo:** [github.com/itme-brain/nvim](https://github.com/itme-brain/nvim) - -#### Cloning with submodules ```bash -git clone --recurse-submodules git@github.com:itme-brain/nixos.git -# Or after cloning: -git submodule update --init -``` - -#### Updating nvim config -```bash -# Edit files in the submodule, then: -cd src/user/modules/utils/modules/neovim/config/nvim +# Update a submodule +cd git add . && git commit -m "your changes" && git push +cd /path/to/nixos +git add && git commit -m "Update submodule" -# Update reference in nixos repo: -git add src/user/modules/utils/modules/neovim/config/nvim -git commit -m "Update nvim submodule" && git push -``` - -#### Pulling nvim updates from remote -```bash +# Pull submodule updates from remote git submodule update --remote -git add src/user/modules/utils/modules/neovim/config/nvim -git commit -m "Update nvim submodule" && git push +git add && git commit -m "Update submodule" ``` -#### Standalone nvim install (non-NixOS) -```bash -git clone git@github.com:itme-brain/nvim.git ~/.config/nvim -``` - -## Directory Structure +## Directory Structure πŸ—‚οΈ ``` . @@ -115,7 +86,8 @@ git clone git@github.com:itme-brain/nvim.git ~/.config/nvim β”‚ β”œβ”€β”€ keys/ # Public keys β”‚ β”‚ β”œβ”€β”€ pgp/ # PGP public keys β”‚ β”‚ └── ssh/ # SSH public keys - β”‚ └── nvim # Symlink to neovim submodule config + β”‚ β”œβ”€β”€ nvim # Symlink to neovim submodule config + β”‚ └── vim # Symlink to vim submodule config └── modules/ # Home-manager modules β”œβ”€β”€ bash/ # Shell config (aliases, prompt, bashrc) β”œβ”€β”€ git/ # Git config + helper scripts @@ -127,7 +99,7 @@ git clone git@github.com:itme-brain/nvim.git ~/.config/nvim β”‚ β”œβ”€β”€ email/ # Email client (aerc) β”‚ β”œβ”€β”€ irc/ # IRC client β”‚ β”œβ”€β”€ neovim/ # Neovim (config is a git submodule) - β”‚ └── vim/ # Vim fallback + β”‚ └── vim/ # Vim lightweight (config is a git submodule) └── gui/ # GUI applications β”œβ”€β”€ modules/ β”‚ β”œβ”€β”€ alacritty/ # Terminal emulator @@ -145,10 +117,10 @@ git clone git@github.com:itme-brain/nvim.git ~/.config/nvim ### How it works -The **flake.nix** is the entrypoint. It defines NixOS configurations (desktop, workstation, server, wsl) that each reference a machine under `src/system/machines/`. Each machine's `default.nix` pulls in its own `hardware.nix`, `system.nix`, and per-machine modules (disko, home-manager). +**flake.nix** defines NixOS configurations (desktop, workstation, server, wsl) that each reference a machine under `src/system/machines/`. Each machine's `default.nix` pulls in its own `hardware.nix`, `system.nix`, and per-machine modules (disko, home-manager). -The **system layer** (`src/system/`) handles NixOS-level concerns: hardware, bootloader, networking, and system services. Shared system-level modules in `src/system/modules/` can be imported by any machine. +The **system layer** (`src/system/`) handles NixOS-level concerns: hardware, bootloader, networking, and system services. Shared modules in `src/system/modules/` can be imported by any machine. The **user layer** (`src/user/`) handles home-manager configuration. `src/user/config/` defines user identity (name, email, keys), while `src/user/modules/` contains modular home-manager configs for individual tools. Each machine's `home-manager/home.nix` selects which user modules to enable. -Root symlinks `system.configs` and `user.configs` provide convenient access to machine definitions and user config from the repo root. +Root symlinks `system.configs` and `user.configs` provide quick access to machine definitions and user config from the repo root. diff --git a/src/user/modules/utils/modules/vim/config b/src/user/modules/utils/modules/vim/config new file mode 160000 index 0000000..a2d76cc --- /dev/null +++ b/src/user/modules/utils/modules/vim/config @@ -0,0 +1 @@ +Subproject commit a2d76cce7c8913c1032cb111598a9df83bcb4354 diff --git a/src/user/modules/utils/modules/vim/config/vimrc b/src/user/modules/utils/modules/vim/config/vimrc deleted file mode 100644 index 3d69854..0000000 --- a/src/user/modules/utils/modules/vim/config/vimrc +++ /dev/null @@ -1,104 +0,0 @@ -let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' -if empty(glob(data_dir . '/autoload/plug.vim')) - silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC -endif - -if empty(glob('~/.vim/plugged')) - silent! :PlugInstall | q -endif - -autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) - \| PlugInstall --sync | source $MYVIMRC - \| endif - -call plug#begin('~/.vim/plugged') - Plug 'chriskemson/base16-vim' - Plug 'tpope/vim-surround' - Plug 'jiangmiao/auto-pairs' - Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } - Plug 'junegunn/fzf.vim' - Plug 'mtdl9/vim-log-highlighting' - Plug 'machakann/vim-highlightedyank' - Plug 'itchyny/lightline.vim' - Plug 'tpope/vim-fugitive' - Plug 'mhinz/vim-signify' - Plug 'osyo-manga/vim-anzu' -call plug#end() - -let mapleader = "\" -set background=dark -colorscheme base16-onedark - -highlight Normal ctermbg=NONE guibg=NONE -highlight NonText ctermbg=NONE guibg=NONE -highlight CursorLine ctermbg=NONE guibg=NONE -highlight CursorLineNr ctermfg=Yellow guifg=#FFCC66 ctermbg=NONE guibg=NONE cterm=bold -highlight HighlightedyankRegion ctermfg=Black guifg=#FFFFFF ctermbg=Yellow guibg=#FFA500 -highlight NormalNC ctermbg=NONE guibg=NONE -highlight Search ctermfg=Black guifg=#000000 ctermbg=Yellow guibg=#FFCC66 -highlight LineNr ctermbg=NONE guibg=NONE -highlight Visual ctermbg=LightGray guibg=#E8E8E8 ctermfg=Black guifg=#000000 - -let g:highlightedyank_highlight_duration = 140 -let g:lightline = { 'colorscheme': 'deus', } - -let $FZF_DEFAULT_OPTS = '--bind=tab:up,shift-tab:down' -let g:fzf_layout = { 'window': 'enew' } - -set laststatus=2 - -set number -set relativenumber -set cursorline - -set noincsearch -set ignorecase - -set clipboard=unnamedplus -set noswapfile - -set tabstop=2 -set shiftwidth=2 -set expandtab - -set statusline=%{anzu#search_status()} - -nnoremap pu :PlugUpdate -nnoremap pd :PlugUpgrade -nnoremap ps :PlugStatus -nnoremap ps :PlugInstall - -nmap n (anzu-n-with-echo) -nmap N (anzu-N-with-echo) -nmap * (anzu-star-with-echo) -nmap # (anzu-sharp-with-echo) - -nmap (anzu-clear-search-status) - -vnoremap < >gv -nnoremap zz -nnoremap zz - -nnoremap gs :Git status -nnoremap gl :Git log -nnoremap ga :Git add -nnoremap gc :Git commit -nnoremap gd :Git diff - -nnoremap e :Ex -nnoremap / :Rg - -nnoremap bd :bd -nnoremap H :bprevious -nnoremap L :bnext - -nnoremap wh :split -nnoremap wv :vsplit -nnoremap wd :q -nnoremap ww :wincmd w -nnoremap wW :wincmd W - -nnoremap ts :execute "normal! a" . strftime('[%b %d %H:%M:%S - BR]') -nnoremap :noh