Develop edison, standardize home-manager

This commit is contained in:
2023-09-15 00:21:07 +02:00
committed by Felix Albrigtsen
parent a0693ca9fc
commit acc446dfa3
11 changed files with 92 additions and 191 deletions

36
home/base.nix Normal file
View File

@@ -0,0 +1,36 @@
{ pkgs, ... }:
{
imports = [
./neovim.nix
./zsh.nix
];
programs.nix-index = {
enable = true;
enableZshIntegration = true;
};
programs.git = {
enable = true;
extraConfig = {
pull.rebase = true;
push.autoSetupRemote = true;
color.ui = "auto";
init.defaultBranch = "main";
lfs.enable = true;
user = {
name = "Felix Albrigtsen";
email = "felix@albrigtsen.it";
};
};
ignores = [
"*~"
"*.swp"
".DS_Store"
".vscode"
];
};
}

View File

@@ -1,46 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./nvim.nix
];
home.username = "felixalb";
home.homeDirectory = "/home/felixalb";
home.stateVersion = "22.11";
programs = {
home-manager.enable = true;
alacritty = {
enable = true;
};
firefox.enable = true;
rofi.enable = true;
zsh = {
enable = true;
enableAutosuggestions = true;
enableSyntaxHighlighting = true;
prezto = {
enable = true;
prompt.theme = "paradox";
};
# initExtra = ''
# bindkey "''${key[Up]}" up-line-or-search
# bindkey "''${key[Down]}" down-line-or-search
# '';
};
git = {
enable = true;
userName = "Felix Albrigtsen";
userEmail = "felixalbrigtsen@gmail.com";
};
};
services = {
redshift = {
enable = true;
tray = true;
duskTime = "19:30-20:30";
dawnTime = "7:30-8:30";
};
};
}

View File

@@ -1,69 +0,0 @@
{ pkgs, config, ... }
{
programs.neovim = {
enable = true;
vimAlias = true;
extraConfig = ''
set number " Show line numbers
set number relativenumber " Enable hybrid line numbers
set nu rnu
set signcolumn=number
set showmatch " Highlight matching brace
set errorbells " Beep or flash screen on errors
set hlsearch " Highlight all search results
set smartcase " Enable smart-case search
set incsearch " Searches for strings incrementally
set autoindent " Auto-indent new lines
set expandtab " Use spaces instead of tabs
set shiftwidth=2 " Number of auto-indent spaces
set smartindent " Enable smart-indent
set smarttab " Enable smart-tabs
set softtabstop=0 " Number of spaces per Tab, auto
set updatetime=300 " Time interval for updating buffers
set ruler " Show row and column ruler information
set undolevels=1000 " Number of undo levels
set backspace=indent,eol,start " Backspace behaviour
'';
plugins = with pkgs.vimPlugins; [
vim-nix
vim-commentary
vim-devicons
{ plugin = nerdtree;
config = "
nmap <silent> <C-t> :NERDTreeToggle<CR>
autocmd VimEnter * NERDTree \" Autostart nerdtree on vim startup
autocmd VimEnter * wincmd p \" Unselect nerdtree window
\" Close vim if Nerdtree is the only buffer left
autocmd bufenter * if (winnr(\"$\") == 1 && exists(\"b:NERDTree\") && b:NERDTree.isTabTree()) | q | endif
";
}
];
withNodeJs = true;
coc = {
enable = true;
settings = {
"suggest.enablePreview" = true;
"suggest.enablePreselect" = true;
};
package = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "coc.nvim";
version = "2022-05-21";
src = pkgs.fetchFromGitHub {
owner = "neoclide";
repo = "coc.nvim";
rev = "791c9f673b882768486450e73d8bda10e391401d";
sha256 = "sha256-MobgwhFQ1Ld7pFknsurSFAsN5v+vGbEFojTAYD/kI9c=";
};
meta.homepage = "https://github.com/neoclide/coc.nvim/";
};
};
};
}

107
home/neovim.nix Normal file
View File

@@ -0,0 +1,107 @@
{ pkgs, lib, inputs, config, ...}:
{
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
lightline-vim
vim-lightline-coc
vim-commentary
vim-fugitive
nerdtree
nerdtree-git-plugin
vim-devicons
nvim-lspconfig
copilot-vim
nvim-treesitter
coc-css
coc-go
coc-html
coc-json
coc-nvim
coc-pyright
vim-nix
];
extraConfig = ''
let mapleader = ','
set number
set shiftwidth=2
set tabstop=2
set expandtab
" Integrate status with lightline
let g:lightline = {
\ 'active': {
\ 'left': [[ 'coc_info', 'coc_hints', 'coc_errors', 'coc_warnings', 'coc_ok' ], [ 'coc_status' ]]
\ }
\ }
" register components:
call lightline#coc#register()
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Enable syntax folding with coc
command! -nargs=* Fold :call CocAction('fold', <f-args>)
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Step through diagnostics
nmap <silent> <g <Plug>(coc-diagnostic-prev)
nmap <silent> >g <Plug>(coc-diagnostic-next)
" Nerdtree-settings
" Toggle nerdtree on Ctrl+t
nmap <silent> <C-t> :NERDTreeToggle<CR>
autocmd VimEnter * NERDTree " Autostart nerdtree on vim startup
autocmd VimEnter * wincmd p " Unselect nerdtree window
" Close vim is Nerdtree is the only buffer left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" List and switch buffers on Ctrl+k
nnoremap <C-k> :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space>
" Show trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
" Disable search highlights
map <Leader><Space> :noh<CR>
'';
};
}

57
home/zsh.nix Normal file
View File

@@ -0,0 +1,57 @@
{ pkgs, lib, inputs, config, ... }: {
programs = {
zsh = {
enable = true;
prezto = {
enable = true;
editor = {
keymap = "vi";
dotExpansion = true;
};
prompt = {
theme = "paradox";
pwdLength = "long";
showReturnVal = true;
};
terminal.autoTitle = true;
pmodules = [
"environment"
"terminal"
"editor"
"history"
"directory"
"spectrum"
"utility"
"ssh"
"completion"
"git"
"autosuggestions"
"syntax-highlighting"
"history-substring-search"
"prompt"
];
};
initExtra = ''
# Autocomplete ../
zstyle ':completion:*' special-dirs true
export PATH="$HOME/.config/emacs/bin:$PATH"
'';
shellAliases = {
l = "exa -l";
tree = "exa --tree --icons";
s = "nix-shell --run zsh";
sp = "nix-shell --run zsh -p";
em = "emacsclient -c";
emnw = "emacsclient -nw";
gst = "git status -sb";
gcm = "git commit -m";
gps = "git push";
gpl = "git pull";
};
};
};
}