From 38bab29776950ac2364ed64195b89887717c33de Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Thu, 1 Jan 1970 03:00:00 +0300 Subject: chore: init --- nix/.local/etc/nixpkgs/home.nix | 577 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 577 insertions(+) create mode 100644 nix/.local/etc/nixpkgs/home.nix (limited to 'nix/.local/etc') diff --git a/nix/.local/etc/nixpkgs/home.nix b/nix/.local/etc/nixpkgs/home.nix new file mode 100644 index 0000000..8d367f5 --- /dev/null +++ b/nix/.local/etc/nixpkgs/home.nix @@ -0,0 +1,577 @@ +{ config, pkgs, ... }: +let + font1 = "UW Ttyp0"; + font2 = "Efont Biwidth"; + xftBase = ":pixelsize=14:style=Regular:antialias=false"; + xftFont1 = "${font1}${xftBase}"; + xftFont2 = "${font2}${xftBase}"; + + colorBlack0 = "#161719"; + colorBlack1 = "#969896"; + colorRed0 = "#cc6666"; + colorRed1 = "#cc6666"; + colorGreen0 = "#b5bd68"; + colorGreen1 = "#b5bd68"; + colorYellow0 = "#f0c674"; + colorYellow1 = "#f0c674"; + colorBlue0 = "#81a2be"; + colorBlue1 = "#81a2be"; + colorMagenta0 = "#b294bb"; + colorMagenta1 = "#b294bb"; + colorCyan0 = "#8abeb7"; + colorCyan1 = "#8abeb7"; + colorWhite0 = "#c5c8c6"; + colorWhite1 = "#ffffff"; +in { + home = { + username = builtins.getEnv "USER"; + homeDirectory = builtins.getEnv "HOME"; + + packages = with pkgs; [ + bat + bear + ccls + clang-tools + cling + cmake-language-server + doxygen + fd + include-what-you-use + llvmPackages_12.clangUseLLVM + nixfmt + pandoc + pgcli + pipenv + plan9port + python-language-server + python39Packages.adblock + python39Packages.black + python39Packages.isort + python39Packages.pyflakes + rappel + ripgrep + ripgrep-all + shellcheck + shfmt + speedtest-cli + stdman + translate-shell + ]; + + stateVersion = "21.11"; + }; + + xdg = let localDirectory = "${config.home.homeDirectory}/.local"; + in { + configHome = "${localDirectory}/etc"; + dataHome = "${localDirectory}/var/lib"; + cacheHome = "${localDirectory}/var/cache"; + + userDirs = let + atHome = dir: config.home.homeDirectory + "/" + dir; + tmp = atHome "tmp"; + in { + enable = true; + createDirectories = true; + + desktop = tmp; + documents = tmp; + download = tmp; + music = atHome "music"; + pictures = tmp; + publicShare = tmp; + templates = tmp; + videos = tmp; + }; + }; + + programs = { + home-manager.enable = true; + + bat = { + enable = true; + + config = { + style = "plain"; + tabs = "4"; + theme = "base16"; + wrap = "never"; + }; + }; + + beets = { + enable = true; + + settings = with config.xdg; { + library = "${dataHome}/beets/library.db"; + directory = userDirs.music; + plugins = "badfiles edit fetchart info mbsync scrub"; + original_date = true; + import = { + write = true; + copy = true; + move = false; + bell = true; + from_scratch = true; + }; + match = { + preferred = { + countries = + [ "JP" "KR" "TW" "HK" "CN" "RU" "GB|UK" "AU" "NZ" "US" ]; + original_year = true; + }; + }; + edit = { + albumfields = "album artist albumartist"; + itemfields = + "track title album artist albumartist day month year genre"; + }; + fetchart = { + auto = true; + cautious = true; + cover_names = + "cover Cover folder Folder art Art album Album front Front"; + sources = "filesystem coverart itunes amazon albumart wikipedia"; + }; + scrub.auto = true; + }; + }; + + direnv = { + enable = true; + nix-direnv = { + enable = true; + enableFlakes = true; + }; + }; + + neovim = { + enable = true; + + extraConfig = '' + set autoread + set backspace=indent,eol,start + set clipboard=unnamed,unnamedplus + set fillchars=vert:\ " + set hidden + set lazyredraw + set modeline + set mouse= + set noshowmode + set path+=** + + set statusline= + set statusline+=\ %m%r + set statusline+=%f\ " + set statusline+=%1* + set statusline+=%* + set statusline+=%= + set statusline+=%1* + set statusline+=\ %l:%c/%L\ %p%%\ " + set statusline+=%* + + set noerrorbells + set novisualbell + + set splitbelow + set splitright + + set complete= + set complete+=. + set complete+=b + set complete+=t + set completeopt= + set completeopt+=menu + set completeopt+=longest + + set gdefault + set hlsearch + set incsearch + set iskeyword+=- + set magic + + set foldmethod=marker + set nofoldenable + + set shortmess= + set shortmess+=I + set shortmess+=T + set shortmess+=a + set shortmess+=c + set shortmess+=t + + set nolist + set nowrap + set scrolloff=10 + set sidescrolloff=10 + + set number + set relativenumber + + set wildignorecase + set wildmenu + set wildignore= + + set nobackup + set noswapfile + set noundofile + set nowritebackup + + set smartcase + set ignorecase + + set autoindent + set breakindent + set smartindent + + set expandtab + set shiftround + set shiftwidth=4 + set smarttab + set softtabstop=4 + set tabstop=4 + + try + set encoding=utf-8 + scriptencoding utf-8 + catch + endtry + + if has('autocmd') + filetype on + filetype plugin on + filetype indent on + endif + + if has('syntax') + syntax enable + endif + + let mapleader = ' ' + + nnoremap j v:count ? 'j' : 'gj' + nnoremap k v:count ? 'k' : 'gk' + + nnoremap J gt + nnoremap K gT + + nnoremap ^h + vnoremap ^h + nnoremap H ^h + vnoremap H ^h + + nnoremap $ + vnoremap $ + nnoremap L $ + vnoremap L $ + + nnoremap N Nzzzv + nnoremap n nzzzv + + vnoremap < >gv + + nnoremap ]b :bnext + nnoremap [b :bprevious + + nnoremap h + nnoremap j + nnoremap k + nnoremap l + + nnoremap :nohlsearchredraw!echo + + cnoremap ;/ =expand('%:p:h').'/' + cnoremap ;; =expand('%:t') + cnoremap ;. =expand('%:p:r') + + nnoremap . :lcd %:p:h + + cnoremap + cnoremap + + nnoremap gw vapgw + + nnoremap Q @q + + nnoremap c ^v$h + nnoremap v ggVG + + map sn ]s + map sp [s + map sa zg + map s? z= + + nnoremap y "+y + nnoremap Y "+Y + + nnoremap p "+p + nnoremap P "+P + + inoremap "+pi + cnoremap + + + nmap w :w! + nmap wq :wq! + + nnoremap ZX :qa! + + nnoremap q :q + + function! SwitchCase() + normal! ~ + if strlen(getline('.')) != virtcol('.') + normal! h + endif + endfunction + nnoremap ~ :call SwitchCase() + + function! MapGoToTab() + let s:i = 1 + while s:i < 10 + exe 'nnoremap ' . s:i . ' :tabnext ' . s:i . '' + let s:i += 1 + endwhile + endfunction + call MapGoToTab() + + autocmd BufEnter * set noreadonly + ''; + + plugins = with pkgs.vimPlugins; [ + ansible-vim + auto-pairs + calendar-vim + csv-vim + editorconfig-vim + gentoo-syntax + neco-vim + neoinclude-vim + nginx-vim + rainbow_parentheses-vim + vim-SyntaxRange + vim-abolish + vim-commentary + vim-cool + vim-eunuch + vim-expand-region + vim-fugitive + vim-gnupg + vim-husk + vim-illuminate + vim-lastplace + vim-nix + vim-obsession + vim-polyglot + vim-repeat + vim-rhubarb + vim-shellcheck + vim-sleuth + vim-sneak + vim-speeddating + vim-surround + vim-tmux + vim-tmux-focus-events + vim-unimpaired + { + plugin = vim-clang-format; + config = '' + nnoremap cf :ClangFormat + vnoremap cf :ClangFormat + ''; + } + { + plugin = LanguageClient-neovim; + config = '' + let g:LanguageClient_loadSettings = 1 + + nnoremap lm :call LanguageClient_contextMenu() + nnoremap la :call LanguageClient_workspace_applyEdit() + nnoremap lc :call LanguageClient#textDocument_completion() + nnoremap ld :call LanguageClient#textDocument_definition() + nnoremap le :call LanguageClient#textDocument_references() + nnoremap lf :call LanguageClient#textDocument_formatting() + nnoremap lh :call LanguageClient#textDocument_hover() + nnoremap lr :call LanguageClient#textDocument_rename() + nnoremap ls :call LanguageClient#textDocument_documentSymbol() + nnoremap lt :call LanguageClient#textDocument_typeDefinition() + + let g:LanguageClient_serverCommands = {} + + if executable('ccls') + let g:LanguageClient_serverCommands[ 'c' ] = [ 'ccls' ] + let g:LanguageClient_serverCommands[ 'cpp' ] = [ 'ccls' ] + + nnoremap h :call LanguageClient#findLocations({'method':'$ccls/navigate','direction':'L'}) + nnoremap j :call LanguageClient#findLocations({'method':'$ccls/navigate','direction':'D'}) + nnoremap k :call LanguageClient#findLocations({'method':'$ccls/navigate','direction':'U'}) + nnoremap l :call LanguageClient#findLocations({'method':'$ccls/navigate','direction':'R'}) + elseif executable('clangd') + let g:LanguageClient_serverCommands[ 'c' ] = [ 'clangd', '-background-index' ] + let g:LanguageClient_serverCommands[ 'cpp' ] = [ 'clangd', '-background-index' ] + endif + + if executable('gopls') + let g:LanguageClient_serverCommands[ 'go' ] = [ 'gopls' ] + endif + + if executable('haskell-language-server-wrapper') + let g:LanguageClient_serverCommands[ 'haskell' ] = [ 'haskell-language-server-wrapper', '--lsp' ] + endif + + if executable('pyls') + let g:LanguageClient_serverCommands[ 'python' ] = [ 'pyls' ] + endif + ''; + } + ]; + + withNodeJs = false; + withPython3 = true; + withRuby = false; + }; + + zathura = { + enable = true; + + options = { + font = font1; + + default-fg = colorWhite0; + default-bg = colorBlack0; + + statusbar-fg = colorBlack0; + statusbar-bg = colorWhite0; + + inputbar-fg = colorBlack0; + inputbar-bg = colorGreen1; + + notification-fg = colorBlack0; + notification-bg = colorBlue1; + + notification-error-fg = colorBlack0; + notification-error-bg = colorRed1; + + notification-warning-fg = colorBlack0; + notification-warning-bg = colorYellow1; + + highlight-color = colorYellow1; + highlight-active-color = colorYellow0; + + completion-fg = colorWhite1; + completion-bg = colorBlack1; + + completion-highlight-fg = colorBlack0; + completion-highlight-bg = colorRed1; + + completion-group-fg = colorBlack0; + completion-group-bg = colorRed1; + + recolor-darkcolor = colorBlack0; + recolor-lightcolor = colorWhite0; + + recolor = true; + recolor-keephue = false; + recolor-reverse-video = false; + + highlight-transparency = "0.3"; + + n-completion-items = 10; + + guioptions = ""; + + statusbar-basename = true; + statusbar-home-tilde = true; + + statusbar-h-padding = 0; + statusbar-v-padding = 0; + + window-height = 800; + window-width = 600; + + window-icon = ""; + + abort-clear-search = true; + + incremental-search = true; + + adjust-open = "best-fit"; + + advance-pages-per-row = false; + + database = "sqlite"; + + dbus-service = false; + + page-padding = 0; + + pages-per-row = 1; + + render-loading = false; + + show-directories = true; + show-hidden = true; + show-recent = 10; + + link-zoom = true; + link-hadjust = true; + + window-title-basename = true; + window-title-home-tilde = true; + window-title-page = true; + + zoom-center = false; + zoom-max = 1000; + zoom-min = 10; + zoom-step = 10; + + scroll-hstep = -1; + scroll-step = 40; + scroll-full-overlap = 0; + scroll-wrap = true; + scroll-page-aware = false; + + selection-clipboard = "primary"; + selection-notification = false; + }; + }; + }; + + xresources = { + properties = { + "*.font" = xftFont1; + + "Xcursor.theme" = "core"; + "Xcursor.theme_core" = "true"; + "Xcursor.size" = 16; + + "Xft.antialias" = 1; + "Xft.autohint" = 0; + "Xft.dpi" = 96; + "Xft.hinting" = 1; + "Xft.hintstyle" = "hintslight"; + "Xft.lcdfilter" = "lcddefault"; + "Xft.rgba" = "rgb"; + + "*.color0" = colorBlack0; + "*.color8" = colorBlack1; + "*.color1" = colorRed0; + "*.color9" = colorRed1; + "*.color2" = colorGreen0; + "*.color10" = colorGreen1; + "*.color3" = colorYellow0; + "*.color11" = colorYellow1; + "*.color4" = colorBlue0; + "*.color12" = colorBlue1; + "*.color5" = colorMagenta0; + "*.color13" = colorMagenta1; + "*.color6" = colorCyan0; + "*.color14" = colorCyan1; + "*.color7" = colorWhite0; + "*.color15" = colorWhite1; + + "*.background" = colorBlack0; + "*.foreground" = colorWhite0; + }; + }; +} -- cgit 1.4.1