update flake, add mail backup and fix formatting

This commit is contained in:
2024-11-17 20:55:11 +01:00
parent 391c15be69
commit cd7cc0cea1
12 changed files with 487 additions and 434 deletions

View File

@ -8,7 +8,7 @@
}: let
pkgs = import nixpkgs rec {
system = "x86_64-linux";
overlays = [(final: prev: { nixvim = nixvim.packages.${system}.default; })];
overlays = [(final: prev: {nixvim = nixvim.packages.${system}.default;})];
};
nur = import nurpkgs {

View File

@ -14,6 +14,7 @@
moonlight-qt
vesktop
telegram-desktop
nixvim
];
sessionPath = ["~/.local/bin"];
sessionVariables = {

View File

@ -12,47 +12,10 @@
privacy-badger
ublock-origin
tree-style-tab
tridactyl
# tridactyl
];
customChrome = ''
@-moz-document url(chrome://browser/content/browser.xhtml) {
/* tabs on bottom of window */
/* requires that you set
* toolkit.legacyUserProfileCustomizations.stylesheets = true
* in about:config
*/
#main-window body { flex-direction: column-reverse !important; }
#navigator-toolbox { flex-direction: column-reverse !important; }
#urlbar {
top: unset !important;
bottom: calc((var(--urlbar-toolbar-height) - var(--urlbar-height)) / 2) !important;
box-shadow: none !important;
display: flex !important;
flex-direction: column !important;
}
#urlbar-input-container {
order: 2;
}
#urlbar > .urlbarView {
order: 1;
border-bottom: 1px solid #666;
}
#urlbar-results {
display: flex;
flex-direction: column-reverse;
}
.search-one-offs { display: none !important; }
.tab-background { border-top: none !important; }
#navigator-toolbox::after { border: none; }
#TabsToolbar .tabbrowser-arrowscrollbox,
#tabbrowser-tabs, .tab-stack { min-height: 28px !important; }
.tabbrowser-tab { font-size: 80%; }
.tab-content { padding: 0 5px; }
.tab-close-button .toolbarbutton-icon { width: 12px !important; height: 12px !important; }
toolbox[inFullscreen=true] { display: none; }
}
'';
customChrome = builtins.readFile ./userChrome.css;
userChrome = customChrome;

View File

@ -0,0 +1,88 @@
/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/toolbars_below_content.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */
/* Moves tabs toolbar, bookmarks toolbar and main toolbar to the bottom of the window, and makes tabs be the bottom-most toolbar */
/* By default, menubar will stay on top with two options to select it's behavior - see below */
@-moz-document url(chrome://browser/content/browser.xhtml){
#titlebar{ -moz-appearance: none !important; }
#navigator-toolbox > div{ display: contents }
.global-notificationbox,
#mainPopupSet,
#browser,
#customization-container,
#tab-notification-deck{
order: -1;
}
/* Remove the next row if you want tabs to be the top-most row */
#titlebar{
order: 2;
}
#toolbar-menubar{
position: fixed;
display: flex;
width: 100vw;
top: 0px;
-moz-window-dragging: drag;
}
/* Remove bottom border that won't do anything useful when at bottom of the window */
#navigator-toolbox{ border-bottom: none !important; }
#toolbar-menubar > spacer{ flex-grow: 1 }
#urlbar[breakout][breakout-extend]{
display: flex !important;
flex-direction: column-reverse;
bottom: 0px !important; /* Change to 3-5 px if using compact_urlbar_megabar.css depending on toolbar density */
top: auto !important;
}
.urlbarView-body-inner{ border-top-style: none !important; }
/* Yeah, removes window controls. Likely not wanted on bottom row */
#TabsToolbar > .titlebar-buttonbox-container{ display: none }
#toolbar-menubar > .titlebar-buttonbox-container{ order: 1000 }
/* Fix panels sizing */
.panel-viewstack{ max-height: unset !important; }
/* Fullscreen mode support */
:root[sizemode="fullscreen"] #navigator-toolbox{ margin-top: 0 !important }
:root[sizemode="fullscreen"] #navigator-toolbox[style*="margin-top"]{ visibility: collapse }
#fullscr-toggler{ bottom: 0; top: unset !important; }
/* These three rules exist for compatibility with autohide_toolbox.css */
#navigator-toolbox{ bottom: 0px; transform-origin: bottom }
#main-window > body > box{ margin-top: 0 !important; }
#toolbar-menubar{ z-index: 1; background-color: var(--lwt-accent-color,black); }
:root[BookmarksToolbarOverlapsBrowser] #navigator-toolbox{
margin-block: calc(-1 * var(--bookmarks-toolbar-height)) 0 !important;
}
:root[BookmarksToolbarOverlapsBrowser] .newTabBrowserPanel{
padding-block: 0 var(--bookmarks-toolbar-height) !important;
}
/**************
Menubar options - By default, menubar is overlayed on top of web-content
***************/
/* Uncomment the following if you want static menubar on top of the window (make menubar enabled)
* Use when menubar is enabled to always show it */
/*
#browser,#customization-container{ padding-top: var(--uc-menubar-spacer,28px) }
*/
/* OR, uncomment the following if you want menubar to appear below content, above tabs toolbar */
#toolbar-menubar{ position: static; display: flex; margin-top: 0px !important; background-color: transparent }
/* set to "column-reverse" (without quotes) if you want tabs above menubar with the above option */
#titlebar{ flex-direction: column }
}

View File

@ -8,7 +8,7 @@
stateVersion = "22.11";
username = "patrick";
homeDirectory = "/home/${config.home.username}";
packages = (pkgs.callPackage ./pkgs.nix {});
packages = pkgs.callPackage ./pkgs.nix {};
# packages = (pkgs.callPackage ./pkgs.nix {}) ++ [devenv.packages.${pkgs.system}.devenv];
sessionPath = ["~/.local/bin"];
sessionVariables = {

View File

@ -9,10 +9,14 @@
rescue = "ssh-wrapper rescue";
};
initExtra = /* bash */ ''
source ${pkgs.blesh}/share/blesh/ble.sh
export PATH=$PATH:~/.local/bin
export SSH_AUTH_SOCK=/run/user/1000/ssh-agent
'';
initExtra =
/*
bash
*/
''
source ${pkgs.blesh}/share/blesh/ble.sh
export PATH=$PATH:~/.local/bin
export SSH_AUTH_SOCK=/run/user/1000/ssh-agent
'';
};
}

View File

@ -22,303 +22,331 @@
{
plugin = fidget-nvim;
type = "lua";
config = /* lua */ ''
require('fidget').setup {}
'';
config =
/*
lua
*/
''
require('fidget').setup {}
'';
}
{
plugin = symbols-outline-nvim;
type = "lua";
config = /* lua */ ''
require('symbols-outline').setup()
'';
config =
/*
lua
*/
''
require('symbols-outline').setup()
'';
}
{
plugin = nvim-treesitter.withAllGrammars;
type = "lua";
config = /* lua */ ''
require('nvim-treesitter.configs').setup {
highlight = {
enable = true, -- false will disable the whole extension
},
incremental_selection = {
enable = false,
keymaps = {
init_selection = 'gnn',
node_incremental = 'grn',
scope_incremental = 'grc',
node_decremental = 'grm',
config =
/*
lua
*/
''
require('nvim-treesitter.configs').setup {
highlight = {
enable = true, -- false will disable the whole extension
},
},
indent = {
enable = true,
incremental_selection = {
enable = false,
keymaps = {
init_selection = 'gnn',
node_incremental = 'grn',
scope_incremental = 'grc',
node_decremental = 'grm',
},
},
indent = {
enable = true,
}
}
}
'';
'';
}
{
plugin = nvim-tree-lua;
type = "lua";
config = /* lua */ ''
local function my_on_attach(bufnr)
local api = require "nvim-tree.api"
config =
/*
lua
*/
''
local function my_on_attach(bufnr)
local api = require "nvim-tree.api"
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
vim.keymap.set('n', 's', api.node.open.horizontal, opts('Paste File'))
vim.keymap.set('n', 'ma', api.fs.create, opts('New File'))
vim.keymap.set('n', 'md', api.fs.remove, opts('Delete File'))
vim.keymap.set('n', 'me', api.fs.rename_node, opts('Rename File'))
vim.keymap.set('n', 'yy', api.fs.copy.node, opts('Copy File'))
vim.keymap.set('n', 'mp', api.fs.paste, opts('Paste File'))
end
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
vim.keymap.set('n', 's', api.node.open.horizontal, opts('Paste File'))
vim.keymap.set('n', 'ma', api.fs.create, opts('New File'))
vim.keymap.set('n', 'md', api.fs.remove, opts('Delete File'))
vim.keymap.set('n', 'me', api.fs.rename_node, opts('Rename File'))
vim.keymap.set('n', 'yy', api.fs.copy.node, opts('Copy File'))
vim.keymap.set('n', 'mp', api.fs.paste, opts('Paste File'))
end
require("nvim-tree").setup {
on_attach = my_on_attach,
}
'';
require("nvim-tree").setup {
on_attach = my_on_attach,
}
'';
}
{
plugin = nvim-cmp;
type = "lua";
config = /* lua */ ''
-- local luasnip = require 'luasnip'
local cmp = require 'cmp'
config =
/*
lua
*/
''
-- local luasnip = require 'luasnip'
local cmp = require 'cmp'
cmp.setup {
-- snippet = {
-- expand = function(args)
-- require('luasnip').lsp_expand(args.body)
-- end,
-- },
window = {
-- documentation = true,
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
cmp.setup {
-- snippet = {
-- expand = function(args)
-- require('luasnip').lsp_expand(args.body)
-- end,
-- },
window = {
-- documentation = true,
},
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
}),
sources = {
{ name = 'nvim_lsp' },
-- { name = 'luasnip' },
{ name = 'buffer' },
{ name = 'path' },
-- { name = 'latex_symbols' },
},
}
'';
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
}),
sources = {
{ name = 'nvim_lsp' },
-- { name = 'luasnip' },
{ name = 'buffer' },
{ name = 'path' },
-- { name = 'latex_symbols' },
},
}
'';
}
{
plugin = nvim-lspconfig;
type = "lua";
config = /* lua */ ''
function hi(name, opts)
local options = ""
for k, v in pairs(opts) do
options = options.." "..k.."="..v
end
vim.cmd("highlight "..name..options)
end
local u = require('utils')
local lspc = require('lspconfig')
local ih = require("inlay-hints")
ih.setup()
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap=true, silent=true }
buf_set_keymap('n', '<c-]>', ':lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gD', ':lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<c-k>', ':lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '1gD', ':lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', 'gr', ':lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', 'g0', ':lua vim.lsp.buf.document_symbol()<CR>', opts)
buf_set_keymap('n', 'gW', ':lua vim.lsp.buf.workspace_symbol()<CR>', opts)
buf_set_keymap('n', 'gd', ':lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'ga', ':lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'ff', ':lua vim.lsp.buf.format({async = true})<CR>', opts)
buf_set_keymap('n', 'gn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
--require'completion'.on_attach(client)
-- Set highlight colors
local highlights = {
Error = "Red",
Warning = "Yellow",
Information = "Blue",
Hint = "Green",
}
for typ, color in pairs(highlights) do
hi('LspDiagnosticsDefault'..typ, {ctermfg = color})
hi('LspDiagnosticsUnderline'..typ, {cterm = 'underline'})
config =
/*
lua
*/
''
function hi(name, opts)
local options = ""
for k, v in pairs(opts) do
options = options.." "..k.."="..v
end
vim.cmd("highlight "..name..options)
end
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,
{
virtual_text = true,
signs = true,
update_in_insert = true,
underline = true
local u = require('utils')
local lspc = require('lspconfig')
local ih = require("inlay-hints")
ih.setup()
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap=true, silent=true }
buf_set_keymap('n', '<c-]>', ':lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gD', ':lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<c-k>', ':lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '1gD', ':lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', 'gr', ':lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', 'g0', ':lua vim.lsp.buf.document_symbol()<CR>', opts)
buf_set_keymap('n', 'gW', ':lua vim.lsp.buf.workspace_symbol()<CR>', opts)
buf_set_keymap('n', 'gd', ':lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'ga', ':lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'ff', ':lua vim.lsp.buf.format({async = true})<CR>', opts)
buf_set_keymap('n', 'gn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
--require'completion'.on_attach(client)
-- Set highlight colors
local highlights = {
Error = "Red",
Warning = "Yellow",
Information = "Blue",
Hint = "Green",
}
)
require "lsp_signature".on_attach({doc_lines = 0})
ih.on_attach(client, bufnr)
end
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
for typ, color in pairs(highlights) do
hi('LspDiagnosticsDefault'..typ, {ctermfg = color})
hi('LspDiagnosticsUnderline'..typ, {cterm = 'underline'})
end
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,
{
virtual_text = true,
signs = true,
update_in_insert = true,
underline = true
}
)
require "lsp_signature".on_attach({doc_lines = 0})
ih.on_attach(client, bufnr)
end
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
local config = {
on_attach = on_attach,
capabilities = capabilities,
flags = {debounce_text_changes = 150}
}
local config = {
on_attach = on_attach,
capabilities = capabilities,
flags = {debounce_text_changes = 150}
}
lspc.bashls.setup(config)
lspc.nixd.setup(config)
lspc.solargraph.setup(config)
lspc.bashls.setup(config)
lspc.nixd.setup(config)
lspc.solargraph.setup(config)
lspc.rust_analyzer.setup{
on_attach = on_attach,
capabilities = capabilities,
flags = {debounce_text_changes = 150},
settings = {
['rust-analyzer'] = {
assist = {
importGranularity = "module",
importPrefix = "by_self",
},
cargo = {
loadOutDirsFromCheck = true
},
procMacro = {
enable = true
},
checkOnSave = {
command = "clippy"
},
lspc.rust_analyzer.setup{
on_attach = on_attach,
capabilities = capabilities,
flags = {debounce_text_changes = 150},
settings = {
['rust-analyzer'] = {
assist = {
importGranularity = "module",
importPrefix = "by_self",
},
cargo = {
loadOutDirsFromCheck = true
},
procMacro = {
enable = true
},
checkOnSave = {
command = "clippy"
},
}
}
}
}
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
'';
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
'';
}
];
extraLuaConfig = /* lua */ ''
local onedark = require('onedark')
onedark.setup { style = 'warmer' }
onedark.load()
vim.cmd('set background=dark')
extraLuaConfig =
/*
lua
*/
''
local onedark = require('onedark')
onedark.setup { style = 'warmer' }
onedark.load()
vim.cmd('set background=dark')
local llc = require('lualine').get_config()
llc.options.theme = 'onedark'
require('lualine').setup(llc)
local llc = require('lualine').get_config()
llc.options.theme = 'onedark'
require('lualine').setup(llc)
local key = vim.api.nvim_set_keymap
local o = vim.o
local wo = vim.wo
local bo = vim.bo
local cmd = vim.cmd
local key = vim.api.nvim_set_keymap
local o = vim.o
local wo = vim.wo
local bo = vim.bo
local cmd = vim.cmd
vim.cmd([[autocmd CursorHold * lua vim.diagnostic.open_float({focusable = false})]])
vim.cmd([[autocmd CursorHold * lua vim.diagnostic.open_float({focusable = false})]])
key('n', ';', ':Telescope find_files<CR>', {})
key('n', '<C-n>', ':NvimTreeToggle<CR>', {})
key('n', 'gh', '/<c-r>=expand("<cword>")<CR><CR>N', {})
key('n', ';', ':Telescope find_files<CR>', {})
key('n', '<C-n>', ':NvimTreeToggle<CR>', {})
key('n', 'gh', '/<c-r>=expand("<cword>")<CR><CR>N', {})
key('i', '<TAB>', 'pumvisible() ? "<C-n>" : "<Tab>"', { expr = true, silent = true })
key('i', '<S-TAB>', 'pumvisible() ? "<C-p>" : "<S-Tab>"', { expr = true, silent = true })
key('n', '<leader>g', ':lua require"telescope.builtin".live_grep{}<CR>', {})
key('v', '<leader>c', ':w !wl-copy<CR><CR>', { silent = true })
key('i', '<TAB>', 'pumvisible() ? "<C-n>" : "<Tab>"', { expr = true, silent = true })
key('i', '<S-TAB>', 'pumvisible() ? "<C-p>" : "<S-Tab>"', { expr = true, silent = true })
key('n', '<leader>g', ':lua require"telescope.builtin".live_grep{}<CR>', {})
key('v', '<leader>c', ':w !wl-copy<CR><CR>', { silent = true })
vim.api.nvim_exec(
[[
augroup YankHighlight
autocmd!
autocmd TextYankPost * silent! lua vim.highlight.on_yank()
augroup end
]] ,
false
)
vim.api.nvim_exec(
[[
augroup YankHighlight
autocmd!
autocmd TextYankPost * silent! lua vim.highlight.on_yank()
augroup end
]] ,
false
)
vim.api.nvim_create_autocmd("BufEnter", {
nested = true,
callback = function()
if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then
vim.cmd 'quit'
vim.api.nvim_create_autocmd("BufEnter", {
nested = true,
callback = function()
if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then
vim.cmd 'quit'
end
end
end
})
})
cmd('syntax on')
cmd('set number')
cmd('set completeopt=menuone,noinsert,noselect')
cmd('set shortmess+=c')
cmd("autocmd CursorHold,CursorHoldI *.rs :lua require'lsp_extensions'.inlay_hints{ only_current_line = true }")
cmd('syntax on')
cmd('set number')
cmd('set completeopt=menuone,noinsert,noselect')
cmd('set shortmess+=c')
cmd("autocmd CursorHold,CursorHoldI *.rs :lua require'lsp_extensions'.inlay_hints{ only_current_line = true }")
o.startofline = true
wo.cursorline = true
o.startofline = true
wo.cursorline = true
o.updatetime = 300
wo.signcolumn='yes'
o.showcmd = true
o.updatetime = 300
wo.signcolumn='yes'
o.showcmd = true
o.shell = 'bash'
o.mouse = 'a'
o.shell = 'bash'
o.mouse = 'a'
o.smarttab = true
bo.tabstop = 2
bo.shiftwidth = 2
bo.expandtab = true
o.smarttab = true
bo.tabstop = 2
bo.shiftwidth = 2
bo.expandtab = true
wo.relativenumber = true
o.hidden = true
wo.relativenumber = true
o.hidden = true
'';
'';
extraPackages = with pkgs; [
shfmt