From 9b0219959b14936800bd715de0b23c9cb18e376c Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Thu, 9 Jan 2025 21:52:03 +0100 Subject: [PATCH] update to NixOS 24.11 --- configuration.nix | 55 ++++++----------------------- email.nix | 4 +-- fish.nix | 2 ++ matrix.nix | 8 ----- neovim.nix | 89 +++++++++++++++++++++-------------------------- packages.nix | 5 ++- 6 files changed, 56 insertions(+), 107 deletions(-) diff --git a/configuration.nix b/configuration.nix index 874c91e..aab4cc9 100644 --- a/configuration.nix +++ b/configuration.nix @@ -23,8 +23,8 @@ system.stateVersion = "23.05"; nixpkgs.source = builtins.fetchTarball - { url = "https://github.com/NixOS/nixpkgs/archive/c505ebf77752.tar.gz"; - sha256 = "0sk76hr3l7gd85aa3j9y5j1napvx18xb762fdqz3ibf717s8br5g"; + { url = "https://github.com/NixOS/nixpkgs/archive/3f0a8ac25fb6.tar.gz"; + sha256 = "10i7fllqjzq171afzhdf2d9r1pk9irvmq5n55h92rc47vlaabvr4"; }; boot.kernelPackages = pkgs.linuxPackages_latest; @@ -68,7 +68,7 @@ usePredictableInterfaceNames = false; nameservers = [ "127.0.0.1" ]; - # ensure hostname work without DNS + # ensure hostname works without DNS hosts = with config.var; { ${ipv4LanAddress} = [ hostname ]; ${ipv6Address} = [ hostname ]; @@ -186,6 +186,14 @@ users.groups."eurofusion-eu".members = [ "nginx" ]; + # sensible logging + services.journald = { + storage = "volatile"; + extraConfig = '' + RuntimeMaxUse=2G + ''; + }; + services.openssh = { enable = true; settings.PermitRootLogin = "no"; @@ -482,47 +490,6 @@ relay.onionServices.emergency-access.map = [ 22 ]; }; - ### Program configuration - programs = { - fuse.userAllowOther = true; - fish.enable = true; - tmux = { - enable = true; - newSession = true; - baseIndex = 1; - escapeTime = 0; - historyLimit = 4096; - keyMode = "vi"; - terminal = "screen-256color"; - customPaneNavigationAndResize = true; - extraConfig = '' - set -g mouse on - - # bindings - bind | split-window -h - bind - split-window -v - bind : command-prompt - bind -n C-k clear-history - - # colors - set -g pane-border-style fg=brightblack - set -g pane-active-border fg=green - set -g message-style fg=white,bg=black - set -g status-style fg=brightblue,bg=black - setw -g mode-style fg=black,bg=cyan - - # status line - set -g status on - set -g status-justify left - set -g status-left "" - set -g status-right-length 60 - set -g status-right '#[fg=yellow]#(cut -d\ -f 1-3 /proc/loadavg) | #[fg=brightgreen]%a %H:%M' - setw -g window-status-format "#[fg=black#,bg=brightblack] #I #[fg=blue#,bg=black] #W " - setw -g window-status-current-format "#[fg=white#,bg=cyan] #I #[fg=black#,bg=brightblack] #W " - ''; - }; - }; - nix.settings = { # Can connect to the Nix daemon # and upload/run code as root! diff --git a/email.nix b/email.nix index 6779026..6633a54 100644 --- a/email.nix +++ b/email.nix @@ -3,8 +3,8 @@ { imports = [ (builtins.fetchTarball { - url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/nixos-24.05/nixos-mailserver-nixos-24.05.tar.gz"; - sha256 = "0clvw4622mqzk1aqw1qn6shl9pai097q62mq1ibzscnjayhp278b"; + url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/nixos-24.05/nixos-mailserver-nixos-24.11.tar.gz"; + sha256 = "08zdidja5kdqgskynxsmcd8skh1b7cfl9ijjy9pak4b5h3aw2iqv"; }) ]; diff --git a/fish.nix b/fish.nix index d3b0700..c33b7ed 100644 --- a/fish.nix +++ b/fish.nix @@ -1,6 +1,8 @@ { ... }: { + programs.fish.enable = true; + programs.fish.shellAbbrs = { e = "nvim"; l = "ls -lh"; diff --git a/matrix.nix b/matrix.nix index 4250302..f49a6f1 100644 --- a/matrix.nix +++ b/matrix.nix @@ -96,10 +96,6 @@ in event_cache_size = "2K"; max_upload_size = "1000M"; dynamic_thumbnails = true; - - # bridges configuration - app_service_config_files = - [ "/var/lib/mautrix-whatsapp/whatsapp-registration.yaml" ]; }; # Secrets @@ -161,10 +157,6 @@ in relay.enabled = false; mute_bridging = true; }; - settings.whatsapp = - { os_name = "Chrome (Linux)"; - browser_name = "chrome"; - }; }; } diff --git a/neovim.nix b/neovim.nix index 53eab32..eb16766 100644 --- a/neovim.nix +++ b/neovim.nix @@ -15,12 +15,13 @@ let frameline nvim-fzf # Syntax + playground vim-pandoc-syntax nix-queries fortran-queries (nvim-treesitter.withPlugins (p: with p; [ bash fish - c haskell - html css markdown + c fortran haskell + html css nix python lua ])) @@ -47,26 +48,16 @@ let '' ;; extends - ; /*language*/ highlight (too slow) - ; ((comment) @language - ; [ - ; (string_expression (string_fragment) @content) - ; (indented_string_expression (string_fragment) @content) - ; ] - ; (#gsub! @language "/%*%s*([%w%p]+)%s*%*/" "%1")) - ; @combined - ; writeText highlight - (apply_expression - function: - (apply_expression - function: (_) @_func - argument: (string_expression (string_fragment) @language)) - argument: [(string_expression (string_fragment) @content) - (indented_string_expression (string_fragment) @content)] + (apply_expression function: + (apply_expression function: (_) @_func + argument: (string_expression (string_fragment) @injection.language)) + argument: [ + (string_expression (string_fragment) @injection.content) + (indented_string_expression (string_fragment) @injection.content)] (#match? @_func "(^|\\.)writeText(Dir)?$") - (#gsub! @language ".*%.(.*)" "%1")) - @combined + (#gsub! @injection.language ".*%.(.*)" "%1") + (#set! injection.combined)) ''; fortran-queries = pkgs.writeTextDir "/queries/fortran/highlights.scm" @@ -103,6 +94,7 @@ let opt.ignorecase = true -- Case insensitive search... opt.smartcase = true -- ...for lowercase terms opt.splitkeep = 'screen' -- keep text still when splitting + opt.laststatus = 3 -- global statusline opt.fsync = true -- Sync writes opt.swapfile = false -- Disable swap files @@ -143,28 +135,20 @@ let opt.foldopen:remove("search") -- don't open when searching -- - -- OSC 52 clipboard - -- + -- OSC 52 clipboard for SSH -- - if os.getenv('DISPLAY') == nil then - function copy(sel) - return function(lines, _) - local data = vim.fn.system([[base64 -w0]], lines) - io.stdout:write('\027]52;'..sel..';'..data..'\a') - vim.g.fallback_clip = lines - end - end - - function paste(sel) - -- currently impossible to implement - return function() return {vim.g.fallback_clip, ""} end - end - + if os.getenv('SSH_TTY') ~= nil then vim.g.clipboard = { - name='ssh', - copy={['*']=copy's', ['+']=copy'c'}, - paste={['*']=paste's', ['+']=paste'c'}, + name = 'OSC 52', + copy = { + ['+'] = require('vim.ui.clipboard.osc52').copy('+'), + ['*'] = require('vim.ui.clipboard.osc52').copy('*'), + }, + paste = { + ['+'] = require('vim.ui.clipboard.osc52').paste('+'), + ['*'] = require('vim.ui.clipboard.osc52').paste('*'), + }, } end @@ -174,8 +158,8 @@ let -- Hide some UI elements autocmd('TermOpen', {pattern='*', command='setlocal nonumber'}) - autocmd('TermEnter', {pattern='*', command='set noshowcmd'}) - autocmd('TermLeave', {pattern='*', command='set showcmd'}) + autocmd('TermEnter', {pattern='*', command='set cmdheight=0 laststatus=0'}) + autocmd('TermLeave', {pattern='*', command='set cmdheight=1 laststatus=3'}) autocmd('VimResized', {pattern='*', command='wincmd ='}) -- Exit without confirmation @@ -187,6 +171,10 @@ let keymap('n', '|', ':vsplit +term', {silent=true}) -- keymap('n', 't', ':tabnew +term', {silent=true}) -- keymap('n', 'c', ':quit', {silent=true}) -- + keymap('n', '', 'h', {noremap=true}) -- + keymap('n', '', 'j', {noremap=true}) -- + keymap('n', '', 'k', {noremap=true}) -- + keymap('n', '', 'l', {noremap=true}) -- -- -- Keybindings @@ -280,6 +268,7 @@ let color('FoldColumn', {ctermfg='none', cterm={}}) color('Visual', {ctermfg='none', ctermbg=0}) color('Search', {ctermfg='none', ctermbg=0}) + color('CurSearch', {ctermfg='none', ctermbg=0}) -- Diff mode color('DiffAdd', {ctermfg=2, ctermbg=0, underline=true}) @@ -298,9 +287,9 @@ let -- Git signs color('SignColumn', {ctermfg=1, ctermbg='none', cterm={}}) - color('GitAdd', {ctermfg=2}) - color('GitChange', {ctermfg=3}) - color('GitDelete', {ctermfg=1}) + color('GitSignsAdd', {ctermfg=2}) + color('GitSignsChange', {ctermfg=3}) + color('GitSignsDelete', {ctermfg=1}) -- Statusline color('StatusLine', {ctermfg=8, ctermbg=0, cterm={}}) @@ -334,16 +323,16 @@ let -- Pandoc Markdown autocmd({'BufNewFile', 'BufFilePre', 'BufRead'}, - {pattern='*.md', command='set filetype=markdown.pandoc'}) + {pattern='*.md', command='set filetype=markdown.pandoc | TSBufDisable highlight'}) -- Git signs gitsigns = require'gitsigns' gitsigns.setup{signs={ - add = {hl='GitAdd' , text='+'}, - change = {hl='GitChange', text='δ'}, - delete = {hl='GitDelete', text='-'}, - topdelete = {hl='GitDelete', text='‾'}, - changedelete = {hl='GitChange', text='~'}} + add = {text='+'}, + change = {text='δ'}, + delete = {text='-'}, + topdelete = {text='‾'}, + changedelete = {text='~'}} } keymap('n', 'gb', function() gitsigns.blame_line{full=true} end, {silent=true}) keymap('n', 'gp', function() gitsigns.preview_hunk() end, {silent=true}) diff --git a/packages.nix b/packages.nix index 5706a8c..177933b 100644 --- a/packages.nix +++ b/packages.nix @@ -10,9 +10,8 @@ }; haskellPackages = super.haskellPackages.extend (hself: hsuper: - { breve = hself.callCabal2nix "breve" (builtins.fetchTarball - { url = "https://hackage.haskell.org/package/breve-0.5.1.0/breve-0.5.1.0.tar.gz"; - }) {}; + { breve = super.haskell.lib.overrideCabal hsuper.breve + (old: { broken = false; }); }); });