From f22207f3e2c55bd15de1069fbbb2be3f8cfcdcd8 Mon Sep 17 00:00:00 2001 From: megit Date: Thu, 28 Mar 2024 02:03:42 +0800 Subject: [PATCH] init --- config/colorscheme/gruvbox.nix | 5 + config/colorscheme/onedark.nix | 59 +++++ config/default.nix | 24 ++ config/keymaps.nix | 21 ++ config/plugins/bufferline.nix | 7 + config/plugins/comment.nix | 7 + config/plugins/indent-blankline.nix | 7 + config/plugins/leap.nix | 27 +++ config/plugins/lsp.nix.bak | 16 ++ config/plugins/lsp/lsp.nix | 168 ++++++++++++++ config/plugins/lualine.nix | 7 + config/plugins/nvim-tree.nix | 7 + config/plugins/telescope.nix | 190 ++++++++++++++++ config/sets.nix | 66 ++++++ flake.lock | 331 ++++++++++++++++++++++++++++ flake.nix | 46 ++++ 16 files changed, 988 insertions(+) create mode 100644 config/colorscheme/gruvbox.nix create mode 100644 config/colorscheme/onedark.nix create mode 100644 config/default.nix create mode 100644 config/keymaps.nix create mode 100644 config/plugins/bufferline.nix create mode 100644 config/plugins/comment.nix create mode 100644 config/plugins/indent-blankline.nix create mode 100644 config/plugins/leap.nix create mode 100644 config/plugins/lsp.nix.bak create mode 100644 config/plugins/lsp/lsp.nix create mode 100644 config/plugins/lualine.nix create mode 100644 config/plugins/nvim-tree.nix create mode 100644 config/plugins/telescope.nix create mode 100644 config/sets.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/config/colorscheme/gruvbox.nix b/config/colorscheme/gruvbox.nix new file mode 100644 index 0000000..08494b8 --- /dev/null +++ b/config/colorscheme/gruvbox.nix @@ -0,0 +1,5 @@ +{ + colorschemes.gruvbox ={ + enable = true; + }; +} diff --git a/config/colorscheme/onedark.nix b/config/colorscheme/onedark.nix new file mode 100644 index 0000000..a92a596 --- /dev/null +++ b/config/colorscheme/onedark.nix @@ -0,0 +1,59 @@ +{ + colorschemes.onedark = { + enable = true; + }; + extraConfigLua = '' + ---------------------------------- +-- START custom setup for onedark +---------------------------------- +-- https://github.com/navarasu/onedark.nvim +require('onedark').setup { + -- Main options -- + style = 'darker', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light' + transparent = true, -- Show/hide background + term_colors = true, -- Change terminal color as per the selected theme style + ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden + cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu + + -- toggle theme style --- + -- toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "ts" + toggle_style_key = "ts", -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "ts" + -- toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}, -- List of styles to toggle between + toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer'}, -- List of styles to toggle between + + -- Change code style --- + -- Options are italic, bold, underline, none + -- You can configure multiple style with comma seperated, For e.g., keywords = 'italic,bold' + code_style = { + comments = 'italic', + keywords = 'none', + functions = 'none', + strings = 'none', + variables = 'none' + }, + + -- Lualine options -- + -- lualine = { + -- transparent = true, -- lualine center bar transparency + -- }, + + -- Custom Highlights -- + colors = {}, -- Override default colors + highlights = {}, -- Override highlight groups + + -- Plugins Config -- + diagnostics = { + darker = true, -- darker colors for diagnostic + undercurl = true, -- use undercurl instead of underline for diagnostics + background = true, -- use background color for virtual text + }, +} + + +require('onedark').load() +---------------------------------- +-- END custom setup for onedark +---------------------------------- +''; + +} diff --git a/config/default.nix b/config/default.nix new file mode 100644 index 0000000..e41b3ed --- /dev/null +++ b/config/default.nix @@ -0,0 +1,24 @@ +# The line beneath this is called `modeline`. See `:help modeline` +# vim: ts=4:sts=0:sw=0:tw=78:noet +{pkgs +, ...}:{ + # Import all your configuration modules here + imports = [ + ./colorscheme/onedark.nix + # ./colorscheme/gruvbox.nix + + ./sets.nix + ./keymaps.nix + + ./plugins/bufferline.nix + ./plugins/comment.nix + ./plugins/indent-blankline.nix + ./plugins/leap.nix + ./plugins/lsp/lsp.nix + # ./plugins/lsp/conform.nix + ./plugins/lualine.nix + ./plugins/nvim-tree.nix + ./plugins/telescope.nix + # ./plugins/none-ls/none-ls.nix + ]; +} diff --git a/config/keymaps.nix b/config/keymaps.nix new file mode 100644 index 0000000..9098a30 --- /dev/null +++ b/config/keymaps.nix @@ -0,0 +1,21 @@ +# The line beneath this is called `modeline`. See `:help modeline` +# vim: ts=4:sts=0:sw=0:tw=78:noet +{ + keymaps = [ + { + # vim.keymap.set({ "n", "v" }, "\\y", '"+y', {noremap=true, silent=true}) + mode = [ "n" "v" ]; + key = "\\y"; + action = "\"+y"; + options = { + silent = true; + remap = false; + }; + } + ]; + extraConfigLua = '' + -- see ":help default-mapping" + -- vim.cmd[[unmap Y]] + vim.keymap.del( "n", "Y" ) + ''; +} diff --git a/config/plugins/bufferline.nix b/config/plugins/bufferline.nix new file mode 100644 index 0000000..5d37aab --- /dev/null +++ b/config/plugins/bufferline.nix @@ -0,0 +1,7 @@ +{ + plugins = { + bufferline = { + enable = true; + }; + }; +} diff --git a/config/plugins/comment.nix b/config/plugins/comment.nix new file mode 100644 index 0000000..ab39fe9 --- /dev/null +++ b/config/plugins/comment.nix @@ -0,0 +1,7 @@ +{ + plugins = { + comment = { + enable = true; + }; + }; +} diff --git a/config/plugins/indent-blankline.nix b/config/plugins/indent-blankline.nix new file mode 100644 index 0000000..ad26f26 --- /dev/null +++ b/config/plugins/indent-blankline.nix @@ -0,0 +1,7 @@ +{ + plugins = { + indent-blankline = { + enable = true; + }; + }; +} diff --git a/config/plugins/leap.nix b/config/plugins/leap.nix new file mode 100644 index 0000000..d641d0a --- /dev/null +++ b/config/plugins/leap.nix @@ -0,0 +1,27 @@ +{ + plugins.leap = { + enable = true; + }; + keymaps = [ + { + mode = [ "n" "x" "o" ]; + key = "ss"; + action = "function() require('leap').leap { } end"; + } + { + mode = [ "n" "x" "o" ]; + key = "sS"; + action = "(leap-backward-to)"; + } + { + mode = [ "n" "x" "o" ]; + key = "sx"; + action = "(leap-forward-till)"; + } + { + mode = [ "n" "x" "o" ]; + key = "sX"; + action = "(leap-backward-till)"; + } + ]; +} diff --git a/config/plugins/lsp.nix.bak b/config/plugins/lsp.nix.bak new file mode 100644 index 0000000..e5d7d72 --- /dev/null +++ b/config/plugins/lsp.nix.bak @@ -0,0 +1,16 @@ +{ + lsp = { + enable = true; + servers = { + tsserver.enable = true; + + lua-ls.enable = true; + + rust-analyzer = { + enable = true; + installCargo = true; + installRustc = true; + }; + }; + }; +} diff --git a/config/plugins/lsp/lsp.nix b/config/plugins/lsp/lsp.nix new file mode 100644 index 0000000..d632f43 --- /dev/null +++ b/config/plugins/lsp/lsp.nix @@ -0,0 +1,168 @@ +{ + plugins = { + lsp-format = { + enable = false; # Enable it if you want lsp-format integration for none-ls + }; + lsp = { + enable = true; + capabilities = "offsetEncoding = 'utf-16'"; + servers = { + clangd = {enable = true;}; + lua-ls = { + enable = true; + extraOptions = { + settings = { + Lua = { + completion = { + callSnippet = "Replace"; + }; + telemetry = { + enabled = false; + }; + hint = {enable = true;}; + }; + }; + }; + }; + nil_ls = {enable = true;}; + tsserver = { + enable = false; + filetypes = ["javascript" "javascriptreact" "typescript" "typescriptreact"]; + extraOptions = { + settings = { + javascript = { + inlayHints = { + includeInlayEnumMemberValueHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayVariableTypeHints = true; + }; + }; + typescript = { + inlayHints = { + includeInlayEnumMemberValueHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayVariableTypeHints = true; + }; + }; + }; + }; + }; + eslint = {enable = true;}; + pyright = {enable = true;}; + ruff-lsp = {enable = true;}; + texlab = {enable = true;}; + + rust-analyzer = { + enable = true; + installCargo = true; + installRustc = true; + settings = { + checkOnSave = true; + check = { + command = "clippy"; + }; + # inlayHints = { + # enable = true; + # showParameterNames = true; + # parameterHintsPrefix = "<- "; + # otherHintsPrefix = "=> "; + # }; + procMacro = { + enable = true; + }; + }; + }; + }; + # keymaps = { + # silent = true; + # 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"; + # }; + # "ca" = { + # action = "code_action"; + # desc = "Code Action"; + # }; + # "" = { + # action = "signature_help"; + # desc = "Signature Help"; + # }; + # }; + # diagnostic = { + # "cd" = { + # action = "open_float"; + # desc = "Line Diagnostics"; + # }; + # "[d" = { + # action = "goto_next"; + # desc = "Next Diagnostic"; + # }; + # "]d" = { + # action = "goto_prev"; + # desc = "Previous Diagnostic"; + # }; + # }; + # }; + }; + }; + extraConfigLua = '' + local _border = "rounded" + + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( + vim.lsp.handlers.hover, { + border = _border + } + ) + + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( + vim.lsp.handlers.signature_help, { + border = _border + } + ) + + vim.diagnostic.config{ + float={border=_border} + }; + + require('lspconfig.ui.windows').default_options = { + border = _border + } + ''; +} diff --git a/config/plugins/lualine.nix b/config/plugins/lualine.nix new file mode 100644 index 0000000..ea40aa9 --- /dev/null +++ b/config/plugins/lualine.nix @@ -0,0 +1,7 @@ +{ + plugins = { + lualine = { + enable = true; + }; + }; +} diff --git a/config/plugins/nvim-tree.nix b/config/plugins/nvim-tree.nix new file mode 100644 index 0000000..a9a00eb --- /dev/null +++ b/config/plugins/nvim-tree.nix @@ -0,0 +1,7 @@ +{ + plugins = { + nvim-tree = { + enable = true; + }; + }; +} diff --git a/config/plugins/telescope.nix b/config/plugins/telescope.nix new file mode 100644 index 0000000..bd371be --- /dev/null +++ b/config/plugins/telescope.nix @@ -0,0 +1,190 @@ +{ + plugins.telescope = { + enable = true; + extensions = { + fzf-native = { + enable = true; + }; + # project-nvim = { + # enable = true; + # }; + # ui-select = { + # settings = { + # specific_opts = { + # codeactions = true; + # }; + # }; + # }; + undo = { + enable = true; + mappings = { + i = { + "" = "yank_additions"; + "" = "yank_deletions"; + "" = "restore"; + }; + n = { + "y" = "yank_additions"; + "Y" = "yank_deletions"; + "u" = "restore"; + }; + }; + }; + }; + # If you'd prefer Telescope not to enter a normal-like mode when hitting escape (and instead exiting), you can map to do so via: + defaults = { + mappings = { + i = { + "" = { + __raw = '' + function(...) + return require("telescope.actions").close(...) + end''; + }; + }; + }; + }; + keymaps = { + "" = { + action = "find_files, {}"; + desc = "Find project files"; + }; + "/" = { + action = "live_grep"; + desc = "Grep (root dir)"; + }; + ":" = { + action = "command_history, {}"; + desc = "Command History"; + }; + "b" = { + action = "buffers, {}"; + desc = "+buffer"; + }; + "ff" = { + action = "find_files, {}"; + desc = "Find project files"; + }; + "fr" = { + action = "oldfiles, {}"; + desc = "Recent"; + }; + "fb" = { + action = "buffers, {}"; + desc = "Buffers"; + }; + "" = { + action = "git_files, {}"; + desc = "Search git files"; + }; + "gc" = { + action = "git_commits, {}"; + desc = "Commits"; + }; + "gs" = { + action = "git_status, {}"; + desc = "Status"; + }; + "sa" = { + action = "autocommands, {}"; + desc = "Auto Commands"; + }; + "sb" = { + action = "current_buffer_fuzzy_find, {}"; + desc = "Buffer"; + }; + "sc" = { + action = "command_history, {}"; + desc = "Command History"; + }; + "sC" = { + action = "commands, {}"; + desc = "Commands"; + }; + "sD" = { + action = "diagnostics, {}"; + desc = "Workspace diagnostics"; + }; + "sh" = { + action = "help_tags, {}"; + desc = "Help pages"; + }; + "sH" = { + action = "highlights, {}"; + desc = "Search Highlight Groups"; + }; + "sk" = { + action = "keymaps, {}"; + desc = "Keymaps"; + }; + "sM" = { + action = "man_pages, {}"; + desc = "Man pages"; + }; + "sm" = { + action = "marks, {}"; + desc = "Jump to Mark"; + }; + "so" = { + action = "vim_options, {}"; + desc = "Options"; + }; + "sR" = { + action = "resume, {}"; + desc = "Resume"; + }; + "uC" = { + action = "colorscheme, {}"; + desc = "Colorscheme preview"; + }; + }; + }; + keymaps = [ + { + mode = "n"; + key = "fp"; + action = "Telescope projects"; + options = { + desc = "Projects"; + }; + } + + { + mode = "n"; + key = "sd"; + action = "Telescope diagnostics bufnr=0"; + options = { + desc = "Document diagnostics"; + }; + } + + { + mode = "n"; + key = "st"; + action = "TodoTelescope"; + options = { + silent = true; + desc = "Todo (Telescope)"; + }; + } + + # { + # mode = "n"; + # key = ","; + # action = "Telescope buffers sort_mru=true sort_lastused=true"; + # options = { + # desc = "Switch Buffer"; + # }; + # } + ]; + extraConfigLua = '' + local telescope = require('telescope') + telescope.setup{ + pickers = { + colorscheme = { + enable_preview = true + } + } + } + ''; +} diff --git a/config/sets.nix b/config/sets.nix new file mode 100644 index 0000000..a3119b8 --- /dev/null +++ b/config/sets.nix @@ -0,0 +1,66 @@ +# The line beneath this is called `modeline`. See `:help modeline` +# vim: ts=4:sts=0:sw=0:tw=78:noet +{ +options = { + relativenumber = true; + splitbelow = true; + redrawtime = 5000; + + # new split to the right + splitright = true; + + # show hidden characters + list = true; + + # don't break words on the edge + linebreak = true; + wrap = true; + # length of an actual \t character: + # https://stackoverflow.com/questions/191201/indenting-comments-to-match-code-in-vim + smartindent = false; + # length to use when shifting text (eg. <<, >> and == commands) + + tabstop=4; + shiftwidth = 0; + + expandtab = false; + autoindent = true; + # Set highlight on search + hlsearch = false; + + # Make line numbers default + number = true; + + # Enable mouse mode + mouse = "a"; + + # Sync clipboard between OS and Neovim. + # Remove this option if you want your OS clipboard to remain independent. + # See `:help 'clipboard'` + # vim.o.clipboard = 'unnamedplus' -- REMOVED BY ME + + # Enable break indent + breakindent = true; + + # Save undo history + # vim.o.undofile = true -- REMOVED BY ME + + # Case insensitive searching UNLESS /C or capital in search + ignorecase = true; + smartcase = true; + + # Keep signcolumn on by default + signcolumn = "yes"; + + # Decrease update time + updatetime = 250; + timeout = true; + timeoutlen = 300; + + # Set completeopt to have a better completion experience + completeopt = "menuone,noselect"; + + # NOTE: You should make sure your terminal supports this + termguicolors = true; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..94666a2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,331 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711099426, + "narHash": "sha256-HzpgM/wc3aqpnHJJ2oDqPBkNsqWbW0WfWUO8lKu8nGk=", + "owner": "numtide", + "repo": "devshell", + "rev": "2d45b54ca4a183f2fdcf4b19c895b64fbf620ee8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711133180, + "narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710717205, + "narHash": "sha256-Wf3gHh5uV6W1TV/A8X8QJf99a5ypDSugY4sNtdJDe0A=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "bcc8afd06e237df060c85bad6af7128e05fd61a3", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1711401922, + "narHash": "sha256-QoQqXoj8ClGo0sqD/qWKFWezgEwUL0SUh37/vY2jNhc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "07262b18b97000d16a4bdb003418bd2fb067a932", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1711333969, + "narHash": "sha256-5PiWGn10DQjMZee5NXzeA6ccsv60iLu+Xtw+mfvkUAs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "57e6b3a9e4ebec5aa121188301f04a6b8c354c9b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "home-manager": "home-manager", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1711545203, + "narHash": "sha256-PPXcH/pIbxr8awgC+q+rrIgRRH8uYeWoK5Af3kFhjEc=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "d248bf587cdb86b661ca54f16fe2f3263018b985", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_3", + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711409088, + "narHash": "sha256-+rTCra8TY4vuSNTtQ0tcex1syCRPoKyb8vyHmoxkga4=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "db656fc3e34907000df26e8bc5cc3c94fb27f353", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c279d83 --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + description = "Menixvim flake"; + + inputs = { + nixvim.url = "github:nix-community/nixvim"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + nixvim, + flake-utils, + ... + } @ inputs: let + config = import ./config; # import the module directly + in + flake-utils.lib.eachDefaultSystem (system: let + nixvimLib = nixvim.lib.${system}; + pkgs = import nixpkgs {inherit system;}; + nixvim' = nixvim.legacyPackages.${system}; + nvim = nixvim'.makeNixvimWithModule { + inherit pkgs; + module = config; + # You can use `extraSpecialArgs` to pass additional arguments to your module files + extraSpecialArgs = { + inherit self; + }; + }; + in { + checks = { + # Run `nix flake check .` to verify that your config is not broken + default = nixvimLib.check.mkTestDerivationFromNvim { + inherit nvim; + name = "Menixvim"; + }; + }; + + packages = { + # Lets you run `nix run .` to start nixvim + default = nvim; + }; + + # formatter = pkgs.alejandra; + }); +}