Hi, mighty Vimjoyer. Could you make a video about wine, bottles and other staff in NixOS? I am trying to set them up for a month now and they don`t work for me at all.
I think this is a cool approach, but I prefer to keep as much in Lua as I can, except for installing plugins and their dependencies which I do in Nix. With Lua, I'm still working with codified configuration which is the important part for me, but I still get the advantage of having a more idiomatic nvim config.
@@GekoPoissYup, that is what I do. My neovim config can be run as a flake and isn't tied to any nix frameworks or libraries. Just some wrapNeovimUnstable neovim-unwrapped... The Lua is structured more or less like a standard nvim config (although I've rolled my own plugin manager that sets up plugins, but does not install them since I've got nix doing this).
Thanks for this! I recently setup my Neovim config in nixvim & while it largely works well, I’m undecided whether I want to use this or use a pure Lua config. I’ve had issues with things like getting option autocompletion working with the nixd LSP server. I’ve looked through source code and not sure if it is correct in nixvim, or my version of nixd is too old…or whether I just don’t yet know enough to set it up correctly.
@@vimjoyeryet nixd actually uses nix to evaluate and parse the code you write as opposed to sitting on top of another parser… at least that’s the way I read it when I compared, though I might be mistaken. On my NixOS setup I have it working with Helix but have yet to try it with Nixvim 🤔
Damn, I really struggling with. Your example works - but does not persist. I wonder how can I make the configuration be permanent? Documentation is hard to follow as well (maybe it is my inexperience with NixOS)
You need to use the module as shown at the end of the video. If you cannot figure out something, you can join the discord server and ask any questions there.
Helix not so much so, it's whole motto is to be "batteries included" and to come with somewhat sensible defaults so at least for now it isn't very extensible or customizable.
Many ways to achieve it: 1. Use home-manager/NixOS module 2. Add this flake as an input to your flake and take default package from there 3. Just copy the output part from this flake into your home-manager/NixOS flake systemPackages
@@vimjoyerI've been struggling to wrap my head around this for 2 days now.I wanted to define the nixvim configurations in a file called nixvim.nix, and then import it into home.nix. But I get a recursion error when I do that. My setup has these 3 notable steps: 1) `modules = [./home.nix];` in flake.nix 2) `import = [./nixvim.nix];` in home.nix 3) `import = [inputs.nixHomeManagerModules.nixvim];` in nixvim.nix 4) ..and then I hope to put the actual nixvim setup inside nixvim.nix Now that I think of it, in step 3, nixvim.nix calls `inputs`, which is defined in flake.nix, which in step 1 itself calls nixvim.nix (via home.nix), and I guess that's why the recursion happens. The only solution that comes to mind is to somehow re-export inputs.nixHomeManagerModules.nixvim as nixvim from inside flake.nix, so that nixvim.nix can then just use it without causing recursion, but I'm not sure if/how one can do this. But you somehow aren't having to do any of this in your video, and use a flake instead. What I don't understand is how you connect it to your home-manager configuration. Do somehow import that flake into home.nix somehow? Or maybe even the home-manager's flake.nix? If so, how?? I honestly have no idea anymore
I've been playing with NixOS over the last day and now I want to be able to pull my dotfiles from git into the OS automatically but I don't know how... can anyone point my in the right direction?
I'm configure neovim with nvchad. When I decide to use nixvim. I'm thing it is big mistake but after try three to five day. I'm very happy about it. But best part configuration. It come with lot of configuration. For nixos user I recommend use nixvim.
Hiya! Firstly, thanks for the amazing video Vimjoyer, however I have a small query, forgive me if it comes off as a stupid question. So I have my nvim configured using the classic Nix way, with a lot of lua files and stuff I already have a flake.nix in my /etc/nixos how should I go about writing nixvim configuration? can i just edit it in flake.nix itself?
@@vimjoyer Thank you so much vimjoyer! I wrote all my config, pushed it to github and now am importing my git repo in my systems flake and using that as output to my inputs
Have you managed to modularize your nixvim config and keep stylix working? I followed a blog post from Valentin Pratz about using "inputs.nixvim.legacyPackages.x86_64-linux.makeNixvimWithModule" to allow the config to span multiple files, but stylix doesn't seem to detect and theme nixvim anymore, and I can't work out how to tell it to.
Flakes can import other flakes with web or filesystem urls, but you can include as many projects in one flake as you want. It all depends on your specific use case.
@@vimjoyerHow exactly would you go on about this solution? I'm using flakes and declaring home-manager module in my flake.nix, but I struggle to make the nixvim option visible in home.nix.
Is there an easy way to convert my existing shell customizations into Nix language syntax? I use a theme, plugins, aliases, functions, set environment variables, etc. I also try to make it portable, so it works on multiple shells, and sometimes I use loops to do multiple operations. Can I replicate this wit Nix? I know Nix is functional, not procedural.
Home-manager has options for all major shells, and interpolating packages into them ensures that your shell will work the same way on any OS. Managing themes and plugins with nix is also very easy.
Kinda late here, but I use Emacs, specifically Doom Emacs because I'm lazy. It has very crappy integration with Nix and I barely managed to get it working using nix-doom-emacs. I'm actually considering switching over to Neovim (maybe also Neovide, the GUI frontend?), but I will definitely miss some of the Emacs features, especially Org mode. I really don't wanna leave the Emacs ecosystem, but it's just too unpopular to actually be useful and receive good support. Everyone just makes plugins for VSCode nevertheless...
Sorry to bring some negativity. But I don't see the point. The video doesn't quite make the case for nixvim and would be greatly helped by an introduction explaining the core ideas. From this presentation it seems a marginal difference to just default neovim configuration with lazy. You have your lazy.lua with a plugin list (identified by string rather than plugins.plugin.enable like here). Plugins often require you to run a setup. Frequently just a require and a setup function call with no argument. Which you could do with the config field in lazy, it's just a very tiny difference. The *_potential_* benefit I do see is that nix might provide defaults for supported plugins that may lack them. It might resolve keymapping conflicts or overall have a system of keymapping structuring that makes it maximally consistent for whatever plugins you might use together. But that's not presented here. That would be incredibly useful for someone who wants defaults as much as possible. You set options in a very similar way, vim.o.shiftwidth=4, just not declared in a table. Of course neovim options aren't just in .o, so clearly this is good if they're now sensibly unified. I find the lsp config presentation most confusing. It would be one thing if just that server list with .enable was required and it creates nice sensible defaults for you with literally no config on your part or only exposing a set of rebinding options. In line with the key mappings idea. But you've replicated the lsp_config example config on github within a difference of maybe 5-10 lines. And you've obfuscated control. With lsp_config it's perfectly clear. It uses vim primitives like autocmd which will be used elsewhere in almost any config. The benefit is just so marginal. Maybe the big benefit isn't mentioned. Maybe the person who made nixvim absolutely loves declarative configuration and this is for those people. That's good. But from my perspective it's not that different.
I agree with you on some points, but the difference between using lspconfig and nixvim is that nixvim I also installs lsp servers for you. It's more comparable to Mason, minus installing dependencies like npm. Nixvim ensures that your setup will work on every machine.
@@vimjoyer You're right, I forget I have mason becuase I don't have to touch it. Which to me doesn't make it that important to abstract away. OS support is a big plus. I would guess that newer neovim users are more likely to have to use windows some of the time.
Thank you so much for presenting this project so clearly and efficiently !
Your videos are always amazing to watch :)
Your videos are extremely helpful! They helped me with my NixOS config!
Happy to see you in the comment section Alxhr0
The primagen needs to see this
he did
@@sachinchaudhary1310 Not before this the comment your replying to ;-;
@@IamPyu-v i know
YES, I've been making my own config for 5 days now. Nixvim is amazing, also thank you for making this video!
Hi, mighty Vimjoyer. Could you make a video about wine, bottles and other staff in NixOS? I am trying to set them up for a month now and they don`t work for me at all.
its nix all the way down...
You misunderstand nix.
Can you make a video about declarative disk partitioning and formatting with Disko?
I maintain my own vim configuration on top of NvChad, but oh boi, this is just magic, wow.
I think this is a cool approach, but I prefer to keep as much in Lua as I can, except for installing plugins and their dependencies which I do in Nix. With Lua, I'm still working with codified configuration which is the important part for me, but I still get the advantage of having a more idiomatic nvim config.
You can just include Lua files in your Nix config.
@@GekoPoissYup, that is what I do. My neovim config can be run as a flake and isn't tied to any nix frameworks or libraries. Just some wrapNeovimUnstable neovim-unwrapped...
The Lua is structured more or less like a standard nvim config (although I've rolled my own plugin manager that sets up plugins, but does not install them since I've got nix doing this).
Nice - next step is to use a decent editor, like Emacs :) @@Muaahaa
Was wondering when you'd find nixvim 🎉🎉
is there a way to just include my existing vim configuration?
Thanks for this! I recently setup my Neovim config in nixvim & while it largely works well, I’m undecided whether I want to use this or use a pure Lua config. I’ve had issues with things like getting option autocompletion working with the nixd LSP server. I’ve looked through source code and not sure if it is correct in nixvim, or my version of nixd is too old…or whether I just don’t yet know enough to set it up correctly.
Nixd is a bit hard to setup, I recommend nil_ls which mostly "just works". I'll make a video about most major nix LSPs later
@@vimjoyer I’ve switched to nil_ls. It was just the prospect of option completion that made nixd attractive.
@@vimjoyeryet nixd actually uses nix to evaluate and parse the code you write as opposed to sitting on top of another parser… at least that’s the way I read it when I compared, though I might be mistaken. On my NixOS setup I have it working with Helix but have yet to try it with Nixvim 🤔
Damn, I really struggling with. Your example works - but does not persist. I wonder how can I make the configuration be permanent?
Documentation is hard to follow as well (maybe it is my inexperience with NixOS)
You need to use the module as shown at the end of the video. If you cannot figure out something, you can join the discord server and ask any questions there.
Can I install emacs?
It would be great to compare two interesting text editors, Emacs and Helix. Both are modular, extensible and oriented towards user customization
Helix not so much so, it's whole motto is to be "batteries included" and to come with somewhat sensible defaults so at least for now it isn't very extensible or customizable.
Neovim better@@ElGnomistico
Any thoughts on creating a video on nixos impermanence via tmpfs as root or restoring root as an empty zfs/btrfs snapshots?
How do you take this flake and use it as you would the regular neovim package system wide?
Many ways to achieve it:
1. Use home-manager/NixOS module
2. Add this flake as an input to your flake and take default package from there
3. Just copy the output part from this flake into your home-manager/NixOS flake systemPackages
@@vimjoyerI've been struggling to wrap my head around this for 2 days now.I wanted to define the nixvim configurations in a file called nixvim.nix, and then import it into home.nix. But I get a recursion error when I do that.
My setup has these 3 notable steps:
1) `modules = [./home.nix];` in flake.nix
2) `import = [./nixvim.nix];` in home.nix
3) `import = [inputs.nixHomeManagerModules.nixvim];` in nixvim.nix
4) ..and then I hope to put the actual nixvim setup inside nixvim.nix
Now that I think of it, in step 3, nixvim.nix calls `inputs`, which is defined in flake.nix, which in step 1 itself calls nixvim.nix (via home.nix), and I guess that's why the recursion happens. The only solution that comes to mind is to somehow re-export inputs.nixHomeManagerModules.nixvim as nixvim from inside flake.nix, so that nixvim.nix can then just use it without causing recursion, but I'm not sure if/how one can do this.
But you somehow aren't having to do any of this in your video, and use a flake instead. What I don't understand is how you connect it to your home-manager configuration. Do somehow import that flake into home.nix somehow? Or maybe even the home-manager's flake.nix? If so, how?? I honestly have no idea anymore
I've been playing with NixOS over the last day and now I want to be able to pull my dotfiles from git into the OS automatically but I don't know how... can anyone point my in the right direction?
What do you mean by automatically? You can use git clone or nixos-rebuild --flake to fetch it from GitHub.
I'm configure neovim with nvchad. When I decide to use nixvim. I'm thing it is big mistake but after try three to five day. I'm very happy about it. But best part configuration. It come with lot of configuration. For nixos user I recommend use nixvim.
How did you get the mapleader to space? It's still bound to next character in my normal mode.
globals.mapleader = " ";
Works in an empty setup without anything else, just tested.
Thanks for responding, must be me then. Have a nice day! i'll make a donation @@vimjoyer
Hiya! Firstly, thanks for the amazing video Vimjoyer, however I have a small query, forgive me if it comes off as a stupid question.
So I have my nvim configured using the classic Nix way, with a lot of lua files and stuff
I already have a flake.nix in my /etc/nixos
how should I go about writing nixvim configuration? can i just edit it in flake.nix itself?
You can just make a new flake for nixvim, and move it to your existing one when you are satisfied with the result
Thank you! I will do that
@@vimjoyer Thank you so much vimjoyer!
I wrote all my config, pushed it to github and now am importing my git repo in my systems flake and using that as output to my inputs
Is it possible to use it together with other distros (specifically the ones that are just handled as lua plugins)?
You can use them separately, but I don't think there's a way to integrate them together.
Have you managed to modularize your nixvim config and keep stylix working?
I followed a blog post from Valentin Pratz about using "inputs.nixvim.legacyPackages.x86_64-linux.makeNixvimWithModule" to allow the config to span multiple files, but stylix doesn't seem to detect and theme nixvim anymore, and I can't work out how to tell it to.
I prefer to have a separate theme for my editor, so I didn't connect my neovim to stylix
How do you manage multiple flakes? Are they concatenated into 1 file or is there a better way to do this?
Flakes can import other flakes with web or filesystem urls, but you can include as many projects in one flake as you want. It all depends on your specific use case.
So would you run a nixvim flake for each project, or modify the "global" flake at /etc/nixos in this case
would it be possible to configure nixvim's colorscheme with nix-colors? I saw in the colorschemes "base16", so maybe it could be possible? Thanks
Sure, you can interpolate colors into highlight groups.
first you pulled a flake, then you're editing some config file. i assume home.nix?
what if i dont want to use home-manager? very confusing...
What if I want to install and configure nixvim entirely from my home-manager?
Use home-manager module and configure everything with `nixvim = {}` option
Thank you, loving the vids @@vimjoyer
@@vimjoyerHow exactly would you go on about this solution? I'm using flakes and declaring home-manager module in my flake.nix, but I struggle to make the nixvim option visible in home.nix.
Is there an easy way to convert my existing shell customizations into Nix language syntax? I use a theme, plugins, aliases, functions, set environment variables, etc. I also try to make it portable, so it works on multiple shells, and sometimes I use loops to do multiple operations. Can I replicate this wit Nix? I know Nix is functional, not procedural.
Home-manager has options for all major shells, and interpolating packages into them ensures that your shell will work the same way on any OS. Managing themes and plugins with nix is also very easy.
This is super interesting! Thanks! ❤❤
I was wondering how do you make those nice code transition effects? 🤔
software is called `motion canvas`
Thanks! Appreciate it! 🫶
Kinda late here, but I use Emacs, specifically Doom Emacs because I'm lazy. It has very crappy integration with Nix and I barely managed to get it working using nix-doom-emacs. I'm actually considering switching over to Neovim (maybe also Neovide, the GUI frontend?), but I will definitely miss some of the Emacs features, especially Org mode. I really don't wanna leave the Emacs ecosystem, but it's just too unpopular to actually be useful and receive good support. Everyone just makes plugins for VSCode nevertheless...
Neovim has lots of Org mode alternatives, most notably Neorg, although they may not have all the functionality of Emacs' Org mode
if it makes u feel better getting prety much anything except software-you-write to work on nix is a fucking pain.
Sounds amazing! What about lazy loading?
There is an issue opened called "[Feature] Lazy loading", so I guess it's coming
@@vimjoyer Great! Thank you!
So Nixvim maintainers need to support configuration of every plugin in existence? Does not sound sustainable.
I checked the source code and they really have flake configuration for every plugin they support, some of them are over 500 loc long...
I have a fairly low amount of sleep time.
@@GaetanLepage sad
More seriously, we are shifting to adopting the "settings" convention from RFC-42 for the plugins. This is much more sensible and sustainable.
@@GaetanLepage means u don't have to make those settings thing ? user can do normally ?
love nixvim!
Sorry to bring some negativity.
But I don't see the point. The video doesn't quite make the case for nixvim and would be greatly helped by an introduction explaining the core ideas.
From this presentation it seems a marginal difference to just default neovim configuration with lazy. You have your lazy.lua with a plugin list (identified by string rather than plugins.plugin.enable like here). Plugins often require you to run a setup. Frequently just a require and a setup function call with no argument. Which you could do with the config field in lazy, it's just a very tiny difference. The *_potential_* benefit I do see is that nix might provide defaults for supported plugins that may lack them. It might resolve keymapping conflicts or overall have a system of keymapping structuring that makes it maximally consistent for whatever plugins you might use together. But that's not presented here. That would be incredibly useful for someone who wants defaults as much as possible.
You set options in a very similar way, vim.o.shiftwidth=4, just not declared in a table. Of course neovim options aren't just in .o, so clearly this is good if they're now sensibly unified.
I find the lsp config presentation most confusing. It would be one thing if just that server list with .enable was required and it creates nice sensible defaults for you with literally no config on your part or only exposing a set of rebinding options. In line with the key mappings idea.
But you've replicated the lsp_config example config on github within a difference of maybe 5-10 lines. And you've obfuscated control. With lsp_config it's perfectly clear. It uses vim primitives like autocmd which will be used elsewhere in almost any config.
The benefit is just so marginal.
Maybe the big benefit isn't mentioned. Maybe the person who made nixvim absolutely loves declarative configuration and this is for those people. That's good. But from my perspective it's not that different.
I agree with you on some points, but the difference between using lspconfig and nixvim is that nixvim I also installs lsp servers for you. It's more comparable to Mason, minus installing dependencies like npm. Nixvim ensures that your setup will work on every machine.
@@vimjoyer You're right, I forget I have mason becuase I don't have to touch it. Which to me doesn't make it that important to abstract away. OS support is a big plus. I would guess that newer neovim users are more likely to have to use windows some of the time.
Awesome, thanks
is somoene make a package manager using brainf**k i don't know how to make it
Make a brainf**k to nix transpiler 🧠
@@vimjoyer somoene proably makes a brainf**k compiler in nix maybe somoene could do it.
Nixvim > lazy
Thank you very much for the video
What the actual fuck