diff --git a/flake.nix b/flake.nix index dc26e45..ef35c23 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,9 @@ # Nixpkgs nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # Import personal packages repo + sqlfmt.url = "git+https://git.bitlab21.com/sam/flake-packages?dir=sqlfmt"; + # Home manager home-manager = { url = "github:nix-community/home-manager"; @@ -20,6 +23,9 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + # Nix colors + nix-colors.url = "github:misterio77/nix-colors"; + # Declarative partitioning and formatting disko = { url = "github:nix-community/disko"; @@ -46,10 +52,8 @@ self, nixpkgs, home-manager, - disko, - #impermanence, ... - } @ inputs: + } @ inputs: let inherit (self) outputs; systems = [ diff --git a/home/common/core/default.nix b/home/common/core/default.nix index bbb9e43..3de98b8 100644 --- a/home/common/core/default.nix +++ b/home/common/core/default.nix @@ -1,22 +1,26 @@ -{ config, lib, pkgs, outputs, ... }: +{ pkgs, inputs, ... }: { imports = [ + inputs.nix-colors.homeManagerModules.default ./zsh.nix - ./nixvim.nix + ./nixvim ./fonts.nix - ] ; - + ]; # Global home packages without config go here (for all hosts and users) home.packages = builtins.attrValues { inherit (pkgs) - ripgrep - fzf - eza - pciutils - tree - jq - coreutils - ;}; + ripgrep + fzf + eza + pciutils + tree + jq + coreutils + btop + htop + postgresql + ; + }; home.stateVersion = "23.11"; } diff --git a/home/common/core/nixvim.nix b/home/common/core/nixvim.nix deleted file mode 100644 index fde5a9c..0000000 --- a/home/common/core/nixvim.nix +++ /dev/null @@ -1,356 +0,0 @@ -{ inputs, pkgs, ... }: { - imports = [ - inputs.nixvim.homeManagerModules.nixvim - ]; - - programs.nixvim = { - enable = true; - enableMan = true; # install man pages for nixvim options - - clipboard.register = "unnamedplus"; # use system clipboard instead of internal registers - - colorschemes.kanagawa = { - enable = true; - settings = { - commentStyle = { - italic = true; - }; - dimInactive = true; - terminalColors = true; - theme = "wave"; - transparent = false; - undercurl = true; - }; - }; - - opts = { - # - # ========= General Appearance ========= - # - background = ""; - number = true; # show line numbers - relativenumber = true; # show relative linenumbers - laststatus = 0; # Display status line always - history = 1000; # Store lots of :cmdline history - showcmd = true; # Show incomplete cmds down the bottom - showmode = true; # Show current mode down the bottom - autoread = true; # Reload files changed outside vim - lazyredraw = true; # Redraw only when needed - showmatch = true; # highlight matching braces - ruler = true; # show current line and column - visualbell = true; # No sounds - - listchars = "trail:·"; # Display tabs and trailing spaces visually - - # ========= Font ========= - guifont = "NotoSansMono:h9"; # fontname:fontsize - - # ========= Cursor ========= - guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20,n-v-i:blinkon0"; - - # ========= Redirect Temp Files ========= - # backup - backupdir = "$HOME/.local/state/vim/backup//,/tmp//,."; - writebackup = false; - # swap - directory = "$HOME/.local/vim/swap//,/tmp//,."; - - # ================ Indentation ====================== - autoindent = true; - cindent = true; # automatically indent braces - smartindent = true; - smarttab = true; - shiftwidth = 2; - softtabstop = 4; - tabstop = 2; - expandtab = true; - - # ================ Folds ============================ - foldmethod = "indent"; # fold based on indent - foldnestmax = 3; # deepest fold is 3 levels - foldenable = false; # don't fold by default - - # ================ Completion ======================= - wildmode = "list:longest"; - wildmenu = true; # enable ctrl-n and ctrl-p to scroll thru matches - - # stuff to ignore when tab completing - wildignore = "*.o,*.obj,*~,vim/backups,sass-cache,DS_Store,vendor/rails/**,vendor/cache/**,*.gem,log/**,tmp/**,*.png,*.jpg,*.gif"; - - # ================ Scrolling ======================== - scrolloff = 4; # Start scrolling when we're 4 lines away from margins - sidescrolloff = 15; - sidescroll = 1; - - # ================ Searching ======================== - incsearch = true; - hlsearch = true; - ignorecase = true; - smartcase = true; - - # ================ Movement ======================== - backspace = "indent,eol,start"; # allow backspace in insert mode - }; - - # - # ========= UI Plugins ========= - # - - plugins.nvim-colorizer = { - enable = true; - fileTypes = [ "*" ]; - }; - - plugins.lualine = { - enable = true; - theme = "auto"; - componentSeparators = { - left = ""; - right = ""; - }; - sectionSeparators = { - left = ""; - right = ""; - }; - sections = { - lualine_a = [ "mode" ]; - lualine_b = [ "branch" "diff" "diagnostics" ]; - lualine_c = [ "filename" ]; - lualine_x = [ "encoding" "fileformat" "filetype" ]; - lualine_y = [ "progress" ]; - lualine_z = [ "locations" ]; - }; - }; - - # - # ========= File Search ========= - # - plugins.telescope = { - # https://github.com/nvim-telescope/telescope.nvim - enable = true; - extensions.fzy-native.enable = true; - }; - - # ========= File Nav =========== - # - plugins.harpoon = { - enable = true; - keymaps = { - toggleQuickMenu = "b"; - }; - }; - - plugins.nvim-tree = { - enable = true; - view.width = { - min = 30; - max = -1; - padding = 1; - }; - disableNetrw = true; - filters.dotfiles = true; - - }; - - # - # ========== Dev Tools ========= - # - plugins.surround.enable = true; # vim-surround - - plugins.gitsigns = { - enable = true; - settings.signs.add = { - hl = "GitSignsAdd"; - text = " ▎"; - numhl = "GitSignsAddNr"; - linehl = "GitSignsAddLn"; - }; - settings.signs.change = { - hl = "GitSignsChange"; - text = " ▎"; - numhl = "GitSignsChangeNr"; - linehl = "GitSignsChangeLn"; - }; - settings.signs.delete = { - hl = "GitSignsDelete"; - text = " ●"; - numhl = "GitSignsDeleteNr"; - linehl = "GitSignsDeleteLn"; - }; - settings.signs.topdelete = { - hl = "GitSignsDelete"; - text = " ●"; - numhl = "GitSignsDeleteNr"; - linehl = "GitSignsDeleteLn"; - }; - settings.signs.changedelete = { - hl = "GitSignsChange"; - text = " ▎"; - numhl = "GitSignsChangeNr"; - linehl = "GitSignsChangeLn"; - }; - }; - - # Load Plugins that aren't provided as modules by nixvim - extraPlugins = builtins.attrValues { - inherit (pkgs.vimPlugins) - ale - vim-numbertoggle# Use relative number on focused buffer only - vimade# Dim unfocused buffers - vimwiki# Vim Wiki - YouCompleteMe# Code completion engine - vim-dadbod - vim-dadbod-ui - - # Keep vim-devicons as last entry - vim-devicons; - }; - - # ========= Mapleader ========= - globals.mapleader = ";"; - - # - # ========= Key binds ========= - # - keymaps = [ - # Switching windows - { - mode = [ "n" ]; - action = "h"; - key = ""; - options = { - silent = true; - }; - } - { - mode = [ "n" ]; - action = "j"; - key = ""; - options = { - silent = true; - }; - } - { - mode = [ "n" ]; - action = "k"; - key = ""; - options = { - silent = true; - }; - } - { - mode = [ "n" ]; - action = "l"; - key = ""; - options = { - silent = true; - }; - } - # Toggle nvim-tree - { - mode = [ "n" ]; - action = "NvimTreeFindFileToggle"; - key = "tt"; - options = { - silent = true; - }; - } - { - # clear search highlighting - mode = [ "n" ]; - key = ""; - action = "nohlsearch"; - options = { noremap = true; }; - } - - # ========== Telescope Plugin ========= - { - # find files - mode = [ "n" ]; - key = "ff"; - action = "Telescope find_files"; - options = { noremap = true; }; - } - { - # live grep - mode = [ "n" ]; - key = "fg"; - action = "Telescope live_grep"; - options = { noremap = true; }; - } - { - # buffers - mode = [ "n" ]; - key = "fb"; - action = "Telescope buffers"; - options = { noremap = true; }; - } - { - # help tags - mode = [ "n" ]; - key = "fh"; - action = "Telescope help_tags"; - options = { noremap = true; }; - } - - ]; - extraConfigVim = '' - " ================ Persistent Undo ================== - " Keep undo history across sessions, by storing in file. - " Only works all the time. - if has('persistent_undo') - silent !mkdir ~/.vim/backups > /dev/null 2>&1 - set undodir=~/.vim/backups - set undofile - endif - - " ================ Vim Wiki config ================= - " See :h vimwiki_list for info on registering wiki paths - let wiki_0 = {} - let wiki_0.path = '~/dotfiles.wiki/' - let wiki_0.index = 'home' - let wiki_0.syntax = 'markdown' - let wiki_0.ext = '.md' - - " fill spaces in page names with _ in pathing - let wiki_0.links_space_char = '_' - - " ================ Ale ======================== - " linter and fixer packages have to be installed via AUR or pamac - let g:ale_linters = { - \ 'c': ['clang-tidy'], - \ 'python': ['flake8'], - \ 'vim': ['vint'], - \ 'markdown': ['markdownlint'], - \ } - - let g:ale_fixers = { - \ 'c': ['clang-format'], - \ 'javascript': ['prettier', 'eslint'], - \ 'json': ['fixjson', 'prettier'], - \ 'python': ['black', 'isort'], - \ } - - " Set global fixers for all file types except Markdown - " Why? because double spaces at the end of a line in markdown indicate a - " linebreak without creating a new paragraph - function! SetGlobalFixers() - let g:ale_fixers['*'] = ['trim_whitespace', 'remove_trailing_lines'] - endfunction - - augroup GlobalFixers - autocmd! - autocmd VimEnter * call SetGlobalFixers() - augroup END - - " Set buffer-local fixers for Markdown files - augroup MarkdownFixers - autocmd! - autocmd FileType markdown let b:ale_fixers = ['prettier'] - augroup END - - let g:ale_fix_on_save = 1 - ''; - - }; -} diff --git a/home/common/core/nixvim/default.nix b/home/common/core/nixvim/default.nix new file mode 100644 index 0000000..32c6445 --- /dev/null +++ b/home/common/core/nixvim/default.nix @@ -0,0 +1,44 @@ +{ inputs, pkgs, ... }: { + imports = [ + inputs.nixvim.homeManagerModules.nixvim + ./plugins + ./options.nix + ./theme.nix + ./keymaps.nix + ]; + + # Install home packages needed for nixvim + home.packages = builtins.attrValues { + inherit (pkgs) + nixpkgs-fmt + prettierd + ; + }; + + programs.nixvim = { + enable = true; + enableMan = true; # install man pages for nixvim options + clipboard.register = "unnamedplus"; # use system clipboard instead of internal registers + globals.mapleader = ";"; + + extraConfigVim = '' + " ================ Persistent Undo ================== + " Keep undo history across sessions, by storing in file. + " Only works all the time. + if has('persistent_undo') + silent !mkdir ~/.vim/backups > /dev/null 2>&1 + set undodir=~/.vim/backups + set undofile + endif + + " ================ Vim Wiki config ================= + " See :h vimwiki_list for info on registering wiki paths + let wiki_0 = {} + let wiki_0.path = '~/docs/wiki/' + let wiki_0.index = 'home' + let wiki_0.syntax = 'markdown' + let wiki_0.ext = '.md' + ''; + + }; +} diff --git a/home/common/core/nixvim/keymaps.nix b/home/common/core/nixvim/keymaps.nix new file mode 100644 index 0000000..a206604 --- /dev/null +++ b/home/common/core/nixvim/keymaps.nix @@ -0,0 +1,85 @@ +{ + programs.nixvim.keymaps = [ + # Switching buffers + { + mode = [ "n" ]; + action = "h"; + key = ""; + options = { + silent = true; + }; + } + { + mode = [ "n" ]; + action = "j"; + key = ""; + options = { + silent = true; + }; + } + { + mode = [ "n" ]; + action = "k"; + key = ""; + options = { + silent = true; + }; + } + { + mode = [ "n" ]; + action = "l"; + key = ""; + options = { + silent = true; + }; + } + + # Toggle nvim-tree + { + mode = [ "n" ]; + action = "NvimTreeFindFileToggle"; + key = "tt"; + options = { + silent = true; + }; + } + + # Clear search highlighting + { + mode = [ "n" ]; + key = ""; + action = "nohlsearch"; + options = { noremap = true; }; + } + + # Telescope Plugin + { + # find files + mode = [ "n" ]; + key = "ff"; + action = "Telescope find_files"; + options = { noremap = true; }; + } + { + # live grep + mode = [ "n" ]; + key = "fg"; + action = "Telescope live_grep"; + options = { noremap = true; }; + } + { + # buffers + mode = [ "n" ]; + key = "fb"; + action = "Telescope buffers"; + options = { noremap = true; }; + } + { + # help tags + mode = [ "n" ]; + key = "fh"; + action = "Telescope help_tags"; + options = { noremap = true; }; + } + ]; +} diff --git a/home/common/core/nixvim/options.nix b/home/common/core/nixvim/options.nix new file mode 100644 index 0000000..4b11f93 --- /dev/null +++ b/home/common/core/nixvim/options.nix @@ -0,0 +1,35 @@ +{ + programs.nixvim.opts = { + background = ""; + number = true; # show line numbers + relativenumber = true; # show relative linenumbers + laststatus = 0; # Display status line always + history = 1000; # Store lots of :cmdline history + showcmd = true; # Show incomplete cmds down the bottom + showmode = true; # Show current mode down the bottom + autoread = true; # Reload files changed outside vim + lazyredraw = true; # Redraw only when needed + showmatch = true; # highlight matching braces + ruler = true; # show current line and column + visualbell = true; # No sounds + listchars = "trail:·"; # Display tabs and trailing spaces visually + autoindent = true; + cindent = true; # automatically indent braces + smartindent = true; + smarttab = true; + shiftwidth = 2; + softtabstop = 4; + tabstop = 2; + expandtab = true; + wildmode = "list:longest"; + wildmenu = true; # enable ctrl-n and ctrl-p to scroll thru matches + scrolloff = 4; # Start scrolling when we're 4 lines away from margins + sidescrolloff = 15; + sidescroll = 1; + incsearch = true; + hlsearch = true; + ignorecase = true; + smartcase = true; + backspace = "indent,eol,start"; # allow backspace in insert mode + }; +} diff --git a/home/common/core/nixvim/plugins/cmp.nix b/home/common/core/nixvim/plugins/cmp.nix new file mode 100644 index 0000000..44475cb --- /dev/null +++ b/home/common/core/nixvim/plugins/cmp.nix @@ -0,0 +1,119 @@ +{ + programs.nixvim.plugins = { + cmp-emoji = { enable = true; }; + cmp = { + enable = true; + settings = { + autoEnableSources = true; + experimental = { ghost_text = true; }; + performance = { + debounce = 60; + fetchingTimeout = 200; + maxViewEntries = 30; + }; + snippet = { expand = "luasnip"; }; + formatting = { + fields = [ "kind" "abbr" "menu" ]; + format = '' + function(entry, vim_item) + vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) + vim_item.menu = ({ + nvim_lsp = "[LSP]", + nvim_lua = "[Lua]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + ["vim-dadbod-completion"] = "[SQL-dadbod]" + })[entry.source.name] + return vim_item + end, + ''; + }; + sources = [ + { name = "nvim_lsp"; } + { name = "nvim_lua"; } + { name = "luasnip"; } + { name = "buffer"; } + { name = "path"; } + { name = "vim-dadbod-completion"; } + ]; + window = { + completion = { border = "solid"; }; + documentation = { border = "solid"; }; + }; + mapping = { + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.abort()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; + }; + }; + }; + cmp-nvim-lsp = { enable = true; }; # lsp + cmp-buffer = { enable = true; }; + cmp-path = { enable = true; }; # file system paths + cmp_luasnip = { enable = true; }; # snippets + cmp-cmdline = { enable = false; }; # autocomplete for cmdline + }; + programs.nixvim.extraConfigLua = '' + luasnip = require("luasnip") + kind_icons = { + Text = "󰊄", + Method = "", + Function = "󰡱", + Constructor = "", + Field = "", + Variable = "󱀍", + Class = "", + Interface = "", + Module = "󰕳", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", + } + + local cmp = require'cmp' + + -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({'/', "?" }, { + sources = { + { name = 'buffer' } + } + }) + + -- Set configuration for specific filetype. + cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. + }, { + { name = 'buffer' }, + }) + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }), + }) ''; +} diff --git a/home/common/core/nixvim/plugins/colorizer.nix b/home/common/core/nixvim/plugins/colorizer.nix new file mode 100644 index 0000000..1022d83 --- /dev/null +++ b/home/common/core/nixvim/plugins/colorizer.nix @@ -0,0 +1,6 @@ +{ + programs.nixvim.plugins.nvim-colorizer = { + enable = true; + fileTypes = [ "*" ]; + }; +} diff --git a/home/common/core/nixvim/plugins/conform.nix b/home/common/core/nixvim/plugins/conform.nix new file mode 100644 index 0000000..7e27ea0 --- /dev/null +++ b/home/common/core/nixvim/plugins/conform.nix @@ -0,0 +1,21 @@ +{ + programs.nixvim.plugins.conform-nvim = { + enable = true; + formatOnSave = { + lspFallback = true; + timeoutMs = 500; + }; + notifyOnError = true; + formattersByFt = { + html = [["prettierd" "prettier"]]; + css = [["prettierd" "prettier"]]; + javascript = [["prettierd" "prettier"]]; + python = ["black"]; + lua = ["stylua"]; + nix = ["alejandra"]; + markdown = [["prettierd" "prettier"]]; + yaml = ["yamllint" "yamlfmt"]; + sql = ["sqlfmt"]; + }; + }; +} diff --git a/home/common/core/nixvim/plugins/default.nix b/home/common/core/nixvim/plugins/default.nix new file mode 100644 index 0000000..6aafbd2 --- /dev/null +++ b/home/common/core/nixvim/plugins/default.nix @@ -0,0 +1,85 @@ +{ pkgs, ... }: +{ + imports = [ + ./cmp.nix + ./colorizer.nix + ./conform.nix + ./gitsigns.nix + ./harpoon.nix + ./lsp.nix + ./lualine.nix + ./luasnip.nix + ./nvim-tree.nix + ./surround.nix + ./telescope.nix + ./treesitter.nix + ]; + + # Load Plugins that aren't provided as modules by nixvim + programs.nixvim.extraPlugins = [ + pkgs.vimPlugins.vim-numbertoggle + pkgs.vimPlugins.vimwiki + pkgs.vimPlugins.vim-dadbod + pkgs.vimPlugins.vim-dadbod-ui + pkgs.vimPlugins.vim-dadbod-completion + + # Keep vim-devicons as last entry + pkgs.vimPlugins.vim-devicons + (pkgs.vimUtils.buildVimPlugin + { + name = "buffer_manager.nvim"; + src = pkgs.fetchFromGitHub { + owner = "j-morano"; + repo = "buffer_manager.nvim"; + rev = "fd36131"; + sha256 = "sha256-abe9ZGmL7U9rC+LxC3LO5/bOn8lHke1FCKO0V3TZGs0="; + }; + }) + ]; + programs.nixvim.extraConfigLua = '' + -- buffer_manager.nvim + local opts = {noremap = true} + + require("buffer_manager").setup( + { + line_keys = "1234567890", + select_menu_item_commands = { + edit = { + key = "", + command = "edit" + } + }, + focus_alternate_buffer = true, + short_file_names = false, + short_term_names = true, + height = 15, + width = 0.8, + loop_nav = true, + highlight = "", + win_extra_options = {}, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + order_buffers = "lastused", + show_indicators = "before", + } + ) + + -- Custom color for modified buffers + vim.api.nvim_set_hl(0, "BufferManagerModified", { fg = "#988100" }) + + local bmui = require("buffer_manager.ui") + vim.keymap.set('n', 'b', bmui.toggle_quick_menu, opts) + vim.keymap.set('n', 'n', bmui.nav_next, opts) + vim.keymap.set('n', 'p', bmui.nav_prev, opts) + + local keys="1234567890" + for i = 1, #keys do + local key = keys:sub(i,i) + vim.keymap.set('n', string.format('%s', key), + function () bmui.nav_file(i) end, + opts + ) + end + ''; + +} + diff --git a/home/common/core/nixvim/plugins/gitsigns.nix b/home/common/core/nixvim/plugins/gitsigns.nix new file mode 100644 index 0000000..d488015 --- /dev/null +++ b/home/common/core/nixvim/plugins/gitsigns.nix @@ -0,0 +1,35 @@ +{ + programs.nixvim.plugins.gitsigns = { + enable = true; + settings.signs.add = { + hl = "GitSignsAdd"; + text = " ▎"; + numhl = "GitSignsAddNr"; + linehl = "GitSignsAddLn"; + }; + settings.signs.change = { + hl = "GitSignsChange"; + text = " ▎"; + numhl = "GitSignsChangeNr"; + linehl = "GitSignsChangeLn"; + }; + settings.signs.delete = { + hl = "GitSignsDelete"; + text = " ●"; + numhl = "GitSignsDeleteNr"; + linehl = "GitSignsDeleteLn"; + }; + settings.signs.topdelete = { + hl = "GitSignsDelete"; + text = " ●"; + numhl = "GitSignsDeleteNr"; + linehl = "GitSignsDeleteLn"; + }; + settings.signs.changedelete = { + hl = "GitSignsChange"; + text = " ▎"; + numhl = "GitSignsChangeNr"; + linehl = "GitSignsChangeLn"; + }; + }; +} diff --git a/home/common/core/nixvim/plugins/harpoon.nix b/home/common/core/nixvim/plugins/harpoon.nix new file mode 100644 index 0000000..0080b57 --- /dev/null +++ b/home/common/core/nixvim/plugins/harpoon.nix @@ -0,0 +1,8 @@ +{ + programs.nixvim.plugins.harpoon = { + enable = true; + keymaps = { + toggleQuickMenu = "h"; + }; + }; +} diff --git a/home/common/core/nixvim/plugins/lsp.nix b/home/common/core/nixvim/plugins/lsp.nix new file mode 100644 index 0000000..9e6c7d2 --- /dev/null +++ b/home/common/core/nixvim/plugins/lsp.nix @@ -0,0 +1,51 @@ +{ + programs.nixvim.plugins.lsp = { + enable = true; + servers = { + lua-ls = {enable = true;}; + nixd = {enable = true;}; + bashls = {enable = true;}; + pyright = {enable = true;}; + html = {enable = true;}; + yamlls = {enable = true;}; + marksman = {enable = true;}; + #sqls = {enable = true;}; + }; + keymaps = { + lspBuf = { + gd = { + action = "definition"; + desc = "Goto Definition"; + }; + gr = { + action = "references"; + desc = "Goto References"; + }; + gD = { + action = "declaration"; + desc = "Goto Declaration"; + }; + gI = { + action = "implementation"; + desc = "Goto Implementation"; + }; + gT = { + action = "type_definition"; + desc = "Type Definition"; + }; + K = { + action = "hover"; + desc = "Hover"; + }; + "cw" = { + action = "workspace_symbol"; + desc = "Workspace Symbol"; + }; + "cr" = { + action = "rename"; + desc = "Rename"; + }; + }; + }; + }; +} diff --git a/home/common/core/nixvim/plugins/lspkind.nix b/home/common/core/nixvim/plugins/lspkind.nix new file mode 100644 index 0000000..8d7e15a --- /dev/null +++ b/home/common/core/nixvim/plugins/lspkind.nix @@ -0,0 +1,13 @@ +{ + # Add tiny pictograms to lsp + programs.nixvim.plugins.lspkind = { + enable = true; + symbolMap = { + Copilot = ""; + }; + extraOptions = { + maxwidth = 50; + ellipsis_char = "..."; + }; + }; +} diff --git a/home/common/core/nixvim/plugins/lualine.nix b/home/common/core/nixvim/plugins/lualine.nix new file mode 100644 index 0000000..f450ec9 --- /dev/null +++ b/home/common/core/nixvim/plugins/lualine.nix @@ -0,0 +1,22 @@ +{ + programs.nixvim.plugins.lualine = { + enable = true; + theme = "auto"; + componentSeparators = { + left = ""; + right = ""; + }; + sectionSeparators = { + left = ""; + right = ""; + }; + sections = { + lualine_a = [ "mode" ]; + lualine_b = [ "branch" "diff" "diagnostics" ]; + lualine_c = [ "filename" ]; + lualine_x = [ "encoding" "fileformat" "filetype" ]; + lualine_y = [ "progress" ]; + lualine_z = [ "locations" ]; + }; + }; +} diff --git a/home/common/core/nixvim/plugins/luasnip.nix b/home/common/core/nixvim/plugins/luasnip.nix new file mode 100644 index 0000000..ef93822 --- /dev/null +++ b/home/common/core/nixvim/plugins/luasnip.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: { + programs.nixvim.plugins.luasnip = { + enable = true; + extraConfig = { + enable_autosnippets = true; + store_selection_keys = ""; + }; + fromVscode = [ + { + lazyLoad = true; + paths = "${pkgs.vimPlugins.friendly-snippets}"; + } + ]; + }; +} diff --git a/home/common/core/nixvim/plugins/nvim-tree.nix b/home/common/core/nixvim/plugins/nvim-tree.nix new file mode 100644 index 0000000..1b55649 --- /dev/null +++ b/home/common/core/nixvim/plugins/nvim-tree.nix @@ -0,0 +1,12 @@ +{ + programs.nixvim.plugins.nvim-tree = { + enable = true; + view.width = { + min = 30; + max = -1; + padding = 1; + }; + disableNetrw = true; + filters.dotfiles = true; + }; +} diff --git a/home/common/core/nixvim/plugins/surround.nix b/home/common/core/nixvim/plugins/surround.nix new file mode 100644 index 0000000..cfee34b --- /dev/null +++ b/home/common/core/nixvim/plugins/surround.nix @@ -0,0 +1,3 @@ +{ + programs.nixvim.plugins.surround.enable = true; # vim-surround +} diff --git a/home/common/core/nixvim/plugins/telescope.nix b/home/common/core/nixvim/plugins/telescope.nix new file mode 100644 index 0000000..9582b09 --- /dev/null +++ b/home/common/core/nixvim/plugins/telescope.nix @@ -0,0 +1,6 @@ +{ + programs.nixvim.plugins.telescope = { + enable = true; + extensions.fzy-native.enable = true; + }; +} diff --git a/home/common/core/nixvim/plugins/treesitter.nix b/home/common/core/nixvim/plugins/treesitter.nix new file mode 100644 index 0000000..511d73a --- /dev/null +++ b/home/common/core/nixvim/plugins/treesitter.nix @@ -0,0 +1,5 @@ +{ + programs.nixvim.plugins.treesitter = { + enable = true; + }; +} diff --git a/home/common/core/nixvim/theme.nix b/home/common/core/nixvim/theme.nix new file mode 100644 index 0000000..7dd7112 --- /dev/null +++ b/home/common/core/nixvim/theme.nix @@ -0,0 +1,15 @@ +{ + programs.nixvim.colorschemes.kanagawa = { + enable = true; + settings = { + commentStyle = { + italic = true; + }; + dimInactive = true; + terminalColors = true; + theme = "wave"; + transparent = true; + undercurl = true; + }; + }; +} diff --git a/home/common/core/zsh.nix b/home/common/core/zsh.nix index 9facad2..c0cba1b 100644 --- a/home/common/core/zsh.nix +++ b/home/common/core/zsh.nix @@ -5,15 +5,15 @@ enableCompletion = true; autosuggestion.enable = true; syntaxHighlighting.enable = true; - + shellAliases = { ll = "ls -l"; }; history.size = 10000; history.path = "${config.xdg.dataHome}/zsh/history"; - initExtra = '' - bindkey -v + initExtra = '' + bindkey -v bindkey "^H" backward-delete-char bindkey "^?" backward-delete-char set -o vi @@ -22,11 +22,11 @@ if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then SESSION_TYPE="(ssh) " fi - + #### # Format prompt #### - + # Define colors COLOR_RED="red" COLOR_MAGENTA="92" @@ -34,20 +34,20 @@ COLOR_GREEN="36" COLOR_BLUE="4" COLOR_WHITE="7" - + # Format git colors autoload -Uz compinit && compinit autoload -Uz add-zsh-hook autoload -Uz vcs_info add-zsh-hook precmd vcs_info - + zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' formats " %F{cyan}%c%u(%b)%f" zstyle ':vcs_info:*' actionformats " %F{cyan}%c%u(%b)%f %a" zstyle ':vcs_info:*' stagedstr "%F{$COLOR_RED}" zstyle ':vcs_info:*' unstagedstr "%F{$COLOR_RED}" zstyle ':vcs_info:*' check-for-changes true - + zstyle ':vcs_info:git*+set-message:*' hooks git-untracked +vi-git-untracked() { if git --no-optional-locks status --porcelain 2> /dev/null | grep -q "^??"; then @@ -58,7 +58,7 @@ hook_com[staged]+="%F{$COLOR_GREEN}" fi } - + # Format prompt setopt PROMPT_SUBST PROMPT='%F{'$COLOR_GREEN'}'$(echo "$SESSION_TYPE")''' @@ -77,11 +77,28 @@ setopt autocd # Automatically cd into typed directory. stty stop undef # Disable ctrl-s to freeze terminal. setopt interactive_comments - + # General opts HISTSIZE=10000000 SAVEHIST=10000000 setopt appendhistory + + # Change cursor shape for different vi modes. + function zle-keymap-select () { + case $KEYMAP in + vicmd) echo -ne '\e[1 q';; # block + viins|main) echo -ne '\e[5 q';; # beam + esac + } + zle -N zle-keymap-select + zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" + } + zle -N zle-line-init + echo -ne '\e[5 q' # Use beam shape cursor on startup. + preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. + ''; }; -} +} diff --git a/home/common/optional/desktop/common/alacritty.nix b/home/common/optional/desktop/common/alacritty.nix new file mode 100644 index 0000000..075811c --- /dev/null +++ b/home/common/optional/desktop/common/alacritty.nix @@ -0,0 +1,51 @@ +{ config, pkgs, ... }: +{ + programs.alacritty = { + enable = true; + settings = { + + colors = with config.colorScheme.palette; { + bright = { + black = "0x${base03}"; + blue = "0x${base04}"; + cyan = "0x${base0F}"; + green = "0x${base01}"; + magenta = "0x${base06}"; + red = "0x${base09}"; + white = "0x${base07}"; + yellow = "0x${base02}"; + }; + cursor = { + cursor = "0x${base05}"; + text = "0x${base00}"; + }; + normal = { + black = "0x${base00}"; + blue = "0x${base0D}"; + cyan = "0x${base0C}"; + green = "0x${base0B}"; + magenta = "0x${base0E}"; + red = "0x${base08}"; + white = "0x${base05}"; + yellow = "0x${base0A}"; + }; + primary = { + background = "0x${base00}"; + foreground = "0x${base05}"; + }; + }; + + window = { + padding = { + x = 5; + y = 5; + }; + blur = true; + opacity = 0.9; + }; + + shell.program = "${pkgs.zsh}/bin/zsh"; + + }; + }; +} diff --git a/home/common/optional/desktop/common/default.nix b/home/common/optional/desktop/common/default.nix index f349273..15bf3dc 100644 --- a/home/common/optional/desktop/common/default.nix +++ b/home/common/optional/desktop/common/default.nix @@ -1,12 +1,16 @@ -{pkgs, ... }: { +{ pkgs, ... }: { imports = [ ./firefox.nix + ./alacritty.nix ]; + # Global packages for desktop environments home.packages = [ - pkgs.kitty + pkgs.alacritty + pkgs.libnotify pkgs.zathura pkgs.xfce.thunar - pkgs.wofi + pkgs.kcolorchooser + pkgs.zotero ]; } diff --git a/home/common/optional/desktop/hyprland/default.nix b/home/common/optional/desktop/hyprland/default.nix index a431480..524fd37 100644 --- a/home/common/optional/desktop/hyprland/default.nix +++ b/home/common/optional/desktop/hyprland/default.nix @@ -1,29 +1,31 @@ -{ - lib, - config, - pkgs, - ... +{ lib +, config +, pkgs +, ... }: { imports = [ - ../wallpaper-changer/swww-wallpaper-changer ../common - ../waybar.nix + ../wayland ]; wayland.windowManager.hyprland = { enable = true; systemd = { - variables = ["--all"]; - enable = true; - # Same as default, but stop graphical-session too - extraCommands = lib.mkBefore [ - "systemctl --user stop graphical-session.target" - "systemctl --user start hyprland-session.target" - ]; + variables = [ "--all" ]; + enable = true; + # Same as default, but stop graphical-session too + extraCommands = lib.mkBefore [ + "systemctl --user stop graphical-session.target" + "systemctl --user start hyprland-session.target" + ]; }; - extraConfig = let - monitor = "${toString (builtins.map (m: "monitor=${ m.name },${ toString( m.width ) }x${ toString( m.height ) }@${ toString( m.refreshRate ) },${ toString( m.x ) }x${ toString( m.y ) },${ toString( m.scale ) }\n") config.monitors)}"; - in '' + extraConfig = + let + monitor = "${toString (builtins.map (m: "monitor=${ m.name },${ toString( m.width ) }x${ toString( m.height ) }@${ toString( m.refreshRate ) },${ toString( m.x ) }x${ toString( m.y ) },${ toString( m.scale ) }\n") config.monitors)}"; + active = "rgba(${config.colorScheme.colors.base08}ee)"; + inactive = "rgba(${config.colorScheme.colors.base0C}ee)"; + in + '' ${monitor} $terminal = alacritty @@ -36,11 +38,10 @@ kb_layout = gb kb_variant = kb_model = - kb_options = caps:swapescape kb_rules = - + repeat_delay = 280 + repeat_rate = 60 follow_mouse = 1 - touchpad { natural_scroll = no } @@ -49,20 +50,18 @@ general { - gaps_in = 5 - gaps_out = 20 + gaps_in = 10 + gaps_out = 10 border_size = 2 - col.active_border = #22ff00 - col.inactive_border = #aecbb4 - + col.active_border = ${active} + col.inactive_border = ${inactive} layout = dwindle - allow_tearing = false } decoration { - rounding = 10 + rounding = 5 blur { enabled = true @@ -113,18 +112,17 @@ $mainMod = SUPER - bind = $mainMod, Q, exec, $terminal - bind = $mainMod, C, killactive, + bind = $mainMod, RETURN, exec, $terminal + bind = $mainMod, Q, killactive, bind = $mainMod, M, exit, bind = $mainMod, E, exec, $fileManager bind = $mainMod, V, togglefloating, bind = $mainMod, R, exec, $menu - bind = $mainMod, S, exec, rofi -show drun -show-icons - bind = $mainMod, left, movefocus, l - bind = $mainMod, right, movefocus, r - bind = $mainMod, up, movefocus, u - bind = $mainMod, down, movefocus, d + bind = $mainMod, h, movefocus, l + bind = $mainMod, l, movefocus, r + bind = $mainMod, k, movefocus, u + bind = $mainMod, j, movefocus, d bind = $mainMod, 1, workspace, 1 bind = $mainMod, 2, workspace, 2 @@ -157,7 +155,7 @@ bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow - exec-once=bash ~/.config/hypr/start.sh + exec-once=swww-wallpaper-changer ''; - }; - } + }; +} diff --git a/home/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/default.nix b/home/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/default.nix deleted file mode 100644 index 3ca13d1..0000000 --- a/home/common/optional/desktop/wallpaper-changer/swww-wallpaper-changer/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - pkgs, - ... -}: -{ - systemd.user.services.wallpaper-changer = { - Unit = { - Description = "Script to change wallpaper using swww"; - PartOf = [ "hyprland-session.target" ]; - After = [ "hyprland-session.target" ]; # or "wayland.target", depending on your system setup - }; - Install = { - WantedBy = [ "default.target" ]; - }; - Service = { - Type = [ "oneshot" ]; - ExecStart = "${pkgs.writeShellScript "swww-wallpaper-changer" '' - export WAYLAND_DISPLAY="wayland-1" - wallpaper_dir="$HOME/.local/share/bg/" - - # Allow some time for desktop to start - sleep 3 - echo "starting daemon..." - ${pkgs.swww}/bin/swww-daemon & - - while true; do - find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do - ${pkgs.swww}/bin/swww img "$file" --transition-step 10 --transition-fps 60 - [ $? != 0 ] && echo "swww failed, reloading daemon" && ${pkgs.swww}/bin/swww-daemon & - sleep 600 - done - done - ''}"; - }; - }; -} diff --git a/home/common/optional/desktop/waybar.nix b/home/common/optional/desktop/waybar.nix deleted file mode 100644 index f0175b6..0000000 --- a/home/common/optional/desktop/waybar.nix +++ /dev/null @@ -1,220 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: { - # Let it try to start a few more times - systemd.user.services.waybar = { - Unit.StartLimitBurst = 30; - }; - programs.waybar = { - enable = true; - systemd.enable = true; - - settings = { - primary = { - mode = "dock"; - height = 30; - margin = "6"; - spacing = 5; - modules-left = [ - "custom/menu" - "wlr/workspaces"]; - modules-center = [ - "clock" - ]; - modules-right = [ - "cpu" - "memory" - "network" - "pulseaudio" - "battery" - "tray" - "custom/exit" - "custom/hostname" - ]; - "wlr/workspaces" = { - "format" = "{icon}"; - "on-click" = "activate"; - "format-icons"= { - "1" = ""; - "2" = ""; - "3" = ""; - "4" = ""; - "5" = ""; - "urgent" = ""; - "active" = ""; - "default" = ""; - }; - }; - "clock" = { - "format" = "{:%m/%d %H:%M}"; - "tooltip-format" = "{:%B %Y}\n{calendar}"; - "on-click" = "calendar"; - }; - "cpu"= { - "interval" = 10; - "format" = " {}%"; - "max-length" = 10; - "on-click" = ""; - }; - "memory" = { - "interval" = 30; - "format" = " {}%"; - "format-alt" = " {used:0.1f}G"; - "max-length" = 10; - }; - - "network" = { - "format-wifi" = "直 {signalStrength}%"; - "format-ethernet" = " wired"; - "format-disconnected" = "睊"; - "on-click" = "bash ~/.config/waybar/scripts/rofi-wifi-menu.sh"; - }; - - "battery" = { - "bat" = "BAT0"; - "adapter" = "ADP0"; - "interval" = 60; - "states" = { - "warning" = 30; - "critical" = 15; - }; - "max-length" = 20; - "format" = "{icon} {capacity}%"; - "format-warning" = "{icon} {capacity}%"; - "format-critical" = "{icon} {capacity}%"; - "format-charging" = " {capacity}%"; - "format-plugged" = " {capacity}%"; - "format-alt" = "{icon} {time}"; - "format-full" = " {capacity}%"; - "format-icons" = [" " " " " " " " " "]; - }; - - "tray" = { - "spacing" = 10; - }; - - "custom/menu" = { - "format" = ""; - "on-click" = "rofi -show drun"; - }; - - "custom/hostname" = { - "exec" = "echo $USER@$(hostname)"; - "on-click" = "alacritty"; - }; - - "custom/exit" = { - "format" = ""; - "on-click" = "wlogout"; - }; - - "pulseaudio" = { - "format" = "{icon} {volume}%"; - "format-muted" = " 0%"; - "format-icons" = { - "headphone" = ""; - "headset" = ""; - "portable" = ""; - "default" = [ "" "" "" ]; - }; - "on-click" = "pavucontrol"; - }; - - }; - }; - - style = '' - * { - font-family: JetBrainsMono Nerd Font; - font-size: 12pt; - padding: 0 8px; - } - .modules-right { - margin-right: -15px; - } - .modules-left { - margin-left: -15px; - } - window#waybar { - color: white; - background-color: #002635; - opacity: 0.95; - padding: 0; - border-radius: 10px; - } - window#waybar.bottom { - opacity: 0.90; - background-color: #002635; - border: 2px solid #14747e; - border-radius: 10px; - } - - #workspaces button { - padding: 0 5px; - color: #7984A4; - background-color: transparent; - box-shadow: inset 0 -3px transparent; - border: none; - border-radius: 0; - } - #workspaces button.hidden { - background-color: #002635; - color: #869696; - } - #workspaces button.focused { - color: #bf616a; - } - - #workspaces button.active { - color: #6a92d7; - } - - #workspaces button.urgent { - background-color: #eb4d4b; - } - - #clock { - padding-left: 15px; - padding-right: 15px; - margin-top: 0; - margin-bottom: 0; - border-radius: 10px; - } - - #tray { - color: #a1a19a; - } - - #custom-hostname { - background-color: white; - color: #002635; - padding-left: 15px; - padding-right: 18px; - margin-right: 0; - margin-top: 0; - margin-bottom: 0; - border-radius: 10px; - } - - - #custom-menu { - font-size: 16pt; - background-color: white; - color: #002635; - padding-left: 15px; - padding-right: 22px; - margin-left: 0; - margin-right: 10px; - margin-top: 0; - margin-bottom: 0; - border-radius: 10px; - } - - ''; - }; - - -} diff --git a/home/common/optional/desktop/wayland/default.nix b/home/common/optional/desktop/wayland/default.nix new file mode 100644 index 0000000..c7e1bc7 --- /dev/null +++ b/home/common/optional/desktop/wayland/default.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: +{ + imports = [ + ./mako.nix + ./waybar.nix + ./swww-wallpaper-changer.nix + ]; + + home.packages = [ + pkgs.wofi + pkgs.wl-clipboard + ]; +} diff --git a/home/common/optional/desktop/wayland/mako.nix b/home/common/optional/desktop/wayland/mako.nix new file mode 100644 index 0000000..77db759 --- /dev/null +++ b/home/common/optional/desktop/wayland/mako.nix @@ -0,0 +1,12 @@ +{ pkgs, config, ... }: +{ + services.mako = { + enable = true; + backgroundColor = "#${config.colorScheme.colors.base00}"; + borderColor = "#${config.colorScheme.colors.base0D}"; + borderRadius = 5; + borderSize = 2; + textColor = "#${config.colorScheme.colors.base05}"; + layer = "overlay"; + }; +} diff --git a/home/common/optional/desktop/wayland/swww-wallpaper-changer.nix b/home/common/optional/desktop/wayland/swww-wallpaper-changer.nix new file mode 100644 index 0000000..af7d4b4 --- /dev/null +++ b/home/common/optional/desktop/wayland/swww-wallpaper-changer.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "swww-wallpaper-changer" '' + export WAYLAND_DISPLAY="wayland-1" + wallpaper_dir="$HOME/.local/share/bg/" + [ -d "$wallpaper_dir" ] || mkdir -p "$wallpaper_dir" + ${swww}/bin/swww-daemon & + + while true; do + find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do + ${swww}/bin/swww img "$file" --transition-step 10 --transition-fps 60 + [ $? != 0 ] && echo "swww failed, exiting" && exit 1 + sleep 600 + done + done + '') + ]; +} diff --git a/home/common/optional/desktop/wayland/waybar.nix b/home/common/optional/desktop/wayland/waybar.nix new file mode 100644 index 0000000..d32118e --- /dev/null +++ b/home/common/optional/desktop/wayland/waybar.nix @@ -0,0 +1,230 @@ +{ lib +, config +, pkgs +, ... +}: { + # Let it try to start a few more times + systemd.user.services.waybar = { + Unit.StartLimitBurst = 30; + }; + programs.waybar = { + enable = true; + systemd.enable = true; + + settings = { + primary = { + mode = "dock"; + height = 30; + margin = "6"; + spacing = 5; + modules-left = [ + "custom/menu" + "hyprland/workspaces" + "hyprland/window" + ]; + + modules-center = [ + "clock" + ]; + + modules-right = [ + "cpu" + "memory" + "network" + "pulseaudio" + "battery" + "tray" + "custom/exit" + "custom/hostname" + "custom/ip" + ]; + + "hyprland/window" = { + "format" = "{}"; + "rewrite" = { + "(.*) — Mozilla Firefox" = "$1"; + }; + "separate-outputs" = true; + }; + + "hyprland/workspaces" = { + "format" = "{name}"; + "on-click" = "activate"; + "format-icons" = { + "urgent" = ""; + "active" = ""; + "default" = ""; + }; + }; + + "clock" = { + "format" = "{:%y-%m-%d %H:%M:%S}"; + "tooltip-format" = "{:%B %Y}\n{calendar}"; + "on-click" = "calendar"; + }; + + "cpu" = { + "interval" = 10; + "format" = " {}%"; + "max-length" = 10; + "on-click" = ""; + }; + + "memory" = { + "interval" = 30; + "format" = " {}%"; + "format-alt" = " {used:0.1f}G"; + "max-length" = 10; + }; + + "network" = { + "format-wifi" = "直 {signalStrength}%"; + "format-ethernet" = " wired ({ipaddr})"; + "format-disconnected" = "睊"; + }; + + "battery" = { + "bat" = "BAT0"; + "adapter" = "ADP0"; + "interval" = 60; + "states" = { + "warning" = 30; + "critical" = 15; + }; + "max-length" = 20; + "format" = "{icon} {capacity}%"; + "format-warning" = "{icon} {capacity}%"; + "format-critical" = "{icon} {capacity}%"; + "format-charging" = " {capacity}%"; + "format-plugged" = " {capacity}%"; + "format-alt" = "{icon} {time}"; + "format-full" = " {capacity}%"; + "format-icons" = [ " " " " " " " " " " ]; + }; + + "tray" = { + "spacing" = 10; + }; + + "custom/menu" = { + "format" = " Nixos"; + "on-click" = "wofi --show drun"; + }; + + "custom/hostname" = { + "exec" = "echo $USER@$(hostname)"; + "on-click" = "$TERMINAL"; + }; + + "custom/exit" = { + "format" = ""; + "on-click" = "wlogout"; + }; + + "pulseaudio" = { + "format" = "{icon} {volume}%"; + "format-muted" = " 0%"; + "format-icons" = { + "headphone" = ""; + "headset" = ""; + "portable" = ""; + "default" = [ "" "" "" ]; + }; + "on-click" = "pavucontrol"; + }; + + }; + }; + + style = '' + * { + font-family: JetBrainsMono Nerd Font; + font-size: 12pt; + padding: 0 8px; + } + .modules-right { + margin-right: -15px; + } + .modules-left { + margin-left: -15px; + } + window#waybar { + color: white; + background-color: #002635; + opacity: 0.95; + padding: 0; + border-radius: 10px; + } + window#waybar.bottom { + opacity: 0.90; + background-color: #002635; + border: 2px solid #14747e; + border-radius: 10px; + } + + #workspaces button { + padding: 0 5px; + color: #7984A4; + background-color: transparent; + box-shadow: inset 0 -3px transparent; + border: none; + border-radius: 0; + } + #workspaces button.hidden { + background-color: #002635; + color: #869696; + } + #workspaces button.focused { + color: #bf616a; + } + + #workspaces button.active { + color: #6a92d7; + } + + #workspaces button.urgent { + background-color: #eb4d4b; + } + + #clock { + padding-left: 15px; + padding-right: 15px; + margin-top: 0; + margin-bottom: 0; + border-radius: 10px; + } + + #tray { + color: #a1a19a; + } + + #custom-hostname { + background-color: white; + color: #002635; + padding-left: 15px; + padding-right: 18px; + margin-right: 0; + margin-top: 0; + margin-bottom: 0; + border-radius: 10px; + } + + + #custom-menu { + font-size: 16pt; + background-color: white; + color: #002635; + padding-left: 15px; + padding-right: 22px; + margin-left: 0; + margin-right: 10px; + margin-top: 0; + margin-bottom: 0; + border-radius: 10px; + } + + ''; + }; + + +} diff --git a/home/common/optional/sops.nix b/home/common/optional/sops.nix index 345bafd..935bd1e 100644 --- a/home/common/optional/sops.nix +++ b/home/common/optional/sops.nix @@ -1,10 +1,9 @@ -{ inputs, config, osConfig, ... }: +{ inputs, config, ... }: let secretsDirectory = builtins.toString inputs.nix-secrets; secretsFile = "${secretsDirectory}/secrets.yaml"; homeDirectory = config.home.homeDirectory; username = config.home.username; - hostname = osConfig.networking.hostName; in { imports = [ @@ -12,11 +11,18 @@ in ]; sops = { - age.sshKeyPaths = ["${homeDirectory}/.ssh/id_ed25519"]; + age = { + sshKeyPaths = [ "${homeDirectory}/.ssh/id_ed25519" ]; + generateKey = true; + keyFile = "/home/${username}/.config/sops/age/keys.txt"; + }; defaultSopsFile = "${secretsFile}"; validateSopsFiles = false; - secrets."ssh_keys/deploy_key/id_ed25519" = { - path = "/home/${username}/.ssh/deploy_key-ssh-ed25519"; - }; + + secrets = { + "ssh_keys/deploy_key/id_ed25519" = { + path = "/home/${username}/.ssh/deploy_key-ssh-ed25519"; + }; + }; }; } diff --git a/home/semita.nix b/home/semita.nix index b5e71b1..c610e9b 100644 --- a/home/semita.nix +++ b/home/semita.nix @@ -1,8 +1,5 @@ -{ - pkgs, - config, - lib, - ... +{ inputs +, ... }: { imports = [ # Import users @@ -18,27 +15,23 @@ ]; - home.packages = [ - pkgs.alacritty - pkgs.zathura - pkgs.xfce.thunar - ]; + colorScheme = inputs.nix-colors.colorSchemes.kanagawa; monitors = [ { - name = "Virtual-1"; - width = 1920; + name = "DP-1"; + width = 2560; height = 1440; - refreshRate = 75; + refreshRate = 144; x = 0; primary = true; } { - name = "Virtual-2"; - width = 1920; + name = "DP-2"; + width = 2560; height = 1440; refreshRate = 75; - x = 1920; + x = 2560; } ]; } diff --git a/home/sparky.nix b/home/sparky.nix index fec9160..8b938dd 100644 --- a/home/sparky.nix +++ b/home/sparky.nix @@ -1,15 +1,11 @@ -{ - pkgs, - config, - lib, - ... +{ inputs +, ... }: { imports = [ # Import users ./users/media ./common/core - ./common/optional/sops.nix # Import optional ./common/optional/git.nix @@ -17,4 +13,6 @@ ./common/optional/desktop/cinnamon ]; + + colorScheme = inputs.nix-colors.colorSchemes.kanagawa; } diff --git a/home/users/sam/default.nix b/home/users/sam/default.nix index 05ea141..beeb764 100644 --- a/home/users/sam/default.nix +++ b/home/users/sam/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, outputs, ... }: +{ pkgs, outputs, ... }: { home.username = "sam"; @@ -16,8 +16,8 @@ enable = true; matchBlocks = { "git.bitlab21.com" = { - identitiesOnly = true; - identityFile = [ "~/.ssh/id_ed25519"]; + identitiesOnly = true; + identityFile = [ "~/.ssh/id_ed25519" ]; }; }; }; @@ -25,7 +25,7 @@ home.sessionPath = [ ]; - xdg.userDirs = { + xdg.userDirs = { enable = true; createDirectories = true; desktop = null; @@ -55,11 +55,11 @@ qt.style.package = pkgs.adwaita-qt; home.sessionVariables = { - EDITOR="nvim"; - TERMINAL="alacritty"; - READER="zathura"; - IMAGE_VIEWER=""; - IMAGE_EDITOR=""; + EDITOR = "nvim"; + TERMINAL = "alacritty"; + READER = "zathura"; + IMAGE_VIEWER = ""; + IMAGE_EDITOR = ""; }; } diff --git a/hosts/common/optional/pipewire.nix b/hosts/common/optional/pipewire.nix index fb0fbd8..26948ee 100644 --- a/hosts/common/optional/pipewire.nix +++ b/hosts/common/optional/pipewire.nix @@ -1,17 +1,18 @@ { pkgs, ... }: { sound.enable = true; - hardware.pulseaudio.enable = false; + hardware.pulseaudio.enable = true; security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; + hardware.pulseaudio.package = pkgs.pulseaudioFull; +# services.pipewire = { +# enable = true; +# alsa.enable = true; # alsa.support32Bit = true; - pulse.enable = true; - wireplumber.enable = true; - jack.enable = true; - - }; +# pulse.enable = true; +# wireplumber.enable = true; +# jack.enable = true; +# +# }; environment.systemPackages = [ pkgs.pamixer diff --git a/hosts/common/users/media/default.nix b/hosts/common/users/media/default.nix index 8ed72dd..3a8f470 100644 --- a/hosts/common/users/media/default.nix +++ b/hosts/common/users/media/default.nix @@ -16,9 +16,9 @@ in openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key); extraGroups = - [ - "wheel" - ]; + [ + "wheel" + ]; packages = with pkgs; [ flatpak @@ -28,19 +28,20 @@ in environment.persistence."/persist" = { hideMounts = true; - users.${username}= { - directories = [ - "Sync" - "Keep" - ".ssh" - ".config/dconf" - ".config/cinnamon" - ".config/nemo" - ".mozilla" - ".local" - ]; - files = [ - ]; + users.${username} = { + directories = [ + "Sync" + "Keep" + ".ssh" + ".config/dconf" + ".config/cinnamon" + ".config/nemo" + ".mozilla" + ".local" + ]; + files = [ + ".config/cinnamon-monitors.xml" + ]; }; }; @@ -53,7 +54,7 @@ in path = "/home/${username}/.ssh/id_ed25519"; mode = "0600"; owner = "${username}"; - }; + }; "ssh_keys/${username}/id_ed25519.pub" = { path = "/home/${username}/.ssh/id_ed25519.pub"; mode = "0644"; @@ -61,6 +62,20 @@ in }; }; + # The containing ssh folders are created as root and if this is the first ~/.ssh/ entry when writing keys, + # the ownership is busted and home-manager can't target because it can't write into .ssh... + # FIXME: We might not need this depending on how https://github.com/Mic92/sops-nix/issues/381 is fixed + system.activationScripts.sopsSetSshOwnwership = + let + sshFolder = "/home/${username}/.ssh"; + user = config.users.users.${username}.name; + group = config.users.users.${username}.group; + in + '' + mkdir -p ${sshFolder} || true + chown -R ${user}:${group} /home/${username}/.ssh + ''; + services.flatpak.enable = true; programs.zsh.enable = true; diff --git a/hosts/common/users/sam/default.nix b/hosts/common/users/sam/default.nix index c2f3672..4ee6230 100644 --- a/hosts/common/users/sam/default.nix +++ b/hosts/common/users/sam/default.nix @@ -29,14 +29,54 @@ in path = "/home/${username}/.ssh/id_ed25519"; mode = "0600"; owner = "${username}"; - }; + }; "ssh_keys/${username}/id_ed25519.pub" = { path = "/home/${username}/.ssh/id_ed25519.pub"; mode = "0644"; owner = "${username}"; }; + "passwords/postgres" = { }; }; + # Setup postgres connections for db_ui + # Should be part of home-manager - waiting for templates functionality + # See here https://github.com/Mic92/sops-nix/issues/423 and here https://github.com/Mic92/sops-nix/issues/498 + # TODO migrate db_ui connection to home-manager when issue 423 and 498 are resolved in github:Mic92/sops-nix + sops.templates."dbui_connections.json" = { + path = "/home/${username}/.local/share/db_ui/connections.json"; + owner = "${username}"; + mode = "0600"; + content = '' + [ + { + "url": "postgresql://postgres:${config.sops.placeholder."passwords/postgres"}@10.0.10.100/btc_models", + "name": "btc_models" + } + ] + ''; + }; + + # The containing ssh folders are created as root and if this is the first ~/.ssh/ entry when writing keys, + # the ownership is busted and home-manager can't target because it can't write into .ssh... + # FIXME: We might not need this depending on how https://github.com/Mic92/sops-nix/issues/381 is fixed + system.activationScripts.sopsSetSshOwnwership = + let + sshFolder = "/home/${username}/.ssh"; + user = config.users.users.${username}.name; + group = config.users.users.${username}.group; + in + '' + mkdir -p ${sshFolder} || true + chown -R ${user}:${group} /home/${username}/.ssh + ''; + + environment.persistence."/persist" = { + directories = [ + "/home/${username}" + ]; + }; + + programs.zsh.enable = true; home-manager = { @@ -47,5 +87,6 @@ in }; environment.systemPackages = [ + inputs.sqlfmt.packages.x86_64-linux.sqlfmt ]; } diff --git a/hosts/semita/default.nix b/hosts/semita/default.nix index 36ae3c1..1a5e1f9 100644 --- a/hosts/semita/default.nix +++ b/hosts/semita/default.nix @@ -35,6 +35,8 @@ in ]; boot = { + blacklistedKernelModules = [ "snd_hda_intel" "snd_soc_skl" ]; + kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest; loader = { systemd-boot.enable = true; efi.canTouchEfiVariables = true; @@ -42,14 +44,9 @@ in }; }; - environment.persistence."/persist" = { - hideMounts = true; - users.${user} = { - directories = [ - "/home/${user}" - ]; - }; - }; + hardware.firmware = [ + pkgs.sof-firmware + ]; networking = { hostName = "semita"; diff --git a/pkgs/default.nix b/pkgs/default.nix index 4c7e6bb..591d772 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -2,5 +2,4 @@ # You can build them using 'nix build .#example' pkgs: { sddm-theme = pkgs.callPackage ./sddm-theme { }; - wallpaper_changer = pkgs.callPackage ./wallpaper-changer { }; } diff --git a/pkgs/sddm-theme/default.nix b/pkgs/sddm-theme/default.nix index 0bf4421..526225a 100644 --- a/pkgs/sddm-theme/default.nix +++ b/pkgs/sddm-theme/default.nix @@ -1,16 +1,15 @@ -{ pkgs ? import { }, stdenv, fetchFromGitHub }: -pkgs.stdenv.mkDerivation rec { +{ pkgs ? import { }, fetchFromGitHub }: +pkgs.stdenv.mkDerivation { pname = "sddm-theme"; version = "1.6"; dontBuild = true; -# nativeBuildInputs = with pkgs; [ -# sddm -# ]; + installPhase = '' mkdir -p $out/share/sddm/themes cp -aR $src $out/share/sddm/themes/sugar-candy touch $out/share/sddm/themes/balls ''; + src = fetchFromGitHub { owner = "Kangie"; repo = "sddm-sugar-candy";