diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-06-24 11:10:21 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-06-24 11:10:21 +0300 |
commit | 75918debfd7245d90478f882b0323a705ab3c7be (patch) | |
tree | 26b8f0ab5a3e4d7c61963fa96d57250e5ddc9a7d /modules | |
parent | 2024-06-19 (diff) |
2024-06-24
Diffstat (limited to 'modules')
-rw-r--r-- | modules/common/nix.nix | 13 | ||||
-rw-r--r-- | modules/games/default.nix | 26 | ||||
-rw-r--r-- | modules/profiles/default.nix | 3 | ||||
-rw-r--r-- | modules/profiles/headful.nix | 7 | ||||
-rw-r--r-- | modules/subversion.nix | 2 | ||||
-rw-r--r-- | modules/vim.nix | 208 | ||||
-rw-r--r-- | modules/vim/default.nix | 71 | ||||
-rw-r--r-- | modules/vim/rc.vim | 169 | ||||
-rw-r--r-- | modules/wayland.nix | 6 |
9 files changed, 237 insertions, 268 deletions
diff --git a/modules/common/nix.nix b/modules/common/nix.nix index 6c5bd18..3342113 100644 --- a/modules/common/nix.nix +++ b/modules/common/nix.nix @@ -126,11 +126,16 @@ in overlays = with inputs; [ self.overlays.default - (_: _: { + (_: prev: { # Global PR package overrides go here. Example: # ``` # inherit (pkgsPr 309018 "sha256-x3ATxjrTVdaX5eo9P6pz+8/W6D2TNYzvjZpOBa3ZRI8=") endlessh-go; # ``` + + spf-engine = prev.spf-engine.override { + # FIXME https://nixpk.gs/pr-tracker.html?pr=321940 + inherit (pkgsMaster.python311.pkgs) pymilter; + }; }) ]; }; @@ -141,7 +146,6 @@ in systemPackages = with pkgs; optionals this.isHeadful [ - nix-top nix-tree nixfiles ]; @@ -151,9 +155,6 @@ in }; }; - system = { - # HACK This lets `nix flake check` to pass. - stateVersion = if hasAttr "stateVersion" this then this.stateVersion else trivial.release; - }; + system.stateVersion = this.stateVersion or trivial.release; }; } diff --git a/modules/games/default.nix b/modules/games/default.nix index dea9d3c..4f474b4 100644 --- a/modules/games/default.nix +++ b/modules/games/default.nix @@ -8,20 +8,18 @@ in options.nixfiles.modules.games.enable32BitSupport = mkEnableOption "support for games"; - config = mkIf cfg.enable32BitSupport { - services = { - jack.alsa.support32Bit = config.services.jack.alsa.enable; - - pipewire.alsa.support32Bit = config.services.pipewire.alsa.enable; - }; - - hardware = { - opengl = mkIf config.hardware.opengl.enable { - extraPackages32 = config.hardware.opengl.extraPackages; - driSupport32Bit = config.hardware.opengl.driSupport; + config = mkMerge [ + { hardware.graphics.enable = true; } + (mkIf cfg.enable32BitSupport { + services = { + jack.alsa.support32Bit = config.services.jack.alsa.enable; + pipewire.alsa.support32Bit = config.services.pipewire.alsa.enable; }; - pulseaudio.support32Bit = config.hardware.pulseaudio.enable; - }; - }; + hardware = { + graphics.enable32Bit = true; + pulseaudio.support32Bit = config.hardware.pulseaudio.enable; + }; + }) + ]; } diff --git a/modules/profiles/default.nix b/modules/profiles/default.nix index 9e99938..61f93b9 100644 --- a/modules/profiles/default.nix +++ b/modules/profiles/default.nix @@ -36,6 +36,7 @@ in eza.enable = true; htop.enable = true; tmux.enable = true; + vim.enable = true; }; programs = { @@ -47,8 +48,6 @@ in nano.enable = false; }; - time.timeZone = "Europe/Moscow"; - environment.systemPackages = with pkgs; [ cryptsetup file diff --git a/modules/profiles/headful.nix b/modules/profiles/headful.nix index 331464b..8951d83 100644 --- a/modules/profiles/headful.nix +++ b/modules/profiles/headful.nix @@ -96,10 +96,7 @@ in consoleLogLevel = 3; }; - hardware.opengl = { - enable = true; - driSupport = true; - }; + hardware.graphics.enable = true; programs = { dconf.enable = true; @@ -114,6 +111,8 @@ in upower.enable = true; }; + time.timeZone = "Europe/Moscow"; + environment.systemPackages = with pkgs; [ arping dnsutils diff --git a/modules/subversion.nix b/modules/subversion.nix index 9398592..64ddcf3 100644 --- a/modules/subversion.nix +++ b/modules/subversion.nix @@ -24,7 +24,7 @@ in store-auth-creds = "yes"; }; helpers = { - editor-cmd = getExe config.programs.vim.package; + editor-cmd = getExe' config.programs.vim.package "vim"; diff-cmd = getExe pkgs.colordiff; }; miscellany = { diff --git a/modules/vim.nix b/modules/vim.nix new file mode 100644 index 0000000..7209e8b --- /dev/null +++ b/modules/vim.nix @@ -0,0 +1,208 @@ +{ + config, + lib, + pkgs, + this, + ... +}: +with lib; +let + cfg = config.nixfiles.modules.vim; +in +{ + options.nixfiles.modules.vim.enable = mkEnableOption "Vim"; + + config = mkIf cfg.enable { + hm.stylix.targets.vim.enable = false; + + programs.vim = { + package = mkIf this.isHeadful ( + pkgs.vim-full.customize { + name = "vim"; + vimrcConfig = with cfg; { + customRC = '' + let $VIMFILES = expand('<sfile>:p:h') + + let g:skip_defaults_vim = 1 + + let g:netrw_dirhistmax = 0 + + if has('unnamedplus') + set clipboard^=unnamedplus + else + set clipboard^=unnamed + endif + + set diffopt+=iwhite + set hidden + set lazyredraw + set mouse= + set path+=** + + set cmdheight=1 + set fillchars=vert:\ " + set modeline + set noshowmode + set shortmess+=I + set textwidth=0 + set title + + 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 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 + if v:version >= 700 + set numberwidth=3 + endif + + set wildignorecase + 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 + + set colorcolumn= + let g:EditorConfig_max_line_indicator = "none" + + nnoremap <Space> <Nop> + let mapleader=" " + + nnoremap :W :w + nnoremap :W! :w! + nnoremap :Q :q + nnoremap :Q! :q! + + nnoremap <expr> j v:count ? 'j' : 'gj' + nnoremap <expr> k v:count ? 'k' : 'gk' + + nnoremap J gt + nnoremap K gT + + nnoremap <C-A> ^h + vnoremap <C-A> ^h + nnoremap H ^h + vnoremap H ^h + + nnoremap <C-E> $ + vnoremap <C-E> $ + nnoremap L $ + vnoremap L $ + + nnoremap N Nzzzv + nnoremap n nzzzv + + inoremap <C-U> <C-g>u<C-u> + inoremap <C-W> <C-g>u<C-w> + + vnoremap < <gv + vnoremap > >gv + vnoremap <Tab> >gv + vnoremap <S-Tab> <gv + nnoremap <Tab> >>_ + nnoremap <S-Tab> <<_ + + nnoremap ]b :bnext<CR> + nnoremap [b :bprevious<CR> + + nnoremap <C-H> <C-w>h + nnoremap <C-J> <C-w>j + nnoremap <C-K> <C-w>k + nnoremap <C-R> <C-w>l + + nnoremap * /\<<C-r>=expand('<cword>')<CR>\><CR> + nnoremap # ?\<<C-r>=expand('<cword>')<CR>\><CR> + + cnoremap ;/ <C-r>=expand('%:p:h').'/'<CR> + cnoremap ;; <C-r>=expand('%:t')<CR> + cnoremap ;. <C-r>=expand('%:p:r')<CR> + + nnoremap <Leader>. :lcd %:p:h<CR> + + nnoremap Q @q + + nnoremap <Leader>c ^v$h + nnoremap <Leader>v ggVG + + nnoremap <Leader>y "+y + nnoremap <Leader>Y "+Y + + nnoremap <Leader>p "+p + nnoremap <Leader>P "+P + + inoremap <C-v> <C-c>"+pi + cnoremap <C-v> <C-r>+ + + nmap <Leader>w :w!<CR> + nmap <Leader>wq :wq!<CR> + + nnoremap ZX :qa!<CR> + + nnoremap <Leader>q :q<CR> + + command WS w !sudo tee "%" >/dev/null + ''; + packages.myVimPackage.start = with pkgs.vimPlugins; [ + editorconfig-vim + vim-eunuch + vim-nix + vim-sensible + vim-sleuth + vim-surround + vim-unimpaired + ]; + }; + } + ); + + defaultEditor = true; + }; + }; +} diff --git a/modules/vim/default.nix b/modules/vim/default.nix deleted file mode 100644 index 94cc7af..0000000 --- a/modules/vim/default.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.vim; -in -{ - options.nixfiles.modules.vim = { - enable = mkEnableOption "Vim"; - - rc = mkOption { - type = types.str; - default = readFile ./rc.vim; - description = "Configuration file."; - }; - - plugins = mkOption { - type = with types; listOf package; - default = with pkgs.vimPlugins; [ - editorconfig-vim - vim-eunuch - vim-nix - vim-sensible - vim-sleuth - vim-surround - vim-unimpaired - ]; - description = "Plugins."; - }; - }; - - config = mkIf cfg.enable { - hm.stylix.targets.vim.enable = false; - - programs.vim.package = - (pkgs.vim-full.override { - cscopeSupport = false; - darwinSupport = false; - features = "normal"; - guiSupport = "gtk3"; - luaSupport = false; - multibyteSupport = false; - netbeansSupport = false; - nlsSupport = false; - perlSupport = false; - pythonSupport = false; - rubySupport = false; - tclSupport = false; - ximSupport = false; - }).customize - { - name = "vim"; - vimrcConfig = with cfg; { - customRC = rc; - packages.myVimPackage.start = plugins; - }; - }; - - environment = { - systemPackages = [ config.programs.vim.package ]; - variables = rec { - EDITOR = "vim"; - VISUAL = EDITOR; - }; - }; - }; -} diff --git a/modules/vim/rc.vim b/modules/vim/rc.vim deleted file mode 100644 index 3bd9eb7..0000000 --- a/modules/vim/rc.vim +++ /dev/null @@ -1,169 +0,0 @@ -let $VIMFILES = expand('<sfile>:p:h') - -let g:skip_defaults_vim = 1 - -let g:netrw_dirhistmax = 0 - -if has('unnamedplus') - set clipboard^=unnamedplus -else - set clipboard^=unnamed -endif - -set backspace=indent,eol,start -set diffopt+=iwhite -set hidden -set lazyredraw -set mouse= -set path+=** -set viminfo= - -set cmdheight=1 -set fillchars=vert:\ " -set modeline -set noshowmode -set shortmess+=I -set textwidth=0 -set title - -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 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 -if v:version >= 700 - set numberwidth=3 -endif - -set wildignorecase -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 - -set colorcolumn= -let g:EditorConfig_max_line_indicator = "none" - -nnoremap <Space> <Nop> -let mapleader=" " - -nnoremap :W :w -nnoremap :W! :w! -nnoremap :Q :q -nnoremap :Q! :q! - -nnoremap <expr> j v:count ? 'j' : 'gj' -nnoremap <expr> k v:count ? 'k' : 'gk' - -nnoremap J gt -nnoremap K gT - -nnoremap <C-A> ^h -vnoremap <C-A> ^h -nnoremap H ^h -vnoremap H ^h - -nnoremap <C-E> $ -vnoremap <C-E> $ -nnoremap L $ -vnoremap L $ - -nnoremap N Nzzzv -nnoremap n nzzzv - -inoremap <C-U> <C-g>u<C-u> -inoremap <C-W> <C-g>u<C-w> - -vnoremap < <gv -vnoremap > >gv -vnoremap <Tab> >gv -vnoremap <S-Tab> <gv -nnoremap <Tab> >>_ -nnoremap <S-Tab> <<_ - -nnoremap ]b :bnext<CR> -nnoremap [b :bprevious<CR> - -nnoremap <C-H> <C-w>h -nnoremap <C-J> <C-w>j -nnoremap <C-K> <C-w>k -nnoremap <C-R> <C-w>l - -nnoremap * /\<<C-r>=expand('<cword>')<CR>\><CR> -nnoremap # ?\<<C-r>=expand('<cword>')<CR>\><CR> - -cnoremap ;/ <C-r>=expand('%:p:h').'/'<CR> -cnoremap ;; <C-r>=expand('%:t')<CR> -cnoremap ;. <C-r>=expand('%:p:r')<CR> - -nnoremap <Leader>. :lcd %:p:h<CR> - -nnoremap Q @q - -nnoremap <Leader>c ^v$h -nnoremap <Leader>v ggVG - -nnoremap <Leader>y "+y -nnoremap <Leader>Y "+Y - -nnoremap <Leader>p "+p -nnoremap <Leader>P "+P - -inoremap <C-v> <C-c>"+pi -cnoremap <C-v> <C-r>+ - -nmap <Leader>w :w!<CR> -nmap <Leader>wq :wq!<CR> - -nnoremap ZX :qa!<CR> - -nnoremap <Leader>q :q<CR> - -command WS w !sudo tee "%" >/dev/null diff --git a/modules/wayland.nix b/modules/wayland.nix index e3dba79..7a9820d 100644 --- a/modules/wayland.nix +++ b/modules/wayland.nix @@ -14,6 +14,10 @@ in config = mkIf cfg.enable { nixfiles.modules.foot.enable = true; - hm.home.packages = with pkgs; [ wl-clipboard ]; + hm.home = { + packages = with pkgs; [ wl-clipboard ]; + + sessionVariables.NIXOS_OZONE_WL = 1; + }; }; } |