├── .github └── workflows │ ├── check.yaml │ └── update.yaml ├── .gitignore ├── LICENSE ├── README.md ├── flake.lock ├── flake.nix └── tests.nix /.github/workflows/check.yaml: -------------------------------------------------------------------------------- 1 | name: check 2 | on: 3 | push: 4 | 5 | jobs: 6 | check: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v2 11 | 12 | - name: Install Nix 13 | uses: cachix/install-nix-action@v16 14 | with: 15 | nix_path: nixpkgs=channel:nixos-unstable 16 | 17 | - name: Run tests 18 | run: nix flake check 19 | -------------------------------------------------------------------------------- /.github/workflows/update.yaml: -------------------------------------------------------------------------------- 1 | name: update 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: "0 */2 * * *" 6 | push: 7 | 8 | jobs: 9 | update: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v2 14 | 15 | - name: Install Nix 16 | uses: cachix/install-nix-action@v16 17 | with: 18 | nix_path: nixpkgs=channel:nixos-unstable 19 | 20 | - name: Update flake 21 | run: "nix flake update" 22 | env: 23 | GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | 25 | - name: Commit changes 26 | uses: EndBug/add-and-commit@v7.5.0 27 | with: 28 | default_author: github_actions 29 | message: "Update flake" 30 | add: "flake.lock" 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | result* 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Neorg 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Neorg overlay for [Nixpkgs](https://github.com/NixOS/nixpkgs) 2 | 3 | This is a Nixpkgs overlay that gives Nix users access to unstable versions of Neorg and its associated projects. 4 | 5 | Nixpkgs already packages Neorg and the NFF Tree-sitter parser, however those are updated very rarely. This is a problem for rapidly growing projects such as Neorg and can cause the plugin and parser to go out-of-sync. This overlay is updated automatically every 2 hours and, apart from the base plugin and TS parser, provides additional Neorg-related packages. 6 | 7 | ## Installation 8 | 9 | For documentation on how overlays work and how to use them, refer to the [Nixpkgs Manual](https://nixos.org/manual/nixpkgs/stable/#chap-overlays). 10 | 11 | **Please note that as of right now only flake-based systems are supported**, an example of which you can see below. 12 | 13 | ## Example 14 | 15 | The following minimal NixOS [flake](https://nixos.wiki/wiki/Flakes) configures Neovim with Neorg and Tree-sitter support using [Home Manager](https://github.com/nix-community/home-manager): 16 | 17 | ```nix 18 | { 19 | inputs = { 20 | nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 21 | home-manager.url = "github:nix-community/home-manager"; 22 | neorg-overlay.url = "github:nvim-neorg/nixpkgs-neorg-overlay"; 23 | }; 24 | outputs = { self, nixpkgs, home-manager, neorg, ... }: { 25 | nixosConfigurations.machine = nixpkgs.lib.nixosSystem { 26 | system = "x86_64-linux"; 27 | modules = [ 28 | home-manager.nixosModules.home-manager 29 | { 30 | nixpkgs.overlays = [ neorg-overlay.overlays.default ]; 31 | home-manager.users.bandithedoge = { 32 | programs.neovim = { 33 | enable = true; 34 | plugins = with pkgs.vimPlugins; [ 35 | neorg 36 | 37 | # optional 38 | neorg-telescope 39 | 40 | # optional — only if you want additional grammars besides norg and 41 | # norg_meta, otherwise auto-required. 42 | # 43 | # N.b.: Don't use plain nvim-treesitter as it would result in no 44 | # grammars getting installed, always the withPlugins function. 45 | # The minimal form is nvim-treesitter.withPlugins (_: [ ]) — the norg 46 | # grammars are added automatically. 47 | # 48 | # For all available grammars, nvim-treesitter.withAllGrammars or the 49 | # equivalent nvim-treesitter.withPlugins (_: nvim-treesitter.allGrammars) 50 | # can be used. 51 | (nvim-treesitter.withPlugins (p: with p; [ 52 | # Keep calm and don't :TSInstall 53 | tree-sitter-lua 54 | ])) 55 | ]; 56 | extraConfig = '' 57 | lua << EOF 58 | require("nvim-treesitter.configs").setup { 59 | highlight = { 60 | enable = true, 61 | } 62 | } 63 | 64 | require("neorg").setup { 65 | load = { 66 | ["core.defaults"] = {} 67 | } 68 | } 69 | EOF 70 | ''; 71 | }; 72 | }; 73 | } 74 | ]; 75 | }; 76 | }; 77 | } 78 | ``` 79 | 80 | ## Package list 81 | 82 | - [`vimPlugins.neorg`](https://github.com/nvim-neorg/neorg) 83 | - [`vimPlugins.neorg-telescope`](https://github.com/nvim-neorg/neorg-telescope) 84 | - [`vimPlugins.nvim-treesitter.builtGrammars.tree-sitter-norg`](https://github.com/nvim-neorg/tree-sitter-norg) 85 | - [`vimPlugins.nvim-treesitter.builtGrammars.tree-sitter-norg-meta`](https://github.com/nvim-neorg/tree-sitter-norg-meta) 86 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-compat": { 4 | "flake": false, 5 | "locked": { 6 | "lastModified": 1641205782, 7 | "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", 8 | "owner": "edolstra", 9 | "repo": "flake-compat", 10 | "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", 11 | "type": "github" 12 | }, 13 | "original": { 14 | "owner": "edolstra", 15 | "repo": "flake-compat", 16 | "type": "github" 17 | } 18 | }, 19 | "flake-compat_2": { 20 | "flake": false, 21 | "locked": { 22 | "lastModified": 1641205782, 23 | "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", 24 | "owner": "edolstra", 25 | "repo": "flake-compat", 26 | "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", 27 | "type": "github" 28 | }, 29 | "original": { 30 | "owner": "edolstra", 31 | "repo": "flake-compat", 32 | "type": "github" 33 | } 34 | }, 35 | "flake-utils": { 36 | "inputs": { 37 | "systems": "systems" 38 | }, 39 | "locked": { 40 | "lastModified": 1731533236, 41 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 42 | "owner": "numtide", 43 | "repo": "flake-utils", 44 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 45 | "type": "github" 46 | }, 47 | "original": { 48 | "owner": "numtide", 49 | "repo": "flake-utils", 50 | "type": "github" 51 | } 52 | }, 53 | "flake-utils_2": { 54 | "locked": { 55 | "lastModified": 1644229661, 56 | "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", 57 | "owner": "numtide", 58 | "repo": "flake-utils", 59 | "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", 60 | "type": "github" 61 | }, 62 | "original": { 63 | "owner": "numtide", 64 | "repo": "flake-utils", 65 | "type": "github" 66 | } 67 | }, 68 | "flake-utils_3": { 69 | "locked": { 70 | "lastModified": 1644229661, 71 | "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", 72 | "owner": "numtide", 73 | "repo": "flake-utils", 74 | "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", 75 | "type": "github" 76 | }, 77 | "original": { 78 | "owner": "numtide", 79 | "repo": "flake-utils", 80 | "type": "github" 81 | } 82 | }, 83 | "neorg": { 84 | "flake": false, 85 | "locked": { 86 | "lastModified": 1747755429, 87 | "narHash": "sha256-07QhATJIWAXNEN8liiWFWRS/hMs59Xjs4MF2lpKoaOE=", 88 | "owner": "nvim-neorg", 89 | "repo": "neorg", 90 | "rev": "f8c932adf75ba65cd015cdbcf9ed1b96814cf55e", 91 | "type": "github" 92 | }, 93 | "original": { 94 | "owner": "nvim-neorg", 95 | "repo": "neorg", 96 | "type": "github" 97 | } 98 | }, 99 | "neorg-telescope": { 100 | "flake": false, 101 | "locked": { 102 | "lastModified": 1744866747, 103 | "narHash": "sha256-tvbskEQ3+uOUlGKdqAFMlbF5Vw0A08XTwuWEs2aP64o=", 104 | "owner": "nvim-neorg", 105 | "repo": "neorg-telescope", 106 | "rev": "7fb6ca6a632c3c095601d379a664c0c1f802dc6c", 107 | "type": "github" 108 | }, 109 | "original": { 110 | "owner": "nvim-neorg", 111 | "repo": "neorg-telescope", 112 | "type": "github" 113 | } 114 | }, 115 | "nixpkgs": { 116 | "locked": { 117 | "lastModified": 1748856973, 118 | "narHash": "sha256-RlTsJUvvr8ErjPBsiwrGbbHYW8XbB/oek0Gi78XdWKg=", 119 | "owner": "NixOS", 120 | "repo": "nixpkgs", 121 | "rev": "e4b09e47ace7d87de083786b404bf232eb6c89d8", 122 | "type": "github" 123 | }, 124 | "original": { 125 | "owner": "NixOS", 126 | "ref": "nixpkgs-unstable", 127 | "repo": "nixpkgs", 128 | "type": "github" 129 | } 130 | }, 131 | "nixpkgs_2": { 132 | "locked": { 133 | "lastModified": 1644486793, 134 | "narHash": "sha256-EeijR4guVHgVv+JpOX3cQO+1XdrkJfGmiJ9XVsVU530=", 135 | "owner": "NixOS", 136 | "repo": "nixpkgs", 137 | "rev": "1882c6b7368fd284ad01b0a5b5601ef136321292", 138 | "type": "github" 139 | }, 140 | "original": { 141 | "owner": "NixOS", 142 | "ref": "nixpkgs-unstable", 143 | "repo": "nixpkgs", 144 | "type": "github" 145 | } 146 | }, 147 | "nixpkgs_3": { 148 | "locked": { 149 | "lastModified": 1644486793, 150 | "narHash": "sha256-EeijR4guVHgVv+JpOX3cQO+1XdrkJfGmiJ9XVsVU530=", 151 | "owner": "NixOS", 152 | "repo": "nixpkgs", 153 | "rev": "1882c6b7368fd284ad01b0a5b5601ef136321292", 154 | "type": "github" 155 | }, 156 | "original": { 157 | "owner": "NixOS", 158 | "ref": "nixpkgs-unstable", 159 | "repo": "nixpkgs", 160 | "type": "github" 161 | } 162 | }, 163 | "norg": { 164 | "inputs": { 165 | "flake-compat": "flake-compat", 166 | "flake-utils": "flake-utils_2", 167 | "nixpkgs": "nixpkgs_2" 168 | }, 169 | "locked": { 170 | "lastModified": 1672582520, 171 | "narHash": "sha256-kv3UiJUqMSF1qd3r4OCWomVTHTYjwX/EBRWm8mOSdwg=", 172 | "owner": "nvim-neorg", 173 | "repo": "tree-sitter-norg", 174 | "rev": "d7a466e182a532065a559dbfc7a847271d5e9c29", 175 | "type": "github" 176 | }, 177 | "original": { 178 | "owner": "nvim-neorg", 179 | "ref": "dev", 180 | "repo": "tree-sitter-norg", 181 | "type": "github" 182 | } 183 | }, 184 | "norg-meta": { 185 | "inputs": { 186 | "flake-compat": "flake-compat_2", 187 | "flake-utils": "flake-utils_3", 188 | "nixpkgs": "nixpkgs_3" 189 | }, 190 | "locked": { 191 | "lastModified": 1713028366, 192 | "narHash": "sha256-8qSdwHlfnjFuQF4zNdLtU2/tzDRhDZbo9K54Xxgn5+8=", 193 | "owner": "nvim-neorg", 194 | "repo": "tree-sitter-norg-meta", 195 | "rev": "6f0510cc516a3af3396a682fbd6655486c2c9d2d", 196 | "type": "github" 197 | }, 198 | "original": { 199 | "owner": "nvim-neorg", 200 | "repo": "tree-sitter-norg-meta", 201 | "type": "github" 202 | } 203 | }, 204 | "root": { 205 | "inputs": { 206 | "flake-utils": "flake-utils", 207 | "neorg": "neorg", 208 | "neorg-telescope": "neorg-telescope", 209 | "nixpkgs": "nixpkgs", 210 | "norg": "norg", 211 | "norg-meta": "norg-meta" 212 | } 213 | }, 214 | "systems": { 215 | "locked": { 216 | "lastModified": 1681028828, 217 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 218 | "owner": "nix-systems", 219 | "repo": "default", 220 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 221 | "type": "github" 222 | }, 223 | "original": { 224 | "owner": "nix-systems", 225 | "repo": "default", 226 | "type": "github" 227 | } 228 | } 229 | }, 230 | "root": "root", 231 | "version": 7 232 | } 233 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 4 | 5 | flake-utils.url = "github:numtide/flake-utils"; 6 | 7 | norg.url = "github:nvim-neorg/tree-sitter-norg/dev"; 8 | norg-meta.url = "github:nvim-neorg/tree-sitter-norg-meta"; 9 | 10 | neorg = { 11 | url = "github:nvim-neorg/neorg"; 12 | flake = false; 13 | }; 14 | neorg-telescope = { 15 | url = "github:nvim-neorg/neorg-telescope"; 16 | flake = false; 17 | }; 18 | }; 19 | outputs = { 20 | self, 21 | nixpkgs, 22 | flake-utils, 23 | norg, 24 | norg-meta, 25 | neorg, 26 | neorg-telescope, 27 | ... 28 | }: 29 | { 30 | overlays.default = final: prev: let 31 | inherit (final.lib) attrValues elem filter filterAttrs isDerivation; 32 | in { 33 | vimPlugins = prev.vimPlugins.extend (f: p: { 34 | nvim-treesitter = let 35 | norgGrammars = { 36 | tree-sitter-norg = norg.defaultPackage.${final.system}; 37 | tree-sitter-norg-meta = norg-meta.defaultPackage.${final.system}; 38 | }; 39 | builtGrammars = (filterAttrs (_: isDerivation) p.nvim-treesitter.builtGrammars) // norgGrammars; 40 | allGrammars = attrValues builtGrammars; 41 | withPlugins = grammarFn: 42 | p.nvim-treesitter.withPlugins ( 43 | _: let 44 | plugins = grammarFn builtGrammars; 45 | in 46 | plugins ++ (filter (p: !(elem p plugins)) (attrValues norgGrammars)) 47 | ); 48 | withAllGrammars = withPlugins (_: allGrammars); 49 | in 50 | p.nvim-treesitter.overrideAttrs (a: { 51 | passthru = 52 | a.passthru 53 | // { 54 | inherit builtGrammars allGrammars withPlugins withAllGrammars; 55 | grammarPlugins = 56 | a.passthru.grammarPlugins 57 | // { 58 | norg = p.nvim-treesitter.grammarToPlugin norgGrammars.tree-sitter-norg; 59 | norg-meta = p.nvim-treesitter.grammarToPlugin norgGrammars.tree-sitter-norg-meta; 60 | }; 61 | }; 62 | }); 63 | 64 | lua-utils-nvim = final.vimUtils.buildVimPlugin { 65 | inherit (prev.luaPackages.lua-utils-nvim) pname version src; 66 | }; 67 | 68 | pathlib-nvim = final.vimUtils.buildVimPlugin { 69 | inherit (prev.luaPackages.pathlib-nvim) pname version src; 70 | doCheck = false; 71 | }; 72 | 73 | neorg = final.vimUtils.buildVimPlugin { 74 | pname = "neorg"; 75 | version = neorg.rev; 76 | src = neorg; 77 | dependencies = [ 78 | (f.nvim-treesitter.withPlugins (_: [])) 79 | f.lua-utils-nvim 80 | f.nui-nvim 81 | f.nvim-nio 82 | f.pathlib-nvim 83 | f.plenary-nvim 84 | ]; 85 | doCheck = false; 86 | }; 87 | 88 | neorg-telescope = final.vimUtils.buildVimPlugin { 89 | pname = "neorg-telescope"; 90 | version = neorg-telescope.rev; 91 | src = neorg-telescope; 92 | dependencies = [ 93 | f.lua-utils-nvim 94 | f.neorg 95 | f.plenary-nvim 96 | f.telescope-nvim 97 | ]; 98 | }; 99 | }); 100 | }; 101 | # https://github.com/NixOS/nix/issues/5532 102 | overlay = nixpkgs.lib.warn "`neorg-overlay.overlay` is deprecated; use `neorg-overlay.overlays.default` instead" self.overlays.default; 103 | } 104 | // (flake-utils.lib.eachDefaultSystem (system: let 105 | pkgs = import nixpkgs { 106 | inherit system; 107 | overlays = [self.overlays.default]; 108 | }; 109 | in { 110 | checks = import ./tests.nix pkgs; 111 | formatter = pkgs.alejandra; 112 | })); 113 | } 114 | -------------------------------------------------------------------------------- /tests.nix: -------------------------------------------------------------------------------- 1 | pkgs: let 2 | inherit (pkgs.lib) concatStringsSep imap listToAttrs; 3 | makeTest = { 4 | name, 5 | plugins, 6 | expectedPluginFiles, 7 | expectedParsers, 8 | }: let 9 | config = let 10 | base = pkgs.neovimUtils.makeNeovimConfig {inherit plugins;}; 11 | in 12 | base 13 | // { 14 | wrapRc = false; 15 | wrapperArgs = 16 | base.wrapperArgs 17 | ++ [ 18 | "--add-flags" 19 | "'-u' '${ 20 | pkgs.writeText "init.lua" '' 21 | function test() 22 | local success = true 23 | 24 | require("nvim-treesitter.configs").setup({}) 25 | local parsers = require("nvim-treesitter.parsers") 26 | for _, p in ipairs({${ 27 | concatStringsSep "," (map (p: ''"${p}"'') expectedParsers) 28 | }}) do 29 | if not parsers.has_parser(p) then 30 | print("${name}: missing parser: " .. p) 31 | success = false 32 | end 33 | end 34 | 35 | function has_script(scripts, script) 36 | local filtered = vim.tbl_filter( 37 | function(s) 38 | return string.find(s, script, 1, true) 39 | end, scripts 40 | ) 41 | return #filtered > 0 42 | end 43 | local scripts = vim.split( 44 | vim.api.nvim_exec("scriptnames", true), "\n", {trimempty = true} 45 | ) 46 | for _, s in ipairs({${ 47 | concatStringsSep "," (map (p: ''"${p}"'') expectedPluginFiles) 48 | }}) do 49 | if not has_script(scripts, s) then 50 | print("${name}: missing plugin script:", s) 51 | success = false 52 | end 53 | end 54 | 55 | print("${name}-result:", success) 56 | end 57 | 58 | vim.cmd("autocmd BufEnter * lua test()") 59 | '' 60 | }'" 61 | ]; 62 | }; 63 | nvim = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped config; 64 | in 65 | pkgs.runCommand name {} '' 66 | tmp=$(mktemp -d) 67 | cleanup() { 68 | if [[ -d $tmp ]]; then 69 | rm -rf "$tmp" 70 | fi 71 | } 72 | trap cleanup EXIT 73 | HOME=$tmp 74 | output=$("${nvim}"/bin/nvim -es --cmd "redi! > /dev/stdout" -c "redi end|q!") 75 | printf "%s\n" "''${output//${name}-result: */}" 76 | touch $out 77 | [[ "$(tail -n 1 <<<"$output")" == "${name}-result: true" ]] 78 | ''; 79 | tests = let 80 | pluginMarkers = { 81 | # XXX: neorg doesn't provide ftdetect/norg.lua anymore so neovim has no 82 | # neorg-specific plugin scripts to source (see :h scriptnames). fixing 83 | # this test properly will require a different method of verifying plugin 84 | # installation. 85 | neorg = "filetype.lua"; 86 | plenary = "plugin/plenary.vim"; 87 | nvim-treesitter = "plugin/nvim-treesitter.lua"; 88 | telescope = "plugin/telescope.lua"; 89 | }; 90 | in [ 91 | { 92 | # 1. Just neorg — should automatically pull in plugin and parser dependencies 93 | plugins = with pkgs.vimPlugins; [neorg]; 94 | expectedPluginFiles = with pluginMarkers; [neorg plenary nvim-treesitter]; 95 | expectedParsers = [ 96 | "norg" 97 | "norg_meta" 98 | ]; 99 | } 100 | # 2. Additional parser — should add to our parsers. 101 | { 102 | plugins = with pkgs.vimPlugins; [ 103 | neorg 104 | (nvim-treesitter.withPlugins (p: [p.tree-sitter-bash])) 105 | ]; 106 | expectedPluginFiles = with pluginMarkers; [neorg plenary nvim-treesitter]; 107 | expectedParsers = ["bash" "norg" "norg_meta"]; 108 | } 109 | # 3. Requesting just norg parser — should add norg_meta parser. 110 | { 111 | plugins = with pkgs.vimPlugins; [ 112 | neorg 113 | (nvim-treesitter.withPlugins (p: [p.tree-sitter-norg])) 114 | ]; 115 | expectedPluginFiles = with pluginMarkers; [neorg plenary nvim-treesitter]; 116 | expectedParsers = ["norg" "norg_meta"]; 117 | } 118 | # 4. Requesting norg and norg-meta parsers — shouldn't lead to duplicates (which 119 | # would fail the derivation of the parser dir) 120 | { 121 | plugins = with pkgs.vimPlugins; [ 122 | neorg 123 | (nvim-treesitter.withPlugins 124 | (p: [p.tree-sitter-norg p.tree-sitter-norg-meta])) 125 | ]; 126 | expectedPluginFiles = with pluginMarkers; [neorg plenary nvim-treesitter]; 127 | expectedParsers = ["norg" "norg_meta"]; 128 | } 129 | # 5. Requesting norg and unrelated parser — should add norg-meta. 130 | { 131 | plugins = with pkgs.vimPlugins; [ 132 | neorg 133 | (nvim-treesitter.withPlugins (p: [p.tree-sitter-bash p.tree-sitter-norg])) 134 | ]; 135 | expectedPluginFiles = with pluginMarkers; [neorg plenary nvim-treesitter]; 136 | expectedParsers = ["norg" "norg_meta" "bash"]; 137 | } 138 | # 6. withAllGrammars — should include our parsers… 139 | { 140 | plugins = with pkgs.vimPlugins; [neorg nvim-treesitter.withAllGrammars]; 141 | expectedPluginFiles = with pluginMarkers; [neorg plenary nvim-treesitter]; 142 | expectedParsers = [ 143 | "norg" 144 | "norg_meta" 145 | # exemplary for "all": 146 | "bash" 147 | "perl" 148 | ]; 149 | } 150 | # 7. …using allGrammars — as in 6. 151 | { 152 | plugins = with pkgs.vimPlugins; [ 153 | neorg 154 | (nvim-treesitter.withPlugins (_: nvim-treesitter.allGrammars)) 155 | ]; 156 | expectedPluginFiles = with pluginMarkers; [neorg plenary nvim-treesitter]; 157 | expectedParsers = [ 158 | "norg" 159 | "norg_meta" 160 | # exemplary for "all": 161 | "bash" 162 | "perl" 163 | ]; 164 | } 165 | # 8. Requesting just neorg-telescope — should pull in all required vim plugins and 166 | # our parsers… 167 | { 168 | plugins = with pkgs.vimPlugins; [neorg-telescope]; 169 | expectedPluginFiles = with pluginMarkers; [ 170 | telescope 171 | neorg 172 | plenary 173 | nvim-treesitter 174 | ]; 175 | expectedParsers = ["norg" "norg_meta"]; 176 | } 177 | # 9. …with explicit neorg request — as in 8. … 178 | { 179 | plugins = with pkgs.vimPlugins; [neorg neorg-telescope]; 180 | expectedPluginFiles = with pluginMarkers; [ 181 | telescope 182 | neorg 183 | plenary 184 | nvim-treesitter 185 | ]; 186 | expectedParsers = ["norg" "norg_meta"]; 187 | } 188 | # 10. …with explicit parser request — should result in requested parser + ours (+ 189 | # vim plugin deps as before)… 190 | { 191 | plugins = with pkgs.vimPlugins; [ 192 | neorg-telescope 193 | (nvim-treesitter.withPlugins (p: [p.tree-sitter-bash])) 194 | ]; 195 | expectedPluginFiles = with pluginMarkers; [ 196 | telescope 197 | neorg 198 | plenary 199 | nvim-treesitter 200 | ]; 201 | expectedParsers = ["norg" "norg_meta" "bash"]; 202 | } 203 | ]; 204 | in 205 | listToAttrs (imap 206 | (i: test: rec { 207 | name = "test${toString i}"; 208 | value = makeTest (test // {inherit name;}); 209 | }) 210 | tests) 211 | --------------------------------------------------------------------------------