diff --git a/flake.nix b/flake.nix index c4154f3..36abea9 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,7 @@ home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.bryan = import ./homeConfig/home.nix; + home-manager.users.bryan = import ./homeConfig/home.nix { inherit pkgs; }; } ]; }; diff --git a/homeConfig/home.nix b/homeConfig/home.nix index f86b950..3a02138 100644 --- a/homeConfig/home.nix +++ b/homeConfig/home.nix @@ -1,8 +1,8 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: { programs.home-manager.enable = true; - imports = ./modules/default.nix; + imports = [ ./modules/default.nix ]; home.stateVersion = "22.11"; home.username = "bryan"; diff --git a/homeConfig/modules/alacritty/default.nix b/homeConfig/modules/alacritty/default.nix index b872b15..afc7d24 100644 --- a/homeConfig/modules/alacritty/default.nix +++ b/homeConfig/modules/alacritty/default.nix @@ -7,7 +7,7 @@ let in { options.modules.alacritty = { enable = mkEnableOption "alacritty"; }; config = mkIf cfg.enable { - programs.alacritty = import ./config/alacritty.nix { inherit pkgs; }; + programs.alacritty = import ./config/alacritty.nix { inherit pkgs lib; }; home.packages = with pkgs; [ terminus-nerdfont diff --git a/homeConfig/modules/browsers/config/bryan.nix b/homeConfig/modules/browsers/config/bryan.nix index b6796d9..5677953 100644 --- a/homeConfig/modules/browsers/config/bryan.nix +++ b/homeConfig/modules/browsers/config/bryan.nix @@ -1,9 +1,9 @@ -{ config, ... }: +{ pkgs, ... }: { isDefault = true; search.default = "Startpage"; - extensions = with config.nur.repos.rycee.firefox-addons; [ + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ ublock-origin darkreader keepassxc-browser diff --git a/homeConfig/modules/browsers/default.nix b/homeConfig/modules/browsers/default.nix index efd1ac4..e139a6b 100644 --- a/homeConfig/modules/browsers/default.nix +++ b/homeConfig/modules/browsers/default.nix @@ -8,8 +8,8 @@ in { options.modules.browsers = { enable = mkEnableOption "browsers"; }; config = mkIf cfg.enable { programs.firefox = { - enabled = true; - profiles.bryan = import config/bryan.nix { inherit config; }; + enable = true; + profiles.bryan = import config/bryan.nix { inherit pkgs; }; }; home.packages = [ diff --git a/homeConfig/modules/git/config/git.nix b/homeConfig/modules/git/config/git.nix index 346f3d3..84dcde3 100644 --- a/homeConfig/modules/git/config/git.nix +++ b/homeConfig/modules/git/config/git.nix @@ -2,7 +2,7 @@ enable = true; userName = "Bryan Ramos"; userEmail = "bryan@ramos.codes"; - signingKey = "F1F3466458452B2DF351F1E864D12BA95ACE1F2D"; + signing.key = "F1F3466458452B2DF351F1E864D12BA95ACE1F2D"; extraConfig = { init = { defaultBranch = "main"; }; diff --git a/homeConfig/modules/gui/default.nix b/homeConfig/modules/gui/default.nix index 290c3f9..9f9a30f 100644 --- a/homeConfig/modules/gui/default.nix +++ b/homeConfig/modules/gui/default.nix @@ -7,8 +7,8 @@ let in { options.modules.gui = { enable = mkEnableOption "gui"; }; config = mkIf cfg.enable { - wayland.windowmanager.sway = import ./config/sway.nix { inherit pkgs; }; - programs.rofi = import ./config/rofi.nix { inherit pkgs; }; + wayland.windowManager.sway = import ./config/sway.nix { inherit pkgs config lib; }; + programs.rofi = import ./config/rofi.nix { inherit pkgs lib; }; gtk = { enable = true; diff --git a/homeConfig/modules/neovim/config/init.nix b/homeConfig/modules/neovim/config/init.nix index a200ab7..cf5209c 100644 --- a/homeConfig/modules/neovim/config/init.nix +++ b/homeConfig/modules/neovim/config/init.nix @@ -1,17 +1,126 @@ '' lua << EOF - vim.opt.tabstop = 2 - vim.opt.shiftwidth = 2 - vim.opt.expandtab = true +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true - vim.o.guicursor = \'\' - vim.o.clipboard = "unnamedplus" +vim.o.guicursor = \'\' +vim.o.clipboard = "unnamedplus" - vim.o.foldmethod = "indent" - vim.o.foldlevelstart = 99 +vim.o.foldmethod = "indent" +vim.o.foldlevelstart = 99 - vim.cmd([[ - au BufRead,BufNewFile *.purs set filetype=purescript - ]]) +vim.cmd([[ + au BufRead,BufNewFile *.purs set filetype=purescript +]]) + +require("config.lazy") + +local lsp = require("lsp-zero").preset({}) + +lsp.on_attach(function(client, bufnr) + lsp.default_keymaps({ buffer = bufnr }) +end) + +lsp.setup_servers({ + "tsserver", + "eslint", + "hls", + "pyright", + "nil_ls", + "cssls", + "html", + "jsonls", + "diagnosticls", + "lua_ls", + "marksman", + "purescriptls", + "tailwindcss", + "bashls", +}) + +require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls()) + +lsp.setup() + +local cmp = require("cmp") +cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, +}) + +local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + +local luasnip = require("luasnip") + +cmp.setup({ + enabled = function() + -- disable completion in comments + local context = require("cmp.config.context") + -- keep command mode completion enabled when cursor is in a comment + if vim.api.nvim_get_mode().mode == "c" then + return true + else + return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment") + end + end, + mapping = { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) + else + fallback() + end + end, + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + }), + }, +}) + +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + -- Disable virtual_text + virtual_text = false, +}) + +require("notify").setup({ + background_colour = "#000000", +}) EOF '' diff --git a/homeConfig/modules/neovim/default.nix b/homeConfig/modules/neovim/default.nix index 91a2cc4..9a02bf4 100644 --- a/homeConfig/modules/neovim/default.nix +++ b/homeConfig/modules/neovim/default.nix @@ -13,7 +13,7 @@ in vimAlias = true; extraLuaConfig = import ./config/init.nix; - generatedConfigs = {lua = import ./config/config.nix;}; +# generatedConfigs = {lua = import ./config/config.nix;}; plugins = import ./config/plugins.nix { inherit pkgs; }; extraPackages = import ./config/lsp.nix { inherit pkgs; }; }; diff --git a/sysConfig/desktop/system.nix b/sysConfig/desktop/system.nix index 80e5371..528283a 100644 --- a/sysConfig/desktop/system.nix +++ b/sysConfig/desktop/system.nix @@ -5,6 +5,7 @@ # Nix nix = { + package = pkgs.nixFlakes; extraOptions = "experimental-features = nix-command flakes"; settings = { auto-optimise-store = true;