Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luarocks Issues Thread #1342

Open
vhyrro opened this issue Mar 24, 2024 · 102 comments
Open

Luarocks Issues Thread #1342

vhyrro opened this issue Mar 24, 2024 · 102 comments

Comments

@vhyrro
Copy link
Member

vhyrro commented Mar 24, 2024

If you're probably here you're either angry or you're sad :|

The latest update, 8.0.0, has been a breaking change for users. This isn't a breaking change just because I felt like it, rather it paves the way forward for making Neorg expansive and more stable than it was before. We just need to jump through the initial hurdles.

If you have issues, please read the blog post I made. It will have you covered on how to fix things.

If you don't want to deal with the breakages, feel free to roll back to version v7.0.0 - everything will continue to run there.

If you're having errors in lazy, I highly encourage you to restart Neovim and try manually rerunning :Lazy build luarocks.nvim and, if that succeeds, running :Lazy build neorg afterwards. If you get any errors which you do not understand, please post them here!

Thank you lot for the patience! Happy note taking.

EDIT:

If you have a build = ":Neorg sync-parsers" step in your Neorg configuration be sure to remove it. That'll overwrite the build.lua build step and make the build process fail.

@vhyrro vhyrro pinned this issue Mar 24, 2024
@roland-5
Copy link
Contributor

roland-5 commented Mar 24, 2024

I use lazy and :Lazy build luarocks.nvim and :Lazy build neorg indeed helped for error that I had.
Should we install luarock package from our distribution repository too?

@vhyrro
Copy link
Member Author

vhyrro commented Mar 24, 2024

Nope, you don't need the luarocks package from your distro :)

Yeah, sometimes manually rerunning the build steps is what fixes it. Lazy is very unpredictable when it comes to build steps 🤷‍♂️

@pysan3
Copy link
Contributor

pysan3 commented Mar 24, 2024

For those who are on Arch Linux and seeing a build error similar to...

❌ Performing luarocks `./configure` if Unix systems
...hare/nvim/lazy/luarocks.nvim/lua/luarocks-nvim/build.lua:126: Failed to install luarocks: 
Configuring LuaRocks version dev...

Lua interpreter found: /sbin/luajit
Checking if /sbin/luajit is Lua version 5.1... yes
lua.h for Lua 5.1 not found (tried //include/lua/5.1/lua.h //include/lua5.1/lua.h //include/lua-5.1/lua.h //include/lua51/lua.h //include/lua.h //include/luajit-2.1/lua.h)

If the development files for Lua (headers and libraries)
are installed in your system, you may need to use the
--with-lua or --with-lua-include flags to specify their location.

If those files are not yet installed, you need to install
them using the appropriate method for your operating system.

Run ./configure --help for details on flags.

configure failed.

change your luarocks.nvim config as follows.

{
  "vhyrro/luarocks.nvim",
  opts = {
    luarocks_build_args = {
      "--with-lua-include=/usr/include",
    },
  },
}

@simonhughxyz
Copy link

simonhughxyz commented Mar 24, 2024

I'm trying to install it with the lazy method but I keep getting an error and neorg won't load:

Failed to run `config` for neorg
                                                                                                                                         
.../lazy/neorg/lua/neorg/modules/core/highlights/module.lua:433: module 'nvim-treesitter.query' not found:No LuaRocks module found for nv
im-treesitter.query                                                                                                                      
^Ino field package.preload['nvim-treesitter.query']                                                                                      
cache_loader: module nvim-treesitter.query not found                                                                                     
cache_loader_lib: module nvim-treesitter.query not found                                                                                 
^Ino file './nvim-treesitter/query.lua'                                                                                                  
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1/nvim-treesitter/query.lua'                                         
^Ino file '/usr/local/share/lua/5.1/nvim-treesitter/query.lua'                                                                           
^Ino file '/usr/local/share/lua/5.1/nvim-treesitter/query/init.lua'                                                                      
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/nvim-treesitter/query.lua'                                            
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/nvim-treesitter/query/init.lua'                                       
^Ino file '/home/simon/.local/share/nvim/lazy/luarocks.nvim/.rocks/share/lua/5.1/nvim-treesitter/query.lua'                              
^Ino file '/home/simon/.local/share/nvim/lazy/luarocks.nvim/.rocks/share/lua/5.1/nvim-treesitter/query/init.lua'                         
^Ino file '/home/simon/.luarocks/share/lua/5.1/nvim-treesitter/query.lua'                                                                
^Ino file '/home/simon/.luarocks/share/lua/5.1/nvim-treesitter/query/init.lua'                                                           
^Ino file './nvim-treesitter/query.so'                                                                                                   
^Ino file '/usr/local/lib/lua/5.1/nvim-treesitter/query.so'                                                                              
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/nvim-treesitter/query.so'                                               
^Ino file '/usr/local/lib/lua/5.1/loadall.so'                                                                                            
^Ino file '/home/simon/.local/share/nvim/lazy/luarocks.nvim/.rocks/lib/lua/5.1/nvim-treesitter/query.so'                                 
^Ino file '/home/simon/.luarocks/lib/lua/5.1/nvim-treesitter/query.so'                                                                   
^Ino file './nvim-treesitter.so'                                                                                                         
^Ino file '/usr/local/lib/lua/5.1/nvim-treesitter.so'                                                                                    
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/nvim-treesitter.so'                                                     
^Ino file '/usr/local/lib/lua/5.1/loadall.so'                                                                                            
^Ino file '/home/simon/.local/share/nvim/lazy/luarocks.nvim/.rocks/lib/lua/5.1/nvim-treesitter.so'                                       
^Ino file '/home/simon/.luarocks/lib/lua/5.1/nvim-treesitter.so'                                                                         
                                                                                                                                         
# stacktrace:                                                                                                                            
  - /neorg/lua/neorg/modules/core/highlights/module.lua:433 _in_ **trigger_highlights**                                                  
  - /neorg/lua/neorg/modules/core/highlights/module.lua:420 _in_ **load**                                                                
  - /neorg/lua/neorg/core/modules.lua:403 _in_ **load_module**                                                                           
  - /neorg/lua/neorg/core/modules.lua:335 _in_ **load_module**  

@vhyrro
Copy link
Member Author

vhyrro commented Mar 24, 2024

@simonhughxyz The error message is slightly different as we're using the luarocks package loader, but the underlying cause looks to be the same - Neorg is trying to initialize before treesitter is activated.

Maybe try:

{
  "nvim-neorg/neorg",
  dependencies = { "luarocks.nvim", "nvim-treesitter" }, -- Add nvim-treesitter here
}

Just for good measure? I'll be revamping that part of the code fairly soon anyway, but it's worth a shot.

@simonhughxyz
Copy link

"nvim-treesitter"

This fix did not work

@vhyrro
Copy link
Member Author

vhyrro commented Mar 24, 2024

Okay, I tried another thing. @simonhughxyz mind updating the plugin and trying again? I removed the old and hacky code related to nvim-treesitter query invalidation, which has been resolved for a while now.

@simonhughxyz
Copy link

No sorry, updated all plugin, still did not work. Tried deleting my nvim data folder as well just in case, did not resolve anything.

@vhyrro
Copy link
Member Author

vhyrro commented Mar 24, 2024

That's odd... are you pinned to the latest stable release by any chance? I pushed the update to the main branch. If so, my bad, I should have made that clear.

I quite literally removed the old code that cause the error, so it continuing to trigger is quite suspicious 😅

@simonhughxyz
Copy link

Yea, just checked lazy, it says its on commit 388976f. So not latest. Not sure why, I updated neorg and like I said before even tried deleting my data folder.

@simonhughxyz
Copy link

Oh hang on, my bad, I had version = "*" in my lazy setup

@simonhughxyz
Copy link

Ok, so the latest commit got rid of the error, but neorg still will not load

@vhyrro
Copy link
Member Author

vhyrro commented Mar 24, 2024

I assume then that it's silently failing to load? All of the people that have mentioned such an error have had their issues resolved via :Lazy build neorg, which forces a rebuild of the project. After restarting Neovim things should start working once more :)

As I mentioned before, lazy has a notoriously weird set of build procedures.

@simonhughxyz
Copy link

Ok so I fixed it, it just needs 2 dependancies dependencies = { "luarocks.nvim", "nvim-treesitter/nvim-treesitter" },
Everything works now.

@roland-5
Copy link
Contributor

@vhyrro I use Arch and @pysan3 method worked for me. I installed luarock from Arch repository, deleted ~/.local/share/nvim to test this, and with his change, everything were downloaded and built without problem this time.

@pysan3
Copy link
Contributor

pysan3 commented Mar 24, 2024

@roland-5 The workaround will be officially supported so you don't need to add the line in your config anymore. (Obviously adding luarocks_build_args yourself will finish faster cuz the workaround will need to retry a couple of times.)

@xfzv
Copy link
Contributor

xfzv commented Mar 24, 2024

I've just migrated following Adapting your config section, so far so good.

@zvpyp
Copy link

zvpyp commented Mar 25, 2024

I might just add, if you are using fedora, make sure you have installed compat-lua-devel-5.1.5

sudo dnf install compat-lua-devel-5.1.5

The with-lua flag is not necessary since it is installed in a default directory.

Then you do :Lazy build luarocks.nvim and after that :Lazy build neorg

Hope that helps, I was just frustrated searching for the package.

@ALVAROPING1
Copy link
Contributor

ALVAROPING1 commented Mar 25, 2024

For those who are on Arch Linux and seeing a build error similar to...

❌ Performing luarocks `./configure` if Unix systems
...hare/nvim/lazy/luarocks.nvim/lua/luarocks-nvim/build.lua:126: Failed to install luarocks: 
Configuring LuaRocks version dev...

Lua interpreter found: /sbin/luajit
Checking if /sbin/luajit is Lua version 5.1... yes
lua.h for Lua 5.1 not found (tried //include/lua/5.1/lua.h //include/lua5.1/lua.h //include/lua-5.1/lua.h //include/lua51/lua.h //include/lua.h //include/luajit-2.1/lua.h)

If the development files for Lua (headers and libraries)
are installed in your system, you may need to use the
--with-lua or --with-lua-include flags to specify their location.

If those files are not yet installed, you need to install
them using the appropriate method for your operating system.

Run ./configure --help for details on flags.

configure failed.

if you get an issue similar to this on ubuntu based distros, you need to install the liblua5.1-0-dev package

@dearieme
Copy link

Hello, noob question: how do I see the build errors in Lazy?

I'm getting the "Performing luarocks ./configure if Unix systems" message when I run "Lazy build luarocks.nvim" but I can't figure out how to see the full errors. They do not seem to be in ":mess" or "NoiceHistory"

Thanks

@pysan3
Copy link
Contributor

pysan3 commented Mar 25, 2024

@dearieme :Notifications

@dearieme
Copy link

@pysan3 Thank you, I'm sure I knew that once :)

I'm on Arch and the error suggested that lua 5.1 was explicitly required, so I installed"extra/lua51" ("extra/lua" was already installed but didn't conflict) re-did the Lazy build dance, and it all seems to work fine now.

@max397574
Copy link
Contributor

I had strange errors with wget when trying to Lazy build neorg. I found out that just wget was broken (tested with wget --version which gave an error)
Just uninstalling wget made all the things work

@leongjs98
Copy link
Contributor

@vhyrro

I was unable to install Neorg v8 with lazy.nvim with the blog post fix here:

in the readme, it says:

Using luarocks Neorg will install itself and these dependencies with their respective versions:

But for me, it didn't install the dependencies

I had to explicitly add these as dependencies to install Neorg v8:

  {
    "vhyrro/luarocks.nvim",
+   dependencies = {
+     "MunifTanjim/nui.nvim",
+     "nvim-neotest/nvim-nio",
+     "nvim-neorg/lua-utils.nvim",
+     "nvim-lua/plenary.nvim"
+   },
    priority = 1000, -- We'd like this plugin to load first out of the rest
    config = true,   -- This automatically runs `require("luarocks-nvim").setup()`
  },

Could you please update your blog post to add these in case someone had the same problem as me?

@skbolton
Copy link

I think the nixpkgs overlay flake is going to need an update. On a fresh system I was able to install without warnings but most of neorgs functionality is missing so I think it is in a bad state.

@flexagoon
Copy link

The configure script currently doesn't detect lua headers if lua is installed by Homebrew, because they're located in /home/linuxbrew/.linuxbrew/Cellar/lua/5.4.6/include/lua/lua.h

@flexagoon
Copy link

Also, for some reason, it tries to find the headers for lua 5.1, which has been deprecated

@pysan3
Copy link
Contributor

pysan3 commented Mar 26, 2024

@leongjs98 I don't think you have it setup correctly if you need those lines.

@pysan3
Copy link
Contributor

pysan3 commented Mar 26, 2024

@flexagoon You will need lua version 5.1 installed or luajit is even better.

I don't use brew so I'm not sure about the actual package name but if you install it, luarocks build script should be able to pick it up.

FYI lua5.1 is not deprecated or there is a problem with your package manager. You might want to read :h lua-intro for more details.

@vhyrro
Copy link
Member Author

vhyrro commented Apr 5, 2024

Perhaps winget should be officially recommended in our readme, I recall that working when I was doing tests on a VM :)

@tmccombs
Copy link

Is there a way I can use my existing installation of luarocks on my system (archlinux) with lazy.nvim?

Or installing directly with luarocks?

I really don't love the idea of using another plugin that builds a new installation of luarocks when I already have luarocks installed.

And I don't really want to switch to a new package manager either, espeically since rocks.nvim is missiong functionality that lazy.nvim has (such as configuring a plugin to lazily load on certain key mappings or commands, semantic versioning for git repo tags, etc.)

@austinbutler
Copy link
Contributor

What's working for me currently on Nix with home-manager is adding to extraLuaPackages.

  extraLuaPackages = luaPkgs: with luaPkgs; [lua-utils-nvim nvim-nio pathlib-nvim];

Telescope is still half-broken, but I assume that's nvim-neorg/neorg-telescope#57.

@maxdiebold
Copy link

maxdiebold commented Apr 15, 2024

@morrismuehl I was able to get rocks working with home-manager by adding luajit (which is for Lua 5.1) to extraPackages, where I had been using the lua package. The lua package is set to a more recent version by default, but overriding the version would probably work, too, e.g. pkgs.lua.override { version = "5.1" };. The neovim home-manager module adds the necessary wrapper arguments to the binary in a similar fashion to @pysan3's tutorial.

Why do the instructions advise setting lazy to false? I have no issues lazy loading, and I'd rather keep it that way, since I obviously won't be using Neorg for non-norg files.

@pysan3
Copy link
Contributor

pysan3 commented Apr 15, 2024

Credits to @benlubas for the nix section ;)

@maxdiebold If you lazy load, you cannot get command completions on the first try (like :Neorg togg<tab> won't expand to toggle-concealer). And this is the only downside to lazy loading the plugin so if you always enter a norg file with a keybind etc, you won't notice any problem whatsoever.

However, core devs will only support issues that happen with lazy = false so you will need to fix it on your own if you experience a bug with lazy loading (PR is welcome).

@maxdiebold
Copy link

@pysan3 I've found that I can still get the completions on the first try by setting cmd = "Neorg" in Lazy's plugin spec, but I will keep the second point in mind if I run into any issues!

@mikolajpp
Copy link

Nothing in this thread or in any resource I found helped me to install on current Lunar Vim stable (Neovim 0.9.0).
All attempts failed with lua-utils not found error. Eventually, close to giving up, I decided to install Lunar Vim nightly (Neovim 0.10.0). Apparently there is a (better?) support for luarocks and the installation worked with the stock config!

@Anrock
Copy link

Anrock commented Apr 16, 2024

Hey there. I've switched from paq to rocks with neorg 8.4.0.
Now I have this error when launching neovim

E5113: Error while calling lua chunk: ....1/neorg/modules/core/integrations/treesitter/module.lua:53: Unable to load nvim-
treesitter.ts_utils :(
stack traceback:
        [C]: in function 'assert'
        ....1/neorg/modules/core/integrations/treesitter/module.lua:53: in function 'load'
        ...al/share/nvim/rocks/share/lua/5.1/neorg/core/modules.lua:403: in function 'load_module'
        ...al/share/nvim/rocks/share/lua/5.1/neorg/core/modules.lua:335: in function 'load_module'
        ...ock/.local/share/nvim/rocks/share/lua/5.1/neorg/init.lua:152: in function 'org_file_entered'
        ...ock/.local/share/nvim/rocks/share/lua/5.1/neorg/init.lua:69: in function 'setup'

I also dumped nvim-treesitter in favor of rocks-treesitter.nvim. Is neorg still dependent on nvim-treesitter?

@vhyrro
Copy link
Member Author

vhyrro commented Apr 16, 2024

@Anrock hey, yes Neorg still relies on treesitter. That was a huge oversight on my part when making the rocks.nvim install instructions, so sorry for that.

With #1390 this will no longer be the case. I hope to merge that later today, just trying to fix some things in the rocks-binaries repo!

@bdpierce777
Copy link

Ok so I fixed it, it just needs 2 dependancies dependencies = { "luarocks.nvim", "nvim-treesitter/nvim-treesitter" }, Everything works now.

This did the trick for me using the "lazy kickstart"
The "pure luarocks" config seemed really cool...but I couldn't get it working

@arunoruto
Copy link

arunoruto commented May 13, 2024

I currently use nixvim in home-manager to manage my neorg config under nixos, and I always get the following warning:

Warning [neorg]: lua-utils not found. If you're just installing the plugin, ignore this message, when in doubt run `:Lazy build neorg`. If you're not on lazy please rerun the build scripts.

My neorg.nix file looks like this:

{pkgs, ...}: {
  programs.nixvim = {
    plugins = {
      neorg = {
        enable = true;
        modules = {
          "core.defaults".__empty = null;
          "core.concealer" = {
            config = {
              icon_preset = "basic";
            };
          };
          "core.dirman" = {
            config = {
              workspaces = {
                notes = "~/Documents/notes";
              };
              default_workspace = "notes";
            };
          };
        };
      };
    };
    extraLuaPackages = with pkgs.luaPackages; [
      lua-utils-nvim
      nvim-nio
      pathlib-nvim
    ];
  };
}

I followed @austinbutler comment to add the three packages to extraLuaPackages (which is also available in nixvim), but to no avail.

And whenever I am running home-manager switch I get the following warning about treesitter:

warning: Neorg's `core.defaults` module is enabled but `plugins.treesitter` is not.
Treesitter is required when using the `core.defaults`.

Treesitter is for sure enabled and works fine, but something is messed up in nixvim.

@clemenscodes
Copy link

@arunoruto I also use nixvim, did not have any luck either using their plugin option. However, I managed to fix it using the official neorg-overlay instead and adding the overridden plugin manually:

{
  pkgs,
  config,
  lib,
  ...
}: let
  cfg = config.nixvim.neorg;
in
  with lib; {
    options = {
      nixvim = {
        neorg = {
          enable = mkEnableOption "Enable neorg for nixvim" // {default = true;};
        };
      };
    };
    config = mkIf (config.nixvim.enable && cfg.enable) {
      programs = {
        nixvim = {
          extraPlugins = with pkgs.vimPlugins; [neorg neorg-telescope];
          extraConfigLuaPost =
            /*
            lua
            */
            ''
              require("neorg").setup {
                load = {
                  ["core.defaults"] = {}
                }
              }
            '';
        };
      };
    };
  }

@kjkent
Copy link

kjkent commented Jun 1, 2024

First time installing neorg here and I seem to be getting the same issue as a few people in this thread. I followed the instructions for Lazy.nvim and everything appears to install correctly, but every time I start nvim, I get:

Warning [neorg]: lua-utils not found. If you're just installing the plugin, ignore this message, when in
doubt run `:Lazy build neorg`. If you're not on lazy please rerun the build scripts.

:checkhealth neorg reports:

neorg: require("neorg.health").check()

neorg
- Checking configuration...
- OK Empty configuration provided: Neorg will load core.defaults by default.
- Checking existence of dependencies...
- OK Required dependency vhyrro/luarocks found!
- Checking existence of luarocks dependencies...
- ERROR Critical dependency lua-utils.nvim not found! Please run :Lazy build luarocks.nvim and then      :Lazy build neorg! Neorg will refuse to load.

Unfortunately the suggested build commands do not help. I'm running Arch Linux.

@pysan3
Copy link
Contributor

pysan3 commented Jun 3, 2024

@kjkent
Copy link

kjkent commented Jun 4, 2024

luajit and lua51? If so, yes, both installed.

Edit for the sake of it, I just cleared my neorg/luarocks files, followed the tutorial again and it worked? I... I don't know. Perhaps I missed a config = true in the plugin definitions. Thank you for your help regardless @pysan3

@Mourey
Copy link

Mourey commented Jun 6, 2024

Hi If anyone has managed to get it to work on Nixvim, would appreciate comments on how the managed it!

@clemenscodes
Copy link

Hi If anyone has managed to get it to work on Nixvim, would appreciate comments on how the managed it!

See here: #1342 (comment)

@Mourey
Copy link

Mourey commented Jun 7, 2024

Hi If anyone has managed to get it to work on Nixvim, would appreciate comments on how the managed it!

See here: #1342 (comment)

I don't quite follow your solution, adding your configuration is not really working for me

`
error: attribute 'enable' missing

   at /nix/store/sdnwlvck6a2l6lvl7q9chsqv4m737wjn-source/homeManagerModules/neo.nix:17:20:

       16|     };
       17|     config = mkIf (config.nixvim.enable && cfg.enable) {
         |                    ^
       18|       programs = {

`

@clemenscodes
Copy link

clemenscodes commented Jun 7, 2024

Hi If anyone has managed to get it to work on Nixvim, would appreciate comments on how the managed it!

See here: #1342 (comment)

I don't quite follow your solution, adding your configuration is not really working for me

` error: attribute 'enable' missing

   at /nix/store/sdnwlvck6a2l6lvl7q9chsqv4m737wjn-source/homeManagerModules/neo.nix:17:20:

       16|     };
       17|     config = mkIf (config.nixvim.enable && cfg.enable) {
         |                    ^
       18|       programs = {

`

This is a minimal module without custom options:

{pkgs, ...}: {
  programs = {
    nixvim = {
      enable = true;
      extraPlugins = with pkgs.vimPlugins; [neorg neorg-telescope];
      extraConfigLuaPost = ''
        require("neorg").setup {
          load = {
            ["core.defaults"] = {},
          },
        }
      '';
    };
  };
}

Note that this uses the mentioned overlay. To use it, you have to first be using flakes, and then add it as a flake input in your flake.nix and add the overlay to the overlays of your nixpkgs. The link gives an example on how to do that.

@Mourey
Copy link

Mourey commented Jun 10, 2024

Hi If anyone has managed to get it to work on Nixvim, would appreciate comments on how the managed it!

See here: #1342 (comment)

I don't quite follow your solution, adding your configuration is not really working for me
` error: attribute 'enable' missing

   at /nix/store/sdnwlvck6a2l6lvl7q9chsqv4m737wjn-source/homeManagerModules/neo.nix:17:20:

       16|     };
       17|     config = mkIf (config.nixvim.enable && cfg.enable) {
         |                    ^
       18|       programs = {

`

This is a minimal module without custom options:

{pkgs, ...}: {
  programs = {
    nixvim = {
      enable = true;
      extraPlugins = with pkgs.vimPlugins; [neorg neorg-telescope];
      extraConfigLuaPost = ''
        require("neorg").setup {
          load = {
            ["core.defaults"] = {},
          },
        }
      '';
    };
  };
}

Note that this uses the mentioned overlay. To use it, you have to first be using flakes, and then add it as a flake input in your flake.nix and add the overlay to the overlays of your nixpkgs. The link gives an example on how to do that.

Thank you for your support and help, you helped me learn something new. I was not aware that under a home-manager set up I had to import the overlay directly on my home.nix ( my file structure is something like: flake.nix that imports configuration.nix (os) and in turn configuration.nix imports home.nix (home-manager)).

In essence by adding the overlay to home-manager solved the issue and I now have Neorg in my Nixvim configuration using the overlay!

Thank you!

@clemenscodes
Copy link

Hi If anyone has managed to get it to work on Nixvim, would appreciate comments on how the managed it!

See here: #1342 (comment)

I don't quite follow your solution, adding your configuration is not really working for me
` error: attribute 'enable' missing

   at /nix/store/sdnwlvck6a2l6lvl7q9chsqv4m737wjn-source/homeManagerModules/neo.nix:17:20:

       16|     };
       17|     config = mkIf (config.nixvim.enable && cfg.enable) {
         |                    ^
       18|       programs = {

`

This is a minimal module without custom options:

{pkgs, ...}: {
  programs = {
    nixvim = {
      enable = true;
      extraPlugins = with pkgs.vimPlugins; [neorg neorg-telescope];
      extraConfigLuaPost = ''
        require("neorg").setup {
          load = {
            ["core.defaults"] = {},
          },
        }
      '';
    };
  };
}

Note that this uses the mentioned overlay. To use it, you have to first be using flakes, and then add it as a flake input in your flake.nix and add the overlay to the overlays of your nixpkgs. The link gives an example on how to do that.

Thank you for your support and help, you helped me learn something new. I was not aware that under a home-manager set up I had to import the overlay directly on my home.nix ( my file structure is something like: flake.nix that imports configuration.nix (os) and in turn configuration.nix imports home.nix (home-manager)).

In essence by adding the overlay to home-manager solved the issue and I now have Neorg in my Nixvim configuration using the overlay!

Thank you!

Yeah, you can either import the overlay in flake.nix and pass your pkgs instance as extraSpecialArgs to home-manager, or use the overlay directly in home-manager. Glad I could help!

@sij1nk
Copy link

sij1nk commented Jun 17, 2024

#1342 (comment)

It turns out that if anything is "wrong" with wget, the Neorg build process (e.g. as invoked through :Lazy build neorg) dies, like in the linked comment above. In my case, after I transferred some dotfiles from another machine, my WGETRC environment variable was (mistakenly) pointed to a file which didn't exist, and wget failed with the following error:

wget: WGETRC points to /home/rg/does-not-exist, which couldn't be accessed because of error: No such file or directory.

Fixing up the WGETRC env var to point to a valid wgetrc file cured my wget, and installing Neorg worked fine afterwards

edit: I noticed kinda late that wget issues already popped up for some other people in this thread, and the migration guide also mentions it, so I guess I said nothing new :D

@TLSingh1
Copy link

@arunoruto I also use nixvim, did not have any luck either using their plugin option. However, I managed to fix it using the official neorg-overlay instead and adding the overridden plugin manually:

{
  pkgs,
  config,
  lib,
  ...
}: let
  cfg = config.nixvim.neorg;
in
  with lib; {
    options = {
      nixvim = {
        neorg = {
          enable = mkEnableOption "Enable neorg for nixvim" // {default = true;};
        };
      };
    };
    config = mkIf (config.nixvim.enable && cfg.enable) {
      programs = {
        nixvim = {
          extraPlugins = with pkgs.vimPlugins; [neorg neorg-telescope];
          extraConfigLuaPost =
            /*
            lua
            */
            ''
              require("neorg").setup {
                load = {
                  ["core.defaults"] = {}
                }
              }
            '';
        };
      };
    };
  }

This works!! if on nixos, using flakes and home-manager, this solved my issues.

@sbaumohl
Copy link

sbaumohl commented Jun 23, 2024

After following all steps and troubleshooting steps, and rebuilding neorg multiple times, I keep having this error on checkhealth:

[neorg] (01:32:02)
.../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:449
Unable to load module 'core.neorg.dirman'. The module probably does not exist! Stacktrace:  module 'neorg.modules.core.neorg.dirman.module' not found:No LuaRocks module found for neorg.mod
ules.core.neorg.dirman.module
^Ino field package.preload['neorg.modules.core.neorg.dirman.module']
cache_loader: module neorg.modules.core.neorg.dirman.module not found
cache_loader_lib: module neorg.modules.core.neorg.dirman.module not found
^Ino file './neorg/modules/core/neorg/dirman/module.lua'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1/neorg/modules/core/neorg/dirman/module.lua'
^Ino file '/usr/local/share/lua/5.1/neorg/modules/core/neorg/dirman/module.lua'
^Ino file '/usr/local/share/lua/5.1/neorg/modules/core/neorg/dirman/module/init.lua'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/neorg/modules/core/neorg/dirman/module.lua'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/neorg/modules/core/neorg/dirman/module/init.lua'
^Ino file '/home/USER/.local/share/nvim/lazy/luarocks.nvim/.rocks/share/lua/5.1/neorg/modules/core/neorg/dirman/module.lua'
^Ino file '/home/USER/.local/share/nvim/lazy/luarocks.nvim/.rocks/share/lua/5.1/neorg/modules/core/neorg/dirman/module/init.lua'
^Ino file '/home/USER/.local/share/nvim/lazy/luarocks.nvim/.rocks/lua/neorg/modules/core/neorg/dirman/module.lua'
^Ino file '/home/USER/.local/share/nvim/lazy/luarocks.nvim/.rocks/lua/neorg/modules/core/neorg/dirman/module/init.lua'
^Ino file '/home/USER/.luarocks/share/lua/5.1/neorg/modules/core/neorg/dirman/module.lua'
^Ino file '/home/USER/.luarocks/share/lua/5.1/neorg/modules/core/neorg/dirman/module/init.lua'
^Ino file './neorg/modules/core/neorg/dirman/module.so'
^Ino file '/usr/local/lib/lua/5.1/neorg/modules/core/neorg/dirman/module.so'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/neorg/modules/core/neorg/dirman/module.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'
^Ino file '/home/USER/.local/share/nvim/lazy/luarocks.nvim/.rocks/lib/lua/5.1/neorg/modules/core/neorg/dirman/module.so'
^Ino file '/home/USER/.luarocks/lib/lua/5.1/neorg/modules/core/neorg/dirman/module.so'
^Ino file './neorg.so'
^Ino file '/usr/local/lib/lua/5.1/neorg.so'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/neorg.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'
^Ino file '/home/USER/.local/share/nvim/lazy/luarocks.nvim/.rocks/lib/lua/5.1/neorg.so'
^Ino file '/home/USER/.luarocks/lib/lua/5.1/neorg.so'                                                                                      

luarocks.nvim is installed correctly, and returns positively on a :checkhealth

@benlubas
Copy link
Contributor

@sbaumohl

After following all steps and troubleshooting steps, and rebuilding neorg multiple times, I keep having this error on checkhealth:

b/c core.neorg.dirman doesn't exist. It's core.dirman

@sbaumohl
Copy link

@sbaumohl

After following all steps and troubleshooting steps, and rebuilding neorg multiple times, I keep having this error on checkhealth:

b/c core.neorg.dirman doesn't exist. It's core.dirman

Right. Which is odd because this is my config:

        {
                "nvim-neorg/neorg",
                dependencies = { "luarocks.nvim", "nvim-treesitter/nvim-treesitter" },
                lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default
                version = "*",
                after = "nvim-treesitter",
                config = function()
                        require("neorg").setup({
                                load = {
                                        ["core.defaults"] = {},
                                        ["core.dirman"] = {
                                                config = {
                                                        workspaces = {
                                                                notes = "~/notes",
                                                        },
                                                        index = "index.norg",
                                                },
                                        },
                                },
                        })
                end,
        },

@benlubas
Copy link
Contributor

Well that config works perfectly fine for me, so you must have something else going on. If you push your changes to github, I can poke around. The config on github right now has "core.neorg.dirman"

@sbaumohl
Copy link

Well that config works perfectly fine for me, so you must have something else going on. If you push your changes to github, I can poke around. The config on github right now has "core.neorg.dirman"

Ah. The issue was caused by a conflict between two different configs, one of which referenced dirman incorrectly. Neorg is all good now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests