commit 94be99323cf8372623229a19fc23aa7d7c7cb7ac Author: Fred Drake Date: Mon Sep 30 11:57:07 2024 -0400 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5237650 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.aider* +result +.envrc diff --git a/README.md b/README.md new file mode 100644 index 0000000..c6d7d4e --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# My Personal Neovim Setup + +My Nix-based Neovim configuration. For when you have an unhealthy obsession for declarativity and configurability. + +![screenshot](images/desktop.png) + +## Usage + +Option 1: Clone and run + +```bash +git clone https://github.com/fred-drake/neovim.git +nix run .# +``` + +Option 2: Run directly + +```bash +nix run github:fred-drake/neovim#. +``` + +## Things To Do + +TODO: Add supermaven autocompletion. +TODO: Implement DAP for debugging +TODO: Change fzf to only allow git-level root if applicable +TODO: Break up LSP, CMP and Tree-Sitter for lanuages like rust, go, etc. diff --git a/config/dap.nix b/config/dap.nix new file mode 100644 index 0000000..4833453 --- /dev/null +++ b/config/dap.nix @@ -0,0 +1,13 @@ +{ + plugins = { + cmp-dap.enable = true; + dap = { + enable = true; + extensions = { + dap-go.enable = true; + dap-python.enable = true; + dap-ui.enable = true; + }; + }; + }; +} diff --git a/config/dashboard.nix b/config/dashboard.nix new file mode 100644 index 0000000..264a018 --- /dev/null +++ b/config/dashboard.nix @@ -0,0 +1,157 @@ +{ + plugins = { + alpha = { + enable = true; + layout = [ + { + type = "padding"; + val = 2; + } + { + type = "text"; + val = [ + " _ _______ _______ _________ _______ " + "( ( /|( ____ \\( ___ )|\\ /|\\__ __/( )" + "| \\ ( || ( \\/| ( ) || ) ( | ) ( | () () |" + "| \\ | || (__ | | | || | | | | | | || || |" + "| (\\ \\) || __) | | | |( ( ) ) | | | |(_)| |" + "| | \\ || ( | | | | \\ \\_/ / | | | | | |" + "| ) \\ || (____/\\| (___) | \\ / ___) (___| ) ( |" + "|/ )_)(_______/(_______) \\_/ \\_______/|/ \\|" + " " + ]; + opts = { + position = "center"; + hl = "Type"; + }; + } + { + type = "padding"; + val = 2; + } + { + type = "group"; + val = [ + { + type = "button"; + val = "  New File "; + on_press.__raw = "function() vim.cmd[[ene]] end"; + opts = { + shortcut = "n"; + keymap = [ + "n" + "n" + "ene" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + { + type = "button"; + val = "  Find File "; + on_press.__raw = + "function() require('telescope.builtin').find_files() end"; + opts = { + shortcut = "f"; + keymap = [ + "n" + "f" + "lua require('telescope.builtin').find_files()" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + { + type = "button"; + val = "  Recent Files "; + on_press.__raw = + "function() require('telescope.builtin').oldfiles() end"; + opts = { + shortcut = "r"; + keymap = [ + "n" + "r" + "lua require('telescope.builtin').oldfiles()" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + { + type = "button"; + val = "  Find Text "; + on_press.__raw = + "function() require('telescope.builtin').live_grep() end"; + opts = { + shortcut = "g"; + keymap = [ + "n" + "g" + "lua require('telescope.builtin').live_grep()" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + { + type = "button"; + val = "  Quit Neovim "; + on_press.__raw = "function() vim.cmd[[qa]] end"; + opts = { + shortcut = "q"; + keymap = [ + "n" + "q" + "qa" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + ]; + } + { + type = "padding"; + val = 2; + } + ]; + }; + }; +} diff --git a/config/default.nix b/config/default.nix new file mode 100644 index 0000000..33dbcbd --- /dev/null +++ b/config/default.nix @@ -0,0 +1,14 @@ +let + # Read all files in the current directory + files = builtins.readDir ./.; + + # Filter out default.nix and non-.nix files + nixFiles = builtins.filter (name: name != "default.nix" && builtins.match ".*\\.nix" name != null) (builtins.attrNames files); + + # Create a list of import statements + imports = map (name: ./. + "/${name}") nixFiles; +in +{ + # Import all configuration modules automatically + imports = imports; +} diff --git a/config/find.nix b/config/find.nix new file mode 100644 index 0000000..ebe163e --- /dev/null +++ b/config/find.nix @@ -0,0 +1,69 @@ +{ + plugins = { + fzf-lua = { + enable = true; + keymaps = { + "/" = { + action = "live_grep"; + options = { desc = "Live Grep"; }; + }; + "," = { + action = "buffers"; + options = { desc = "Switch Buffer"; }; + settings = { + sort_mru = true; + sort_lastused = true; + }; + }; + "ff" = { + action = "files"; + options = { desc = "Find Files"; }; + }; + "fr" = { + action = "oldfiles"; + options = { desc = "Recent Files"; }; + }; + "gc" = { + action = "git_commits"; + options = { desc = "Git Commits"; }; + }; + "gs" = { + action = "git_status"; + options = { desc = "Git Status"; }; + }; + "s\"" = { + action = "registers"; + options = { desc = "Registers"; }; + }; + "sd" = { + action = "diagnostics_document"; + options = { desc = "Document Diagnostics"; }; + }; + "sD" = { + action = "diagnostics_workspace"; + options = { desc = "Workspace Diagnostics"; }; + }; + "sh" = { + action = "help_tags"; + options = { desc = "Help Pages"; }; + }; + "sk" = { + action = "keymaps"; + options = { desc = "Key Maps"; }; + }; + }; + }; + telescope.enable = true; + todo-comments = { + enable = true; + keymaps = { + todoTelescope = { + key = "st"; + keywords = [ "TODO" ]; + }; + }; + }; + }; + +} + diff --git a/config/keys.nix b/config/keys.nix new file mode 100644 index 0000000..70f365e --- /dev/null +++ b/config/keys.nix @@ -0,0 +1,287 @@ +{ + globals.mapleader = " "; + + plugins.which-key = { + enable = true; + settings = { + spec = [ + { + __unkeyed-1 = "g"; + group = "Git"; + } + { + __unkeyed-1 = ""; + group = "Tabs"; + } + { + __unkeyed-1 = "f"; + group = "File / Find"; + } + { + __unkeyed-1 = "q"; + group = "Quit / Session"; + } + { + __unkeyed-1 = "s"; + group = "Search"; + } + { + __unkeyed-1 = "b"; + group = "Buffer"; + } + { + __unkeyed-1 = "o"; + group = "SOPS"; + icon = ""; + } + ]; + }; + }; + + keymaps = [ + # Normal mode + { + mode = "i"; + key = "jk"; + action = "noh"; + options = { desc = "Normal mode and clear highlight"; }; + } + { + mode = "i"; + key = ""; + action = "noh"; + options = { desc = "Normal mode and clear highlight"; }; + } + { + mode = "n"; + key = ""; + action = "noh"; + options = { desc = "Normal mode and clear highlight"; }; + } + + # Add undo breakpoints + { + mode = "i"; + key = ","; + action = ",u"; + options = { desc = "Undo breakpoint"; }; + } + { + mode = "i"; + key = "."; + action = ".u"; + options = { desc = "Undo breakpoint"; }; + } + { + mode = "i"; + key = ";"; + action = ";u"; + options = { desc = "Undo breakpoint"; }; + } + + { + mode = "n"; + key = "e"; + action = "Neotree toggle"; + options = { desc = "Toggle tree view"; }; + } + + # LSP Actions + { + mode = "n"; + key = "gd"; + action = + "FzfLua lsp_definitions jump_to_single_result=true ignore_current_line=true"; + options = { desc = "Goto Definition"; }; + } + { + mode = "n"; + key = "gr"; + action = + "FzfLua lsp_references jump_to_single_result=true ignore_current_line=true"; + options = { desc = "References"; }; + } + { + mode = "n"; + key = "gI"; + action = + "FzfLua lsp_implementations jump_to_single_result=true ignore_current_line=true"; + options = { desc = "Goto Implementation"; }; + } + { + mode = "n"; + key = "gy"; + action = + "FzfLua lsp_typedefs jump_to_single_result=true ignore_current_line=true"; + options = { desc = "Goto T[y]pe Definition"; }; + } + + # SOPS + { + mode = "n"; + key = "od"; + action = "!sops -d -i %"; + options = { desc = "Decrypt SOPS File"; }; + } + { + mode = "n"; + key = "oe"; + action = "!sops -e -i %"; + options = { desc = "Encrypt SOPS File"; }; + } + + # Git + { + mode = "n"; + key = "gg"; + action = "LazyGit"; + options = { desc = "LazyGit"; }; + } + + # Windows + { + key = ""; + action = "wincmd h"; + options = { desc = "Navigate Window Left"; }; + } + { + key = ""; + action = "wincmd j"; + options = { desc = "Navigate Window Down"; }; + } + { + key = ""; + action = "wincmd k"; + options = { desc = "Navigate Window Up"; }; + } + { + key = ""; + action = "wincmd l"; + options = { desc = "Navigate Window Right"; }; + } + { + mode = "n"; + key = "w"; + action = ""; + options = { desc = "Windows"; }; + } + { + mode = "n"; + key = "-"; + action = "s"; + options = { desc = "Split Window Below"; }; + } + { + mode = "n"; + key = "|"; + action = "v"; + options = { desc = "Split Window Right"; }; + } + { + mode = "n"; + key = "wd"; + action = "c"; + options = { desc = "Delete Window"; }; + } + + # Tabs + { + mode = "n"; + key = "l"; + action = "tablast"; + options = { desc = "Last Tab"; }; + } + { + mode = "n"; + key = "o"; + action = "tabonly"; + options = { desc = "Close Other Tabs"; }; + } + { + mode = "n"; + key = "f"; + action = "tabfirst"; + options = { desc = "First Tab"; }; + } + { + mode = "n"; + key = ""; + action = "tabnew"; + options = { desc = "New Tab"; }; + } + { + mode = "n"; + key = "]"; + action = "tabnext"; + options = { desc = "Next Tab"; }; + } + { + mode = "n"; + key = "d"; + action = "tabclose"; + options = { desc = "Close Tab"; }; + } + { + mode = "n"; + key = "["; + action = "tabprevious"; + options = { desc = "Previous Tab"; }; + } + + # Buffer + { + mode = "n"; + key = ""; + action = "bprevious"; + options = { desc = "Previous Buffer"; }; + } + { + mode = "n"; + key = ""; + action = "bnext"; + options = { desc = "Next Buffer"; }; + } + { + mode = "n"; + key = "bb"; + action = "e #"; + options = { desc = "Switch To Other Buffer"; }; + } + { + mode = "n"; + key = "bd"; + action = "bd"; + options = { desc = "Delete Buffer and Window"; }; + } + { + mode = "n"; + key = "bp"; + action = "BufferLineTogglePin"; + options = { desc = "Toggle Pin"; }; + } + { + mode = "n"; + key = "bP"; + action = "BufferLineGroupClose ungrouped"; + options = { desc = "Delete Non-Pinned Buffers"; }; + } + { + mode = "n"; + key = "bo"; + action = "BufferLineCloseOthers"; + options = { desc = "Delete Other Buffers"; }; + } + { + mode = "n"; + key = "br"; + action = "BufferLineCloseRight"; + options = { desc = "Delete Buffers to the Right"; }; + } + { + mode = "n"; + key = "bl"; + action = "BufferLineCloseLeft"; + options = { desc = "Delete Buffers to the Left"; }; + } + ]; +} diff --git a/config/lsp.nix b/config/lsp.nix new file mode 100644 index 0000000..4e152a4 --- /dev/null +++ b/config/lsp.nix @@ -0,0 +1,252 @@ +let selectOpts = "{behavior = cmp.SelectBehavior.Select}"; +in { pkgs, ... }: { + plugins = { + cmp = { + enable = true; + settings = { + autoEnableSources = true; + performance = { debounce = 150; }; + sources = [ + { name = "path"; } + { + name = "nvim_lsp"; + keywordLength = 1; + } + { + name = "buffer"; + keywordLength = 3; + } + ]; + + snippet.expand = + "function(args) require('luasnip').lsp_expand(args.body) end"; + formatting = { + fields = [ "menu" "abbr" "kind" ]; + format = '' + function(entry, item) + local menu_icon = { + nvim_lsp = '[LSP]', + luasnip = '[SNIP]', + buffer = '[BUF]', + path = '[PATH]', + } + + item.menu = menu_icon[entry.source.name] + return item + end + ''; + }; + + mapping = { + "" = "cmp.mapping.select_prev_item(${selectOpts})"; + "" = "cmp.mapping.select_next_item(${selectOpts})"; + + "" = "cmp.mapping.select_prev_item(${selectOpts})"; + "" = "cmp.mapping.select_next_item(${selectOpts})"; + + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + + "" = "cmp.mapping.abort()"; + "" = "cmp.mapping.confirm({select = true})"; + "" = "cmp.mapping.confirm({select = false})"; + + "" = '' + cmp.mapping( + function(fallback) + if luasnip.jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, + { "i", "s" } + ) + ''; + + "" = '' + cmp.mapping( + function(fallback) + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, + { "i", "s" } + ) + ''; + + "" = '' + cmp.mapping( + function(fallback) + local col = vim.fn.col('.') - 1 + + if cmp.visible() then + cmp.select_next_item(select_opts) + elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + fallback() + else + cmp.complete() + end + end, + { "i", "s" } + ) + ''; + + "" = '' + cmp.mapping( + function(fallback) + if cmp.visible() then + cmp.select_prev_item(select_opts) + else + fallback() + end + end, + { "i", "s" } + ) + ''; + }; + window = { + completion = { + border = "rounded"; + winhighlight = + "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None"; + zindex = 1001; + scrolloff = 0; + colOffset = 0; + sidePadding = 1; + scrollbar = true; + }; + documentation = { + border = "rounded"; + winhighlight = + "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None"; + zindex = 1001; + maxHeight = 20; + }; + }; + }; + }; + cmp-nvim-lsp.enable = true; + cmp-buffer.enable = true; + cmp-path.enable = true; + cmp-treesitter.enable = true; + dap.enable = true; + none-ls = { + enable = true; + sources.formatting = { + black.enable = true; + csharpier.enable = true; + hclfmt.enable = true; + just.enable = true; + nixfmt.enable = true; + opentofu_fmt.enable = true; + prettier.enable = true; + # rubyfmt is broken on darwin-based systems + rubyfmt.enable = (pkgs.stdenv.hostPlatform.system != "x86_64-darwin" + && pkgs.stdenv.hostPlatform.system != "aarch64-darwin"); + sqlformat.enable = true; + stylua.enable = true; + yamlfmt.enable = true; + }; + sources.diagnostics = { + trivy.enable = true; + yamllint.enable = true; + }; + }; + + conform-nvim = { + enable = true; + settings = { + format_on_save = { + lsp_fallback = "fallback"; + timeout_ms = 500; + }; + notify_on_error = true; + + formatters_by_ft = { + css = [ "prettier" ]; + html = [ "prettier" ]; + javascript = [ "prettier" ]; + javascriptreact = [ "prettier" ]; + lua = [ "stylua" ]; + markdown = [ "prettier" ]; + nix = [ "nixfmt" ]; + python = [ "black" ]; + ruby = [ "rubyfmt" ]; + rust = [ "rustfmt" ]; + terraform = [ "tofu_fmt" ]; + tf = [ "tofu_fmt" ]; + typescript = [ "prettier" ]; + typescriptreact = [ "prettier" ]; + yaml = [ "yamlfmt" ]; + }; + }; + }; + + lsp = { + enable = true; + inlayHints = true; + keymaps = { + diagnostic = { + "E" = "open_float"; + "[" = "goto_prev"; + "]" = "goto_next"; + "do" = "setloclist"; + }; + lspBuf = { + "K" = "hover"; + "gD" = "declaration"; + "gd" = "definition"; + "gr" = "references"; + "gI" = "implementation"; + "gy" = "type_definition"; + "rn" = "rename"; + "ca" = "code_action"; + "wl" = "list_workspace_folders"; + "wr" = "remove_workspace_folder"; + "wa" = "add_workspace_folder"; + }; + }; + preConfig = '' + vim.diagnostic.config({ + virtual_text = false, + severity_sort = true, + float = { + border = 'rounded', + source = 'always', + }, + }) + + vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( + vim.lsp.handlers.hover, + {border = 'rounded'} + ) + + vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( + vim.lsp.handlers.signature_help, + {border = 'rounded'} + ) + ''; + postConfig = '' + local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + ''; + servers = { + nil-ls.enable = true; + nixd.enable = true; + omnisharp.enable = true; + }; + }; + + rustaceanvim = { + enable = true; + settings = { tools.enable_clippy = true; }; + }; + # rust-tools.enable = true; + }; +} diff --git a/config/options.nix b/config/options.nix new file mode 100644 index 0000000..f8c8f7d --- /dev/null +++ b/config/options.nix @@ -0,0 +1,33 @@ +{ + config = { + opts = { + updatetime = 100; # faster completion + number = true; + relativenumber = true; + + autoindent = true; + autowrite = true; + confirm = true; + clipboard = "unnamedplus"; + cursorline = true; + list = true; + expandtab = true; + shiftround = true; + shiftwidth = 2; + # showmode = false; + signcolumn = "yes"; + smartcase = true; + smartindent = true; + tabstop = 2; + + ignorecase = true; + incsearch = true; + completeopt = "menu,menuone,noselect"; + wildmode = "longest:full,full"; + + swapfile = false; + undofile = true; # Build-in persistent undo + undolevels = 10000; + }; + }; +} diff --git a/config/sets.nix b/config/sets.nix new file mode 100644 index 0000000..60ba1b4 --- /dev/null +++ b/config/sets.nix @@ -0,0 +1,92 @@ +{ + plugins = { + bufferline = { + enable = true; + settings = { + options = { + always_show_bufferline = false; + buffer_close_icon = ""; + offsets = [{ + filetype = "neo-tree"; + text = "Neo-tree"; + highlight = "Directory"; + text_align = "left"; + }]; + diagnostics = "nvim_lsp"; + }; + }; + }; + + gitsigns = { + enable = true; + settings = { + current_line_blame = true; + current_line_blame_opts = { + virt_text = true; + virt_text_pos = "eol"; + }; + signcolumn = true; + signs = { + add = { text = "│"; }; + change = { text = "│"; }; + changedelete = { text = "~"; }; + delete = { text = "_"; }; + topdelete = { text = "‾"; }; + untracked = { text = "┆"; }; + }; + watch_gitdir = { follow_files = true; }; + }; + }; + + illuminate.enable = true; + lazygit.enable = true; + nvim-lightbulb.enable = true; + lualine = { + enable = true; + settings.options.globalstatus = true; + }; + luasnip.enable = true; + + mini = { + enable = true; + modules = { + surround = { }; + indentscope = { + symbol = "│"; + options = { try_as_border = true; }; + }; + }; + }; + + neo-tree = { + enable = true; + extraOptions = { + filesystem = { + follow_current_file.enabled = true; + filtered_items = { + hide_dotfiles = false; + hide_gitignored = false; + hide_hidden = false; + }; + }; + }; + }; + + noice.enable = true; + notify.enable = true; + nvim-autopairs.enable = true; + nvim-colorizer.enable = true; + render-markdown.enable = true; + todo-comments.enable = true; + + treesitter = { + enable = true; + + folding = true; + settings.indent.enable = true; + }; + + vim-surround.enable = true; + web-devicons.enable = true; + }; +} diff --git a/config/themes.nix b/config/themes.nix new file mode 100644 index 0000000..4c8771f --- /dev/null +++ b/config/themes.nix @@ -0,0 +1,5 @@ +{ + colorschemes = { + gruvbox.enable = true; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6d26a0e --- /dev/null +++ b/flake.lock @@ -0,0 +1,362 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", + "owner": "numtide", + "repo": "devshell", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", + "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-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1726153070, + "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726153070, + "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "nixvim", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727514110, + "narHash": "sha256-0YRcOxJG12VGDFH8iS8pJ0aYQQUAgo/r3ZAL+cSh9nk=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "85f7a7177c678de68224af3402ab8ee1bcee25c8", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "git-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": 1727383923, + "narHash": "sha256-4/vacp3CwdGoPf8U4e/N8OsGYtO09WTcQK5FqYfJbKs=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "ffe2d07e771580a005e675108212597e5b367d2d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727507295, + "narHash": "sha256-I/FrX1peu4URoj5T5odfuKR2rm4GjYJJpCGF9c0/lDA=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "f2e1c4aa29fc211947c3a7113cba1dd707433b70", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1718428119, + "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts_2", + "git-hooks": "git-hooks", + "home-manager": "home-manager", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs_2", + "nuschtosSearch": "nuschtosSearch", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1727519958, + "narHash": "sha256-racmCXmFrR8r9/IuByadyX6H8TTZZhIo2MguKgIrcmo=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "13564727c59831ff36a9d091024fa79aeca86839", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727452028, + "narHash": "sha256-ehl/A4HQFRyqj1Fk7cl+dgSf/2Fb1jLwWJtZaMU6RfU=", + "owner": "NuschtOS", + "repo": "search", + "rev": "9f7426e532ef8dfc839c4a3fcc567b13a20a70d3", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "nixvim": "nixvim", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1727577080, + "narHash": "sha256-2LPT76Acp6ebt7fCt90eq/M8T2+X09s/yTVgfVFrtno=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "73a833855442ce8cee710cf4d8d054fea1c81196", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727431250, + "narHash": "sha256-uGRlRT47ecicF9iLD1G3g43jn2e+b5KaMptb59LHnvM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "879b29ae9a0378904fbbefe0dadaed43c8905754", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2ea67cb --- /dev/null +++ b/flake.nix @@ -0,0 +1,53 @@ +{ + description = "A nixvim configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixvim.url = "github:nix-community/nixvim"; + flake-parts.url = "github:hercules-ci/flake-parts"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = { nixvim, flake-parts, rust-overlay, ... }@inputs: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = + [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + + perSystem = { system, ... }: + let + overlays = [ (import rust-overlay) ]; + nixvimLib = nixvim.lib.${system}; + nixvim' = nixvim.legacyPackages.${system}; + nixvimModule = { + inherit pkgs; + module = { pkgs, ... }: { + imports = [ ./config ]; + extraPackages = with pkgs; [ + sops + rust-bin.stable.latest.default + ]; + }; + # You can use `extraSpecialArgs` to pass additional arguments to your module files + extraSpecialArgs = { + # inherit (inputs) foo; + }; + }; + pkgs = import inputs.nixpkgs { + inherit system overlays; + config.allowUnfree = true; + }; + nvim = nixvim'.makeNixvimWithModule nixvimModule; + in { + checks = { + # Run `nix flake check .` to verify that your config is not broken + default = + nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule; + }; + + packages = { + # Lets you run `nix run .` to start nixvim + default = nvim; + }; + }; + }; +} diff --git a/images/desktop.png b/images/desktop.png new file mode 100644 index 0000000..e6abcaa Binary files /dev/null and b/images/desktop.png differ