summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-18 01:28:42 -0500
committerseth <[email protected]>2023-12-18 02:18:35 -0500
commit8faa242f21648e52a6bbdfa803fd4ea1b0e347e0 (patch)
treeeff6694cefb2f821bf19b0d8cb3d97bf48cb15b9
parent9fe8afd0c5f2b439176728d8863570bf22614dbd (diff)
port to nixvim
-rw-r--r--.github/workflows/ci.yaml18
-rw-r--r--.github/workflows/flakehub-publish.yaml24
-rw-r--r--.github/workflows/update-lock.yaml30
-rw-r--r--.gitignore3
-rw-r--r--.luarc.json3
-rw-r--r--config/default.nix32
-rw-r--r--config/keymaps.nix82
-rw-r--r--config/plugins/bufferline.nix19
-rw-r--r--config/plugins/cmp.nix31
-rw-r--r--config/plugins/default.nix12
-rw-r--r--config/plugins/efmls.nix100
-rw-r--r--config/plugins/fidget.nix5
-rw-r--r--config/plugins/flash.nix5
-rw-r--r--config/plugins/gitsigns.nix5
-rw-r--r--config/plugins/ibl.nix22
-rw-r--r--config/plugins/lsp-format.nix5
-rw-r--r--config/plugins/lsp.nix54
-rw-r--r--config/plugins/lualine.nix8
-rw-r--r--config/plugins/mini.nix36
-rw-r--r--config/plugins/neo-tree.nix11
-rw-r--r--config/plugins/treesitter.nix25
-rw-r--r--config/plugins/trouble.nix5
-rw-r--r--config/plugins/which-key.nix9
-rw-r--r--dev.nix31
-rw-r--r--flake.lock159
-rw-r--r--flake.nix115
-rw-r--r--lua/getchoo/globals.lua1
-rw-r--r--lua/getchoo/init.lua4
-rw-r--r--lua/getchoo/keymaps.lua47
-rw-r--r--lua/getchoo/options.lua12
-rw-r--r--lua/getchoo/plugins/bufferline.lua18
-rw-r--r--lua/getchoo/plugins/catppuccin.lua30
-rw-r--r--lua/getchoo/plugins/cmp.lua36
-rw-r--r--lua/getchoo/plugins/general.lua55
-rw-r--r--lua/getchoo/plugins/init.lua3
-rw-r--r--lua/getchoo/plugins/lsp.lua26
-rw-r--r--lua/getchoo/plugins/lspconfig.lua47
-rw-r--r--lua/getchoo/plugins/lualine.lua6
-rw-r--r--lua/getchoo/plugins/neo-tree.lua5
-rw-r--r--lua/getchoo/plugins/null-ls.lua49
-rw-r--r--lua/getchoo/plugins/ui.lua40
-rw-r--r--neovim.nix135
42 files changed, 682 insertions, 681 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 36e806e..5beff00 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -2,7 +2,7 @@ name: CI
on:
push:
- branches: ["main"]
+ branches: [main]
pull_request:
workflow_dispatch:
@@ -10,14 +10,17 @@ jobs:
build:
strategy:
matrix:
- os: [macos-latest]
include:
+ - os: macos-latest
+ arch: x86_64
+
- os: ubuntu-latest
- arch: "x86_64"
+ arch: x86_64
- os: ubuntu-latest
- arch: "aarch64"
+ arch: aarch64
+ name: Build (${{ matrix.os }}/${{ matrix.arch }})
runs-on: ${{ matrix.os }}
continue-on-error: true
@@ -47,11 +50,12 @@ jobs:
if: matrix.arch != 'aarch64'
run: nix build -L
- - name: Run ARM build
+ - name: Run build
if: matrix.arch == 'aarch64'
- run: nix build -Lv .#packages.${{ matrix.arch }}-linux.default
+ run: nix build -L .#packages.${{ matrix.arch }}-linux.default
check:
+ name: Check flake
runs-on: ubuntu-latest
steps:
@@ -64,4 +68,4 @@ jobs:
uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Run check
- run: nix flake check --show-trace
+ run: nix flake check -L --show-trace
diff --git a/.github/workflows/flakehub-publish.yaml b/.github/workflows/flakehub-publish.yaml
new file mode 100644
index 0000000..5b920d6
--- /dev/null
+++ b/.github/workflows/flakehub-publish.yaml
@@ -0,0 +1,24 @@
+name: Flakehub publish
+
+on:
+ push:
+ branches: [main]
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+
+ permissions:
+ id-token: write
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Nix
+ uses: DeterminateSystems/nix-installer-action@v9
+
+ - name: Push to Flakehub
+ uses: DeterminateSystems/flakehub-push@v3
+ with:
+ visibility: "public"
+ rolling: true
diff --git a/.github/workflows/update-lock.yaml b/.github/workflows/update-lock.yaml
new file mode 100644
index 0000000..8c14410
--- /dev/null
+++ b/.github/workflows/update-lock.yaml
@@ -0,0 +1,30 @@
+name: Update flake.lock
+
+on:
+ schedule:
+ # run every saturday at 0:00 utc
+ - cron: "0 0 * * 6"
+ workflow_dispatch:
+
+jobs:
+ update:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Nix
+ uses: DeterminateSystems/nix-installer-action@v9
+
+ - name: Update lockfile & make PR
+ uses: DeterminateSystems/update-flake-lock@v20
+ id: update
+ with:
+ token: ${{ secrets.MERGE_TOKEN }}
+
+ - name: Enable auto-merge
+ shell: bash
+ run: gh pr merge --auto --rebase "$PR_ID"
+ env:
+ GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}
+ PR_ID: ${{ steps.update.outputs.pull-request-number }}
diff --git a/.gitignore b/.gitignore
index 76797ef..a3149df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,6 @@ repl-result-out*
# dev shell artifacts
.direnv
.pre-commit-config.yaml
+
+# vimnix artifacts
+generated.lua
diff --git a/.luarc.json b/.luarc.json
deleted file mode 100644
index 23b9ee2..0000000
--- a/.luarc.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "workspace.checkThirdParty": false
-} \ No newline at end of file
diff --git a/config/default.nix b/config/default.nix
new file mode 100644
index 0000000..79756d6
--- /dev/null
+++ b/config/default.nix
@@ -0,0 +1,32 @@
+{pkgs, ...}: {
+ imports = [
+ ./plugins
+ ./keymaps.nix
+ ];
+
+ config = {
+ clipboard.providers.wl-copy.enable = pkgs.stdenv.isLinux;
+
+ colorschemes.catppuccin = {
+ enable = true;
+ flavour = "mocha";
+
+ disableItalic = true;
+ };
+
+ enableMan = false;
+
+ globals = {
+ mapleader = ",";
+ };
+
+ options = {
+ shiftwidth = 2;
+ tabstop = 2;
+ smartindent = true;
+ wrap = true;
+ syntax = "on";
+ termguicolors = true;
+ };
+ };
+}
diff --git a/config/keymaps.nix b/config/keymaps.nix
new file mode 100644
index 0000000..231da71
--- /dev/null
+++ b/config/keymaps.nix
@@ -0,0 +1,82 @@
+{lib, ...}: let
+ setBind = lib.recursiveUpdate {
+ mode = "n";
+ lua = true;
+ options = {
+ noremap = true;
+ silent = true;
+ };
+ };
+in {
+ keymaps = map setBind (
+ [
+ {
+ key = "<leader>t";
+ action = ''
+ function()
+ require("neo-tree.command").execute({
+ toggle = true,
+ dir = vim.loop.cwd()
+ })
+ end
+ '';
+ }
+
+ {
+ mode = ["n" "o" "x"];
+ key = "s";
+ action = ''
+ function()
+ require("flash").jump()
+ end
+ '';
+ }
+
+ {
+ key = "<leader>q";
+ action = ''
+ function()
+ vim.cmd("BufferLinePickClose")
+ end
+ '';
+ }
+
+ {
+ key = "<leader>f";
+ action = ''
+ function()
+ vim.cmd("Telescope")
+ end
+ '';
+ }
+
+ {
+ key = "<leader>p";
+ action = ''
+ function()
+ vim.cmd("TroubleToggle")
+ end
+ '';
+ }
+
+ {
+ key = "<leader>z";
+ action = ''
+ function()
+ vim.cmd("FormatToggle")
+ end
+ '';
+ }
+ ]
+ ++ (
+ map (n: {
+ key = "<leader>${toString n}";
+ action = ''
+ function()
+ vim.cmd("BufferLineGoToBuffer ${toString n}")
+ end
+ '';
+ }) (lib.range 1 9)
+ )
+ );
+}
diff --git a/config/plugins/bufferline.nix b/config/plugins/bufferline.nix
new file mode 100644
index 0000000..fe1cd17
--- /dev/null
+++ b/config/plugins/bufferline.nix
@@ -0,0 +1,19 @@
+{
+ plugins.bufferline = {
+ enable = true;
+
+ alwaysShowBufferline = false;
+ diagnostics = "nvim_lsp";
+ mode = "buffers";
+ numbers = "ordinal";
+ separatorStyle = "slant";
+ offsets = [
+ {
+ filetype = "neo-tree";
+ text = "neo-tree";
+ highlight = "Directory";
+ text_align = "left";
+ }
+ ];
+ };
+}
diff --git a/config/plugins/cmp.nix b/config/plugins/cmp.nix
new file mode 100644
index 0000000..85c9513
--- /dev/null
+++ b/config/plugins/cmp.nix
@@ -0,0 +1,31 @@
+{
+ plugins = {
+ nvim-cmp = {
+ enable = true;
+
+ completion = {
+ completeopt = "menu,menuone,noinsert";
+ };
+
+ mapping = {
+ "<C-n>" = "cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })";
+ "<C-p>" = "cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert })";
+ "<C-b>" = "cmp.mapping.scroll_docs(-4)";
+ "<C-f>" = "cmp.mapping.scroll_docs(4)";
+ "<C-Space>" = "cmp.mapping.complete()";
+ "<C-e>" = "cmp.mapping.abort()";
+ "<CR>" = "cmp.mapping.confirm({ select = true })";
+ "<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true})";
+ };
+
+ snippet.expand = "luasnip";
+
+ sources = map (name: {inherit name;}) [
+ "nvim_lsp"
+ "luasnip"
+ "async_path"
+ "buffer"
+ ];
+ };
+ };
+}
diff --git a/config/plugins/default.nix b/config/plugins/default.nix
new file mode 100644
index 0000000..229942e
--- /dev/null
+++ b/config/plugins/default.nix
@@ -0,0 +1,12 @@
+{
+ # import all files besides those prefixed with `_`
+ imports = builtins.map (file: ./${file}) (
+ builtins.filter (
+ name: name != "default.nix" && (builtins.substring 0 1 name) != "_"
+ ) (
+ builtins.attrNames (
+ builtins.readDir ./.
+ )
+ )
+ );
+}
diff --git a/config/plugins/efmls.nix b/config/plugins/efmls.nix
new file mode 100644
index 0000000..b4740ac
--- /dev/null
+++ b/config/plugins/efmls.nix
@@ -0,0 +1,100 @@
+{
+ plugins = {
+ lsp.servers.efm.extraOptions = {
+ init_options.documentFormatting = true;
+ };
+
+ efmls-configs = {
+ enable = true;
+
+ externallyManagedPackages = ["prettier_eslint"];
+
+ setup = {
+ all = {
+ linter = [
+ "alex"
+ "codespell"
+ ];
+ };
+
+ bash = {
+ formatter = "beautysh";
+ linter = "shellcheck";
+ };
+
+ css = {
+ formatter = "prettier_d";
+ };
+
+ fish = {
+ formatter = "fish_indent";
+ };
+
+ html = {
+ formatter = "prettier_d";
+ };
+
+ javascript = {
+ formatter = "prettier_eslint";
+ linter = "eslint_d";
+ };
+
+ json = {
+ formatter = "prettier_d";
+ };
+
+ lua = {
+ formatter = "stylua";
+ };
+
+ nix = {
+ formatter = "alejandra";
+ linter = "statix";
+ };
+
+ python = {
+ formatter = [
+ "ruff"
+ "isort"
+ ];
+
+ linter = [
+ "mypy"
+ "pylint"
+ ];
+ };
+
+ rust = {
+ formatter = "rustfmt";
+ };
+
+ sass = {
+ formatter = "prettier_d";
+ };
+
+ scss = {
+ formatter = "prettier_d";
+ };
+
+ sh = {
+ formatter = ["beautysh" "shellharden"];
+ linter = "shellcheck";
+ };
+
+ typescript = {
+ formatter = "prettier_eslint";
+ linter = "eslint_d";
+ };
+
+ yaml = {
+ formatter = "prettier";
+ linter = "actionlint";
+ };
+
+ zsh = {
+ formatter = "beautysh";
+ };
+ };
+ };
+ };
+}
diff --git a/config/plugins/fidget.nix b/config/plugins/fidget.nix
new file mode 100644
index 0000000..5d0a033
--- /dev/null
+++ b/config/plugins/fidget.nix
@@ -0,0 +1,5 @@
+{
+ plugins.fidget = {
+ enable = true;
+ };
+}
diff --git a/config/plugins/flash.nix b/config/plugins/flash.nix
new file mode 100644
index 0000000..87446e9
--- /dev/null
+++ b/config/plugins/flash.nix
@@ -0,0 +1,5 @@
+{
+ plugins.flash = {
+ enable = true;
+ };
+}
diff --git a/config/plugins/gitsigns.nix b/config/plugins/gitsigns.nix
new file mode 100644
index 0000000..8ba3e72
--- /dev/null
+++ b/config/plugins/gitsigns.nix
@@ -0,0 +1,5 @@
+{
+ plugins.gitsigns = {
+ enable = true;
+ };
+}
diff --git a/config/plugins/ibl.nix b/config/plugins/ibl.nix
new file mode 100644
index 0000000..d794a6a
--- /dev/null
+++ b/config/plugins/ibl.nix
@@ -0,0 +1,22 @@
+{
+ plugins.indent-blankline = {
+ enable = true;
+
+ exclude.filetypes = [
+ "help"
+ "neo-tree"
+ "Trouble"
+ "lazy"
+ "mason"
+ "notify"
+ "toggleterm"
+ ];
+
+ indent = {
+ char = "│";
+ tabChar = "│";
+ };
+
+ scope.enabled = false;
+ };
+}
diff --git a/config/plugins/lsp-format.nix b/config/plugins/lsp-format.nix
new file mode 100644
index 0000000..af2ab05
--- /dev/null
+++ b/config/plugins/lsp-format.nix
@@ -0,0 +1,5 @@
+{
+ plugins.lsp-format = {
+ enable = true;
+ };
+}
diff --git a/config/plugins/lsp.nix b/config/plugins/lsp.nix
new file mode 100644
index 0000000..c2648db
--- /dev/null
+++ b/config/plugins/lsp.nix
@@ -0,0 +1,54 @@
+{lib, ...}: {
+ plugins.lsp = {
+ enable = true;
+
+ capabilities = ''
+ capabilities = vim.tbl_deep_extend(
+ "force",
+ require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
+ { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } }
+ )
+ '';
+
+ keymaps = {
+ diagnostic = {
+ "<leader>e" = "open_float";
+ "[d" = "goto_prev";
+ "]d" = "goto_next";
+ "<leader>u" = "setloclist";
+ };
+ };
+
+ servers = let
+ withDefaultOpts = lib.genAttrs [
+ "bashls"
+ "lua-ls"
+ "nil_ls"
+ ] (_: {enable = true;});
+
+ optionalOpts = {
+ enable = true;
+ installLanguageServer = false;
+ autostart = false;
+ };
+
+ optional = lib.genAttrs [
+ "clangd"
+ "eslint"
+ "pyright"
+ "rust-analyzer"
+ "tsserver"
+ ] (_: optionalOpts);
+ in
+ withDefaultOpts
+ // optional
+ // {
+ rust-analyzer =
+ optionalOpts
+ // {
+ installRustc = false;
+ installCargo = false;
+ };
+ };
+ };
+}
diff --git a/config/plugins/lualine.nix b/config/plugins/lualine.nix
new file mode 100644
index 0000000..43e2128
--- /dev/null
+++ b/config/plugins/lualine.nix
@@ -0,0 +1,8 @@
+{
+ plugins.lualine = {
+ enable = true;
+
+ theme = "catppuccin";
+ extensions = ["neo-tree" "trouble"];
+ };
+}
diff --git a/config/plugins/mini.nix b/config/plugins/mini.nix
new file mode 100644
index 0000000..48bb0ed
--- /dev/null
+++ b/config/plugins/mini.nix
@@ -0,0 +1,36 @@
+{
+ plugins.mini = {
+ enable = true;
+
+ modules = {
+ comment = {};
+ pairs = {};
+ indentscope = {
+ options.try_as_border = true;
+ };
+ };
+ };
+
+ autoCmd = [
+ {
+ event = ["FileType"];
+ pattern = [
+ "help"
+ "neo-tree"
+ "Trouble"
+ "lazy"
+ "mason"
+ "notify"
+ "toggleterm"
+ ];
+
+ callback = {
+ __raw = ''
+ function()
+ vim.b.miniindentscope_disable = true
+ end
+ '';
+ };
+ }
+ ];
+}
diff --git a/config/plugins/neo-tree.nix b/config/plugins/neo-tree.nix
new file mode 100644
index 0000000..f99df9e
--- /dev/null
+++ b/config/plugins/neo-tree.nix
@@ -0,0 +1,11 @@
+{
+ plugins.neo-tree = {
+ enable = true;
+
+ extraOptions = {
+ filetype_exclude = ["help" "neo-tree" "Trouble" "lazy" "mason" "notify" "toggleterm"];
+ show_current_context = false;
+ show_trailing_blankline_indent = false;
+ };
+ };
+}
diff --git a/config/plugins/treesitter.nix b/config/plugins/treesitter.nix
new file mode 100644
index 0000000..047bd17
--- /dev/null
+++ b/config/plugins/treesitter.nix
@@ -0,0 +1,25 @@
+{
+ pkgs,
+ self,
+ ...
+}: {
+ extraPlugins = [pkgs.vimPlugins.vim-just];
+
+ plugins = {
+ treesitter = {
+ enable = true;
+
+ grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars ++ [self.tree-sitter-just];
+
+ indent = true;
+ nixvimInjections = true;
+ };
+
+ ts-context-commentstring = {
+ enable = true;
+ disableAutoInitialization = true;
+ };
+
+ ts-autotag.enable = true;
+ };
+}
diff --git a/config/plugins/trouble.nix b/config/plugins/trouble.nix
new file mode 100644
index 0000000..343c92f
--- /dev/null
+++ b/config/plugins/trouble.nix
@@ -0,0 +1,5 @@
+{
+ plugins.trouble = {
+ enable = true;
+ };
+}
diff --git a/config/plugins/which-key.nix b/config/plugins/which-key.nix
new file mode 100644
index 0000000..ef43fc4
--- /dev/null
+++ b/config/plugins/which-key.nix
@@ -0,0 +1,9 @@
+{
+ plugins.which-key = {
+ enable = true;
+
+ plugins = {
+ spelling.enabled = true;
+ };
+ };
+}
diff --git a/dev.nix b/dev.nix
deleted file mode 100644
index 5398d36..0000000
--- a/dev.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- perSystem = {
- config,
- pkgs,
- ...
- }: {
- devShells.default = pkgs.mkShell {
- shellHook = config.pre-commit.installationScript;
-
- packages = with pkgs; [
- actionlint
- alejandra
- deadnix
- nil
- statix
- stylua
- ];
- };
-
- formatter = pkgs.alejandra;
-
- pre-commit.settings.hooks = {
- actionlint.enable = true;
- alejandra.enable = true;
- deadnix.enable = true;
- nil.enable = true;
- statix.enable = true;
- stylua.enable = true;
- };
- };
-}
diff --git a/flake.lock b/flake.lock
index 7cca579..fcb2c0d 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,126 +1,48 @@
{
"nodes": {
- "flake-compat": {
- "flake": false,
- "locked": {
- "lastModified": 1673956053,
- "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
- "owner": "edolstra",
- "repo": "flake-compat",
- "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
- "type": "github"
- },
- "original": {
- "owner": "edolstra",
- "repo": "flake-compat",
- "type": "github"
- }
- },
- "flake-utils": {
- "inputs": {
- "systems": "systems"
- },
- "locked": {
- "lastModified": 1685518550,
- "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
- "gitignore": {
- "inputs": {
- "nixpkgs": [
- "pre-commit",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1660459072,
- "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
- "owner": "hercules-ci",
- "repo": "gitignore.nix",
- "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
- "type": "github"
- },
- "original": {
- "owner": "hercules-ci",
- "repo": "gitignore.nix",
- "type": "github"
- }
- },
"nixpkgs": {
"locked": {
- "lastModified": 1700794826,
- "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8",
- "type": "github"
- },
- "original": {
- "id": "nixpkgs",
- "ref": "nixos-unstable",
- "type": "indirect"
- }
- },
- "parts": {
- "inputs": {
- "nixpkgs-lib": [
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1698882062,
- "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=",
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877",
- "type": "github"
+ "lastModified": 1702312524,
+ "narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=",
+ "rev": "a9bf124c46ef298113270b1f84a164865987a91c",
+ "revCount": 558881,
+ "type": "tarball",
+ "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.558881%2Brev-a9bf124c46ef298113270b1f84a164865987a91c/018c5fba-8d93-798c-8bda-4b11a431ccba/source.tar.gz"
},
"original": {
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "type": "github"
+ "type": "tarball",
+ "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz"
}
},
- "pre-commit": {
+ "nixvim": {
"inputs": {
- "flake-compat": "flake-compat",
- "flake-utils": "flake-utils",
- "gitignore": "gitignore",
+ "flake-utils": [
+ "utils"
+ ],
"nixpkgs": [
"nixpkgs"
],
- "nixpkgs-stable": [
- "nixpkgs"
- ]
+ "pre-commit-hooks": []
},
"locked": {
- "lastModified": 1700922917,
- "narHash": "sha256-ej2fch/T584b5K9sk1UhmZF7W6wEfDHuoUYpFN8dtvM=",
- "owner": "cachix",
- "repo": "pre-commit-hooks.nix",
- "rev": "e5ee5c5f3844550c01d2131096c7271cec5e9b78",
- "type": "github"
+ "lastModified": 1702653568,
+ "narHash": "sha256-SwrNBw/1/oMURAa9/8MdvC4b3UYohoMAvSazeIt3hkg=",
+ "rev": "b3fb1c4c8189bc873911da3f31d18082a0721fa9",
+ "revCount": 825,
+ "type": "tarball",
+ "url": "https://api.flakehub.com/f/pinned/nix-community/nixvim/0.1.825%2Brev-b3fb1c4c8189bc873911da3f31d18082a0721fa9/018c6e10-497a-79c6-be0a-722960db4fbf/source.tar.gz"
},
"original": {
- "owner": "cachix",
- "repo": "pre-commit-hooks.nix",
- "type": "github"
+ "type": "tarball",
+ "url": "https://flakehub.com/f/nix-community/nixvim/0.1.%2A.tar.gz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
- "parts": "parts",
- "pre-commit": "pre-commit"
+ "nixvim": "nixvim",
+ "tree-sitter-just": "tree-sitter-just",
+ "utils": "utils"
}
},
"systems": {
@@ -137,6 +59,39 @@
"repo": "default",
"type": "github"
}
+ },
+ "tree-sitter-just": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1679148267,
+ "narHash": "sha256-Qs0Klt9uj6Vgs4vJrjKXYD8nNe8KYdWCnADvogm4/l0=",
+ "owner": "IndianBoy42",
+ "repo": "tree-sitter-just",
+ "rev": "4e5f5f3ff37b12a1bbf664eb3966b3019e924594",
+ "type": "github"
+ },
+ "original": {
+ "owner": "IndianBoy42",
+ "repo": "tree-sitter-just",
+ "type": "github"
+ }
+ },
+ "utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1701680307,
+ "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
+ "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
+ "revCount": 88,
+ "type": "tarball",
+ "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.88%2Brev-4022d587cbbfd70fe950c1e2083a02621806a725/018c340d-3287-7c66-818b-f2f646a808e3/source.tar.gz"
+ },
+ "original": {
+ "type": "tarball",
+ "url": "https://flakehub.com/f/numtide/flake-utils/0.1.88.tar.gz"
+ }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index 5ee48a6..6967818 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,35 +2,102 @@
description = "getchoo's neovim config";
inputs = {
- nixpkgs.url = "nixpkgs/nixos-unstable";
+ nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz";
+ utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.88.tar.gz";
- parts = {
- url = "github:hercules-ci/flake-parts";
- inputs.nixpkgs-lib.follows = "nixpkgs";
- };
-
- pre-commit = {
- url = "github:cachix/pre-commit-hooks.nix";
+ nixvim = {
+ url = "https://flakehub.com/f/nix-community/nixvim/0.1.*.tar.gz";
inputs = {
nixpkgs.follows = "nixpkgs";
- nixpkgs-stable.follows = "nixpkgs";
+ flake-utils.follows = "utils";
+ pre-commit-hooks.follows = "";
};
};
- };
- outputs = {parts, ...} @ inputs:
- parts.lib.mkFlake {inherit inputs;} {
- imports = [
- inputs.pre-commit.flakeModule
- ./dev.nix
- ./neovim.nix
- ];
-
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
+ tree-sitter-just = {
+ url = "github:IndianBoy42/tree-sitter-just";
+ flake = false;
};
+ };
+
+ outputs = {
+ nixpkgs,
+ utils,
+ nixvim,
+ tree-sitter-just,
+ ...
+ }:
+ utils.lib.eachDefaultSystem (system: let
+ pkgs = nixpkgs.legacyPackages.${system};
+ inherit (pkgs) lib;
+ in rec {
+ checks = {
+ check-actionlint =
+ pkgs.runCommand "check-actionlint" {
+ nativeBuildInputs = [pkgs.actionlint];
+ } ''
+ actionlint ${./.}/.github/workflows/*
+ touch $out
+ '';
+
+ "check-${formatter.pname}" =
+ pkgs.runCommand "check-${formatter.pname}" {
+ nativeBuildInputs = [formatter];
+ } ''
+ ${lib.getExe formatter} --check ${./.}
+ touch $out
+ '';
+
+ check-statix =
+ pkgs.runCommand "check-statix" {
+ nativeBuildInputs = [pkgs.statix];
+ }
+ ''
+ statix check ${./.}
+ touch $out
+ '';
+
+ check-nil =
+ pkgs.runCommand "check-nil" {
+ nativeBuildInputs = with pkgs; [fd git nil];
+ }
+ ''
+ cd ${./.}
+ fd . -e 'nix' | while read -r file; do
+ nil diagnostics "$file"
+ done
+
+ touch $out
+ '';
+ };
+
+ devShells = {
+ default = pkgs.mkShell {
+ packages = with pkgs; [
+ actionlint
+ formatter
+ deadnix
+ nil
+ statix
+ ];
+ };
+ };
+
+ formatter = pkgs.alejandra;
+
+ packages = {
+ nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule {
+ module = ./config;
+ extraSpecialArgs = {self = packages;};
+ };
+
+ tree-sitter-just = pkgs.tree-sitter.buildGrammar {
+ language = "just";
+ version = builtins.substring 0 8 tree-sitter-just.lastModifiedDate;
+ src = tree-sitter-just;
+ };
+
+ default = packages.nvim;
+ };
+ });
}
diff --git a/lua/getchoo/globals.lua b/lua/getchoo/globals.lua
deleted file mode 100644
index 79db9e3..0000000
--- a/lua/getchoo/globals.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.g.mapleader = ","
diff --git a/lua/getchoo/init.lua b/lua/getchoo/init.lua
deleted file mode 100644
index e7b816f..0000000
--- a/lua/getchoo/init.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-require("getchoo.globals")
-require("getchoo.keymaps")
-require("getchoo.options")
-require("getchoo.plugins")
diff --git a/lua/getchoo/keymaps.lua b/lua/getchoo/keymaps.lua
deleted file mode 100644
index 8068db9..0000000
--- a/lua/getchoo/keymaps.lua
+++ /dev/null
@@ -1,47 +0,0 @@
-local opts = { noremap = true, silent = true }
-local set = function(mode, key, vimcmd)
- vim.keymap.set(mode, key, vimcmd, opts)
-end
-
-if pcall(require, "neo-tree.command") then
- set("n", "<leader>t", function()
- require("neo-tree.command").execute({
- toggle = true,
- dir = vim.loop.cwd(),
- })
- end)
-end
-
-if pcall(require, "flash") then
- set({ "n", "o", "x" }, "s", function()
- require("flash").jump()
- end)
-end
-
-for i = 1, 9 do
- set("n", "<leader>" .. i, function()
- local vimcmd = "BufferLineGoToBuffer " .. i
- vim.cmd(vimcmd)
- end)
-end
-
-set("n", "<leader>q", function()
- vim.cmd("BufferLinePickClose")
-end)
-
-set("n", "<leader>e", vim.diagnostic.open_float)
-set("n", "[d", vim.diagnostic.goto_prev)
-set("n", "]d", vim.diagnostic.goto_next)
-set("n", "<leader>u", vim.diagnostic.setloclist)
-
-set("n", "<leader>f", function()
- vim.cmd("Telescope")
-end)
-
-set("n", "<leader>p", function()
- vim.cmd("TroubleToggle")
-end)
-
-set("n", "<leader>z", function()
- vim.api.nvim_clear_autocmds({ group = "LspFormatting" })
-end)
diff --git a/lua/getchoo/options.lua b/lua/getchoo/options.lua
deleted file mode 100644
index 7a13888..0000000
--- a/lua/getchoo/options.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local opt = vim.opt
-
--- text options
-opt.tabstop = 2
-opt.shiftwidth = 2
-opt.expandtab = false
-opt.smartindent = true
-opt.wrap = true
-
--- appearance
-opt.syntax = "on"
-opt.termguicolors = true
diff --git a/lua/getchoo/plugins/bufferline.lua b/lua/getchoo/plugins/bufferline.lua
deleted file mode 100644
index b945a62..0000000
--- a/lua/getchoo/plugins/bufferline.lua
+++ /dev/null
@@ -1,18 +0,0 @@
-require("bufferline").setup({
- options = {
- always_show_bufferline = false,
- highlights = require("catppuccin.groups.integrations.bufferline").get(),
- diagnostics = "nvim_lsp",
- mode = "buffers",
- numbers = "ordinal",
- separator_style = "slant",
- offsets = {
- {
- filetype = "neo-tree",
- text = "neo-tree",
- highlight = "Directory",
- text_align = "left",
- },
- },
- },
-})
diff --git a/lua/getchoo/plugins/catppuccin.lua b/lua/getchoo/plugins/catppuccin.lua
deleted file mode 100644
index 853d283..0000000
--- a/lua/getchoo/plugins/catppuccin.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-local compile_path = vim.fn.stdpath("cache") .. "/catppuccin-nvim"
-vim.fn.mkdir(compile_path, "p")
-vim.opt.runtimepath:append(compile_path)
-
-require("catppuccin").setup({
- compile_path = compile_path,
- flavour = "mocha", -- mocha, macchiato, frappe, latte
- integrations = {
- cmp = true,
- flash = true,
- gitsigns = true,
- indent_blankline = {
- enabled = true,
- },
- lsp_trouble = true,
- native_lsp = {
- enabled = true,
- },
- neotree = true,
- notify = true,
- treesitter_context = true,
- treesitter = true,
- telescope = true,
- which_key = true,
- },
-
- no_italic = true,
-})
-
-vim.cmd.colorscheme("catppuccin")
diff --git a/lua/getchoo/plugins/cmp.lua b/lua/getchoo/plugins/cmp.lua
deleted file mode 100644
index 323e342..0000000
--- a/lua/getchoo/plugins/cmp.lua
+++ /dev/null
@@ -1,36 +0,0 @@
-local cmp = require("cmp")
-local luasnip = require("luasnip")
-local mapping = cmp.mapping
-
-require("cmp").setup({
- completion = {
- completeopt = "menu,menuone,noinsert",
- },
-
- snippet = {
- expand = function(args)
- luasnip.lsp_expand(args.body)
- end,
- },
-
- mapping = mapping.preset.insert({
- ["<C-n>"] = mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
- ["<C-p>"] = mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
- ["<C-b>"] = mapping.scroll_docs(-4),
- ["<C-f>"] = mapping.scroll_docs(4),
- ["<C-Space>"] = mapping.complete(),
- ["<C-e>"] = mapping.abort(),
- ["<CR>"] = mapping.confirm({ select = true }),
- ["<S-CR>"] = mapping.confirm({
- behavior = cmp.ConfirmBehavior.Replace,
- select = true,
- }),
- }),
-
- sources = cmp.config.sources({
- { name = "nvim_lsp" },
- { name = "luasnip" },
- { name = "async_path" },
- { name = "buffer" },
- }),
-})
diff --git a/lua/getchoo/plugins/general.lua b/lua/getchoo/plugins/general.lua
deleted file mode 100644
index e9806f3..0000000
--- a/lua/getchoo/plugins/general.lua
+++ /dev/null
@@ -1,55 +0,0 @@
-require("getchoo.plugins.bufferline")
-require("getchoo.plugins.catppuccin")
-require("getchoo.plugins.lualine")
-require("getchoo.plugins.neo-tree")
-
----- gitsigns
-require("gitsigns").setup()
-
----- indent-blankline.nvim
-require("ibl").setup({
- exclude = {
- filetypes = {
- "help",
- "neo-tree",
- "Trouble",
- "lazy",
- "mason",
- "notify",
- "toggleterm",
- },
- },
-
- indent = {
- char = "│",
- tab_char = "│",
- },
-
- scope = { enabled = false },
-})
-
----- mini.nvim
-require("mini.pairs").setup()
-require("mini.indentscope").setup({
- options = { try_as_border = true },
-})
-
-vim.api.nvim_create_autocmd("FileType", {
- pattern = {
- "help",
- "neo-tree",
- "Trouble",
- "lazy",
- "mason",
- "notify",
- "toggleterm",
- },
- callback = function()
- vim.b.miniindentscope_disable = true
- end,
-})
-
----- which-key
-require("which-key").setup({
- plugins = { spelling = true },
-})
diff --git a/lua/getchoo/plugins/init.lua b/lua/getchoo/plugins/init.lua
deleted file mode 100644
index 95883c7..0000000
--- a/lua/getchoo/plugins/init.lua
+++ /dev/null
@@ -1,3 +0,0 @@
-require("getchoo.plugins.general")
-require("getchoo.plugins.lsp")
-require("getchoo.plugins.ui")
diff --git a/lua/getchoo/plugins/lsp.lua b/lua/getchoo/plugins/lsp.lua
deleted file mode 100644
index 1732679..0000000
--- a/lua/getchoo/plugins/lsp.lua
+++ /dev/null
@@ -1,26 +0,0 @@
-require("getchoo.plugins.cmp")
-require("getchoo.plugins.lspconfig")
-require("getchoo.plugins.null-ls")
-
-require("gitsigns").setup()
-
-require("fidget").setup()
-
-require("mini.comment").setup({
- options = {
- custom_commentstring = function()
- return require("ts_context_commentstring.internal").calculate_commentstring()
- or vim.bo.context_commentstring
- end,
- },
-})
-
-require("nvim-treesitter.configs").setup({
- auto_install = false,
- highlight = { enable = true },
- indent = { enable = true },
-})
-
-vim.g.skip_ts_context_commentstring_module = true
-
-require("trouble").setup()
diff --git a/lua/getchoo/plugins/lspconfig.lua b/lua/getchoo/plugins/lspconfig.lua
deleted file mode 100644
index 8811e3f..0000000
--- a/lua/getchoo/plugins/lspconfig.lua
+++ /dev/null
@@ -1,47 +0,0 @@
-local sources = {
- ["bashls"] = "bash-language-server",
- ["clangd"] = "clangd",
- ["eslint"] = "eslint",
- ["nil_ls"] = "nil",
- ["pyright"] = "pyright-langserver",
- ["rust_analyzer"] = "rust-analyzer",
- ["tsserver"] = "typescript-language-server",
-}
-
-local capabilities = vim.tbl_deep_extend(
- "force",
- require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
- { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } }
-)
-
-local all_config = {
- capabilities = capabilities,
-}
-
-local servers = {}
-for server, binary in pairs(sources) do
- if vim.fn.executable(binary) == 1 then
- servers[server] = all_config
- end
-end
-
-servers["lua_ls"] = {
- capabilities = capabilities,
- settings = {
- Lua = {
- runtime = {
- version = "LuaJIT",
- },
- diagnostics = {
- globals = { "vim" },
- },
- workspace = {
- library = vim.api.nvim_get_runtime_file("", true),
- },
- },
- },
-}
-
-for server, settings in pairs(servers) do
- require("lspconfig")[server].setup(settings)
-end
diff --git a/lua/getchoo/plugins/lualine.lua b/lua/getchoo/plugins/lualine.lua
deleted file mode 100644
index 2727d75..0000000
--- a/lua/getchoo/plugins/lualine.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-require("lualine").setup({
- options = {
- theme = "catppuccin",
- },
- extensions = { "neo-tree", "trouble" },
-})
diff --git a/lua/getchoo/plugins/neo-tree.lua b/lua/getchoo/plugins/neo-tree.lua
deleted file mode 100644
index 1d6f7f5..0000000
--- a/lua/getchoo/plugins/neo-tree.lua
+++ /dev/null
@@ -1,5 +0,0 @@
-require("neo-tree").setup({
- filetype_exclude = { "help", "neo-tree", "Trouble", "lazy", "mason", "notify", "toggleterm" },
- show_current_context = false,
- show_trailing_blankline_indent = false,
-})
diff --git a/lua/getchoo/plugins/null-ls.lua b/lua/getchoo/plugins/null-ls.lua
deleted file mode 100644
index a4f86dc..0000000
--- a/lua/getchoo/plugins/null-ls.lua
+++ /dev/null
@@ -1,49 +0,0 @@
-local null_ls = require("null-ls")
-local diagnostics = null_ls.builtins.diagnostics
-local formatting = null_ls.builtins.formatting
-
-local lsp_formatting = function(bufnr)
- vim.lsp.buf.format({
- filter = function(client)
- return client.name == "null-ls"
- end,
- bufnr = bufnr,
- })
-end
-
-local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
-
-null_ls.setup({
- on_attach = function(client, bufnr)
- if client.supports_method("textDocument/formatting") then
- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
- vim.api.nvim_create_autocmd("BufWritePre", {
- group = augroup,
- buffer = bufnr,
- callback = function()
- lsp_formatting(bufnr)
- end,
- })
- end
- end,
-
- sources = {
- diagnostics.actionlint,
- diagnostics.alex,
- diagnostics.codespell,
- diagnostics.deadnix,
- diagnostics.pylint,
- diagnostics.shellcheck,
- diagnostics.statix,
- formatting.alejandra,
- formatting.beautysh,
- formatting.codespell,
- formatting.just,
- formatting.nimpretty,
- formatting.prettier,
- formatting.rustfmt,
- formatting.shellharden,
- formatting.stylua,
- formatting.yapf,
- },
-})
diff --git a/lua/getchoo/plugins/ui.lua b/lua/getchoo/plugins/ui.lua
deleted file mode 100644
index 7a8c085..0000000
--- a/lua/getchoo/plugins/ui.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-require("dressing")
-
-vim.ui.select = function(...)
- return vim.ui.select(...)
-end
-
-vim.ui.input = function(...)
- return vim.ui.input(...)
-end
-
-vim.notify = require("notify")
-
-require("noice").setup({
- lsp = {
- override = {
- ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
- ["vim.lsp.util.stylize_markdown"] = true,
- ["cmp.entry.get_documentation"] = true,
- },
- },
- routes = {
- {
- filter = {
- event = "msg_show",
- any = {
- { find = "%d+L, %d+B" },
- { find = "; after #%d+" },
- { find = "; before #%d+" },
- },
- },
- view = "mini",
- },
- },
- presets = {
- bottom_search = true,
- command_palette = true,
- long_message_to_split = true,
- inc_rename = true,
- },
-})
diff --git a/neovim.nix b/neovim.nix
deleted file mode 100644
index 5aff6b2..0000000
--- a/neovim.nix
+++ /dev/null
@@ -1,135 +0,0 @@
-{self, ...}: {
- perSystem = {
- lib,
- pkgs,
- self',
- ...
- }: let
- plugins = with pkgs.vimPlugins; [
- # general
- catppuccin-nvim
-
- # TODO: don't pin when deprecation notice
- # is no longer in nixpkgs
- (fidget-nvim.overrideAttrs (_: {
- src = pkgs.fetchFromGitHub {
- owner = "j-hui";
- repo = "fidget.nvim";
- rev = "41f327b53c7977d47aee56f05e0bdbb4b994c5eb";
- hash = "sha256-v9qARsW8Gozit4Z3+igiemjI467QgRhwM+crqwO9r6U=";
- };
- }))
-
- flash-nvim
- gitsigns-nvim
- indent-blankline-nvim
- lualine-nvim
- neo-tree-nvim
- nvim-web-devicons
- mini-nvim
-
- # completion
- nvim-cmp
- cmp-nvim-lsp
- cmp-buffer
- cmp_luasnip
- cmp-async-path
- luasnip
-
- # ui
- dressing-nvim
- noice-nvim
- nui-nvim
- nvim-notify
-
- # lsp
- nvim-lspconfig
- null-ls-nvim
-
- # utils
- bufferline-nvim
- plenary-nvim
- telescope-nvim
- trouble-nvim
- which-key-nvim
-
- # treesitter
- (nvim-treesitter.withPlugins (
- _: nvim-treesitter.allGrammars ++ [self'.packages.tree-sitter-just]
- ))
- nvim-ts-context-commentstring
- vim-just
-
- # main config
- self'.packages.getchvim
- ];
-
- extraPrograms = with pkgs; [
- # external tools
- fd
- git
- ripgrep
- just
-
- # lint
- actionlint
- codespell
- deadnix
- nodePackages.alex
- shellcheck
- statix
-
- # format
- alejandra
- beautysh
- stylua
-
- # lsp
- nil
- sumneko-lua-language-server
- ];
-
- customRC = ''
- lua require("getchoo")
- '';
-
- config = pkgs.neovimUtils.makeNeovimConfig {
- withPython3 = true;
- withRuby = false;
- inherit plugins;
- inherit customRC;
- };
- in {
- packages = {
- default = self'.packages.neovim;
-
- neovim = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (
- config
- // {
- wrapperArgs =
- (lib.escapeShellArgs config.wrapperArgs)
- + " "
- + ''--suffix PATH : "${lib.makeBinPath extraPrograms}"'';
- }
- );
-
- getchvim = pkgs.vimUtils.buildVimPlugin {
- pname = "getchvim";
- version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
-
- src = lib.cleanSource ./.;
- };
-
- tree-sitter-just = pkgs.tree-sitter.buildGrammar {
- language = "just";
- version = "unstable-2023-03-18";
- src = pkgs.fetchFromGitHub {
- owner = "IndianBoy42";
- repo = "tree-sitter-just";
- rev = "4e5f5f3ff37b12a1bbf664eb3966b3019e924594";
- hash = "sha256-Qs0Klt9uj6Vgs4vJrjKXYD8nNe8KYdWCnADvogm4/l0=";
- };
- };
- };
- };
-}