mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-23 16:29:42 -04:00
added vim submodule and updated README
This commit is contained in:
parent
477034ff09
commit
c07c238ade
4 changed files with 38 additions and 166 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -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
|
||||
|
|
|
|||
92
README.md
92
README.md
|
|
@ -3,81 +3,52 @@
|
|||
My modular Nix configs 🔥
|
||||
|
||||
## 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/<machine>` 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/<machine>` 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 <submodule-path>
|
||||
git add . && git commit -m "your changes" && git push
|
||||
cd /path/to/nixos
|
||||
git add <submodule-path> && git commit -m "Update <name> 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 <submodule-path> && git commit -m "Update <name> 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.
|
||||
|
|
|
|||
1
src/user/modules/utils/modules/vim/config
Submodule
1
src/user/modules/utils/modules/vim/config
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit a2d76cce7c8913c1032cb111598a9df83bcb4354
|
||||
|
|
@ -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 = "\<Space>"
|
||||
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 <leader>pu :PlugUpdate<CR>
|
||||
nnoremap <leader>pd :PlugUpgrade<CR>
|
||||
nnoremap <leader>ps :PlugStatus<CR>
|
||||
nnoremap <leader>ps :PlugInstall<CR>
|
||||
|
||||
nmap n <Plug>(anzu-n-with-echo)
|
||||
nmap N <Plug>(anzu-N-with-echo)
|
||||
nmap * <Plug>(anzu-star-with-echo)
|
||||
nmap # <Plug>(anzu-sharp-with-echo)
|
||||
|
||||
nmap <Esc><Esc> <Plug>(anzu-clear-search-status)
|
||||
|
||||
vnoremap < <gv
|
||||
vnoremap > >gv
|
||||
nnoremap <C-U> <C-U>zz
|
||||
nnoremap <C-D> <C-D>zz
|
||||
|
||||
nnoremap <leader>gs :Git status<CR>
|
||||
nnoremap <leader>gl :Git log<CR>
|
||||
nnoremap <leader>ga :Git add<CR>
|
||||
nnoremap <leader>gc :Git commit<CR>
|
||||
nnoremap <leader>gd :Git diff<CR>
|
||||
|
||||
nnoremap <leader>e :Ex<CR>
|
||||
nnoremap <leader>/ :Rg<Space>
|
||||
|
||||
nnoremap <leader>bd :bd<CR>
|
||||
nnoremap H :bprevious<CR>
|
||||
nnoremap L :bnext<CR>
|
||||
|
||||
nnoremap <leader>wh :split<CR>
|
||||
nnoremap <leader>wv :vsplit<CR>
|
||||
nnoremap <leader>wd :q<CR>
|
||||
nnoremap <leader>ww :wincmd w<CR>
|
||||
nnoremap <leader>wW :wincmd W<CR>
|
||||
|
||||
nnoremap <Leader>ts :execute "normal! a" . strftime('[%b %d %H:%M:%S - BR]')<CR>
|
||||
nnoremap <leader><ESC> :noh<CR>
|
||||
Loading…
Add table
Add a link
Reference in a new issue