From 75918debfd7245d90478f882b0323a705ab3c7be Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Mon, 24 Jun 2024 11:10:21 +0300 Subject: 2024-06-24 --- configurations/default.nix | 6 +- flake.lock | 78 ++++++++-------- lib/my.nix | 4 +- modules/common/nix.nix | 13 +-- modules/games/default.nix | 26 +++--- modules/profiles/default.nix | 3 +- modules/profiles/headful.nix | 7 +- modules/subversion.nix | 2 +- modules/vim.nix | 208 +++++++++++++++++++++++++++++++++++++++++++ modules/vim/default.nix | 71 --------------- modules/vim/rc.vim | 169 ----------------------------------- modules/wayland.nix | 6 +- 12 files changed, 280 insertions(+), 313 deletions(-) create mode 100644 modules/vim.nix delete mode 100644 modules/vim/default.nix delete mode 100644 modules/vim/rc.vim diff --git a/configurations/default.nix b/configurations/default.nix index c1712db..7e2f6d7 100644 --- a/configurations/default.nix +++ b/configurations/default.nix @@ -66,9 +66,8 @@ mapAttrs' mkConfiguration ( srvos.nixosModules.common ]; - melian.modules = with inputs; [ - nixos-hardware.nixosModules.common-pc-laptop-ssd - nixos-hardware.nixosModules.lenovo-thinkpad-t480 + ilmare.modules = with inputs; [ + nixos-hardware.nixosModules.lenovo-thinkpad-x1-nano nixpkgs.nixosModules.notDetected srvos.nixosModules.common ]; @@ -92,7 +91,6 @@ mapAttrs' mkConfiguration ( yavanna.modules = with inputs; [ "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix" nixos-hardware.nixosModules.common-cpu-intel - nixos-hardware.nixosModules.common-pc-hdd nixpkgs.nixosModules.notDetected srvos.nixosModules.server ]; diff --git a/flake.lock b/flake.lock index 09a2c72..67beb64 100644 --- a/flake.lock +++ b/flake.lock @@ -375,11 +375,11 @@ ] }, "locked": { - "lastModified": 1717664902, - "narHash": "sha256-7XfBuLULizXjXfBYy/VV+SpYMHreNRHk9nKMsm1bgb4=", + "lastModified": 1718879355, + "narHash": "sha256-RTyqP4fBX2MdhNuMP+fnR3lIwbdtXhyj7w7fwtvgspc=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "cc4d466cb1254af050ff7bdf47f6d404a7c646d1", + "rev": "8cd35b9496d21a6c55164d8547d9d5280162b07a", "type": "github" }, "original": { @@ -433,11 +433,11 @@ ] }, "locked": { - "lastModified": 1718788307, - "narHash": "sha256-SqiOz0sljM0GjyQEVinPXQxaGcbOXw5OgpCWGPgh/vo=", + "lastModified": 1719037157, + "narHash": "sha256-aOKd8+mhBsLQChCu1mn/W5ww79ta5cXVE59aJFrifM8=", "owner": "nix-community", "repo": "home-manager", - "rev": "d7830d05421d0ced83a0f007900898bdcaf2a2ca", + "rev": "cd886711998fe5d9ff7979fdd4b4cbd17b1f1511", "type": "github" }, "original": { @@ -464,11 +464,11 @@ }, "impermanence": { "locked": { - "lastModified": 1717932370, - "narHash": "sha256-7C5lCpiWiyPoIACOcu2mukn/1JRtz6HC/1aEMhUdcw0=", + "lastModified": 1719091691, + "narHash": "sha256-AxaLX5cBEcGtE02PeGsfscSb/fWMnyS7zMWBXQWDKbE=", "owner": "nix-community", "repo": "impermanence", - "rev": "27979f1c3a0d3b9617a3563e2839114ba7d48d3f", + "rev": "23c1f06316b67cb5dabdfe2973da3785cfe9c34a", "type": "github" }, "original": { @@ -489,11 +489,11 @@ "nixpkgs-24_05": "nixpkgs-24_05" }, "locked": { - "lastModified": 1718398369, - "narHash": "sha256-ccOHDuTaUhD1DW6DGNXoDJNOwYx55rVNKECyqRzKRtE=", + "lastModified": 1718697807, + "narHash": "sha256-Enla61WFisytTYbWygPynEbu8vozjeGc6Obkj2GRj7o=", "owner": "simple-nixos-mailserver", "repo": "nixos-mailserver", - "rev": "54cbacb6eb9938bf1eaab7a7840fb527050c2af1", + "rev": "290a995de5c3d3f08468fa548f0d55ab2efc7b6b", "type": "gitlab" }, "original": { @@ -515,11 +515,11 @@ ] }, "locked": { - "lastModified": 1718760354, - "narHash": "sha256-jRp9BePU8ZW2Q9UFOcSNNV1H3NSp3hqXkg/raMNhHMM=", + "lastModified": 1719106546, + "narHash": "sha256-eXI0i8sPL/XblbrX5Oi5Vy+IJfRIfgnGfz3R0xxKqxc=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "c50d882ce2510df6e47cb6b392497dde75ed2a2a", + "rev": "c26db352b99db2c47ca4ea8ccf0b1fc66c4ceda1", "type": "github" }, "original": { @@ -535,11 +535,11 @@ ] }, "locked": { - "lastModified": 1718507237, - "narHash": "sha256-xBEWCxWeRpWQggFFp8ugJCDa63cOJsVvx71R9F0Eowg=", + "lastModified": 1719111455, + "narHash": "sha256-rnIxHx+fLpydjMQsbpZ21kblUr/lMqSaAtMA4+qMMEE=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "6af2c5e58c20311276f59d247341cafeebfcb6f4", + "rev": "4293f532d0107dfb7e6f8b34a0421dc8111320e6", "type": "github" }, "original": { @@ -577,11 +577,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1718548414, - "narHash": "sha256-1obyIuQPR/Kq1j5/i/5EuAfQrDwjYnjCDG8iLtXmBhQ=", + "lastModified": 1719145664, + "narHash": "sha256-+0bBlerLxsHUJcKPDWZM1wL3V9bzCFjz+VyRTG8fnUA=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "cde8f7e11f036160b0fd6a9e07dc4c8e4061cf06", + "rev": "c3e48cbd88414f583ff08804eb57b0da4c194f9e", "type": "github" }, "original": { @@ -592,11 +592,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718606988, - "narHash": "sha256-pmjP5ePc1jz+Okona3HxD7AYT0wbrCwm9bXAlj08nDM=", + "lastModified": 1719082008, + "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "38d3352a65ac9d621b0cd3074d3bef27199ff78f", + "rev": "9693852a2070b398ee123a329e68f0dab5526681", "type": "github" }, "original": { @@ -623,11 +623,11 @@ }, "nixpkgs-master": { "locked": { - "lastModified": 1718788377, - "narHash": "sha256-ZoqF46gRMKHra9+5Uw5rBKu0/0Bo9b7kO5rvjgGjy10=", + "lastModified": 1719214567, + "narHash": "sha256-KKT+5n8uIiBcqz8xbpE4042MhneTxCx7qO78EyQGlog=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2dbcf7101a397c243aa2011b4a53db73f1f1448c", + "rev": "cab01b571fd39cd803da18577e8a6ae071a0e006", "type": "github" }, "original": { @@ -639,11 +639,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1718786543, - "narHash": "sha256-R8lt4gur3+k5oG03AMaA0+Vnzdrm6BJ3c4gjnDRJZMk=", + "lastModified": 1719154419, + "narHash": "sha256-H5cz+1rcc3MkkLzUW7FHLo7cgb0htn1rDVeNewa0Hnw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b9bb121348b1392a5994cb333559fd158b8b9fc5", + "rev": "28302cbc45602ccf5f3d45827145e59e4b83d8e0", "type": "github" }, "original": { @@ -720,11 +720,11 @@ ] }, "locked": { - "lastModified": 1718585173, - "narHash": "sha256-G5DB6D3p8ucyGfmWt3JmiWcVW55DeuUoiT230wQ9Am4=", + "lastModified": 1718844164, + "narHash": "sha256-QUXWv6llKIQ5To2N24d9dRI78Hqfm9iFyhvmvlOICNo=", "owner": "nix-community", "repo": "srvos", - "rev": "c607ffef7c234d88f37ed12d75b2c48de3f4b3fe", + "rev": "557ff94aa1b48a723f8fa16eb9e7a2e6de991682", "type": "github" }, "original": { @@ -754,11 +754,11 @@ ] }, "locked": { - "lastModified": 1718634635, - "narHash": "sha256-REUyeY+gD/QuTwAhuJycheej0FWFGPTosI+jiG5TsQk=", + "lastModified": 1719152448, + "narHash": "sha256-Acbi1Crd+UEbpPW8IR0ZGRKV+JCnMXDS2cglFQJvRPM=", "owner": "danth", "repo": "stylix", - "rev": "f13c946181730f98e1a5cd09714100490207b250", + "rev": "0fc4e9f1449a9dce4be7a1ecedd97949da591181", "type": "github" }, "original": { @@ -825,11 +825,11 @@ ] }, "locked": { - "lastModified": 1718760425, - "narHash": "sha256-kGAKl4qNbVPz5z+2F32jYM4srlRGt7j3qljoW45mjV4=", + "lastModified": 1719106160, + "narHash": "sha256-jVBLe1sKZdXHiWMXs1Pc86xgGnwlLPbo/ptzWr8FbmE=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "b882e3fa1da93a60e1f4185ae02314eb73fa9852", + "rev": "37f43e542bb49c27f3aeb16dc7bd3a800e9e0469", "type": "github" }, "original": { diff --git a/lib/my.nix b/lib/my.nix index 8e9b3fc..30f0e5c 100644 --- a/lib/my.nix +++ b/lib/my.nix @@ -266,8 +266,8 @@ with lib; syncthing.id = "@SYNCTHING_ID@"; }; - # ThinkPad T480. - melian = { + # ThinkPad X1 Nano Gen 3. + ilmare = { stateVersion = "24.05"; deviceIcon = "devices.laptop"; system = "x86_64-linux"; 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(':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 + let mapleader=" " + + nnoremap :W :w + nnoremap :W! :w! + nnoremap :Q :q + nnoremap :Q! :q! + + 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 + + inoremap u + inoremap u + + vnoremap < >gv + vnoremap >gv + vnoremap >>_ + nnoremap <<_ + + nnoremap ]b :bnext + nnoremap [b :bprevious + + nnoremap h + nnoremap j + nnoremap k + nnoremap l + + nnoremap * /\<=expand('')\> + nnoremap # ?\<=expand('')\> + + cnoremap ;/ =expand('%:p:h').'/' + cnoremap ;; =expand('%:t') + cnoremap ;. =expand('%:p:r') + + nnoremap . :lcd %:p:h + + nnoremap Q @q + + nnoremap c ^v$h + nnoremap v ggVG + + 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 + + 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(':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 -let mapleader=" " - -nnoremap :W :w -nnoremap :W! :w! -nnoremap :Q :q -nnoremap :Q! :q! - -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 - -inoremap u -inoremap u - -vnoremap < >gv -vnoremap >gv -vnoremap >>_ -nnoremap <<_ - -nnoremap ]b :bnext -nnoremap [b :bprevious - -nnoremap h -nnoremap j -nnoremap k -nnoremap l - -nnoremap * /\<=expand('')\> -nnoremap # ?\<=expand('')\> - -cnoremap ;/ =expand('%:p:h').'/' -cnoremap ;; =expand('%:t') -cnoremap ;. =expand('%:p:r') - -nnoremap . :lcd %:p:h - -nnoremap Q @q - -nnoremap c ^v$h -nnoremap v ggVG - -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 - -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; + }; }; } -- cgit v1.2.3