BirdeeHub / nixCats-nvim

A framework for configuring neovim like neovim via nix, and having multiple config profiles. (with example config(s) and in-editor help)
https://nixcats.org/nixCats_installation.html
MIT License
267 stars 11 forks source link

Lazy-template nix build #43

Closed phortonssf closed 1 month ago

phortonssf commented 2 months ago

Thank you for all the work you put in on this project. What is your recommended way to use the result of nix build . when using the lazy-template. Thank you.

BirdeeHub commented 2 months ago

It is its own flake

You would import it in your config and install the packages you output :)

so you would import it in your inputs and put inputs.yourFlake.packages.${system}.<packagename> in your packages list for home manager or nixos

You could then even modify them further there or even install it via the module outputs although I think thats not what you are asking about yet.

Alternatively, you could move the overlays, categoryDefinitions and packageDefinitions over to this template and then move the flake inputs to your system flake inputs, and call it like a function with your system flake inputs to recieve all the normal flake outputs if you want the directory INSIDE your system config.

In fact, this is what I recommend people do here: https://nixcats.org/nixCats_installation.html

start with the default template (OR the kickstart-nvim if you prefer but I generally suggest the default one)

Import the packages from the flake however at the start when you are getting used to the new scheme

After that, when you are ready to make it your main way to configure neovim, AND want to move the directory INTO your system config flake repo,

THEN move to nixExpressionFlakeOutputs template to move the directory into your system flake, if desired

It will be familiar, it is literally the outputs function of the flake as its own file, which you pass your inputs, and recieve the flake outputs from, exactly as if you had imported it in your inputs.


quick note about the kickstart-nvim template

The kickstart-nvim template is meant to be an example of how to use the lazy.nvim wrapper in your existing config that uses lazy.nvim. You search for the NOTE: nixCats: string and look at the way it works, and replace your lazy.setup call with a call to the wrapper as specified, and pass it the list of nix-installed plugins from the nixCats plugin.

If you are starting out using that, that is cool, kickstart.nvim is a good place to start learning neovim, and this is not much different, just know that the wrapper will tell lazy.nvim not to download things downloaded by nix as long as the name is matching the url. If it doesnt, you might have to pass it an extra item in the list as shown in that template, but if you do not, lazy.nvim WILL still attempt to download it itself, which will likely still work.

You could download most things via lazy if you wanted but you will likely have better luck downloading treesitter and other things with install steps via nix and just telling it to only run the build step when no nix was involved using the included lazyAdd nixCatsUtils function

BirdeeHub commented 2 months ago

Also, if you have any more questions, I would love to answer them, but please post any future questions in the discussions thread so that the answers may remain archived for others to benefit from :) Issues is for bugs, dissusions is for help :)

I have described the above before I think but I might post a link to this thread there after this is closed to preserve any info for others, especially if you have further questions here about this topic

However if you even suspect a bug, feel free to file an issue :)

BirdeeHub commented 2 months ago

I just realized, you asked specifically about nix build .

nix build . just builds the result to a ./result directory

so you would run ./result/bin/packagename

But for installing it into your nix config, see above.

I figured you were asking about installing it to your nix config because nix build does the same thing as with any other package.