How to Use Neovim with Devcontainers

Поділитися
Вставка
  • Опубліковано 21 гру 2024

КОМЕНТАРІ • 49

  • @mischavandenburg
    @mischavandenburg  6 місяців тому +2

    Hey friends, I hope you enjoyed the video!
    I have a small favor to ask. I'm growing my Twitter account, so I'd appreciate it if you could give me a follow.
    twitter.com/mischa_vdburg
    It's a free way to support me and the channel!
    I've also started a newsletter. Feel free to check it out:
    mischavandenburg.substack.com/

  • @simquinoa2030
    @simquinoa2030 6 місяців тому +8

    I spent weeks trying to figure out devcontainers in neovim.
    Now I just use nix shell.
    It’s an amazing solution. With direnv I cd into my project, all dependencies are loaded and setup, and I even load a custom zellij layout.
    So all my panes are already setup on a per project basis

    • @simquinoa2030
      @simquinoa2030 6 місяців тому

      One thing to add. Setting up databases will pretty much always be better using docker (therefore dev containers).
      I usually prefer to include db build scripts as part of my startup flow though.

    • @fdimb
      @fdimb 3 місяці тому +1

      Can you isolate the project folder with Nix shells? With devcontainers I can mount only the project's folder (and a cache for things like pnpm so its shared between proejects) without exposing the rest of the filesystem.
      Genuine question, I haven't used Nix ever but everything I read about it seems amazing, I'd daily drive it just for the dependency management regardless of replacing devcontainers or not, but seems like a big switch from usual distros.

  • @cloud-native-corner
    @cloud-native-corner 5 місяців тому +3

    Cool vid, I noticed you typed lspinfo several times due to capital characters not matching. This is pretty annoying, but can be solved with this setting `vim.opt.infercase = true` which infers letters capitalization in insert mode and command line mode.

  • @wazz6003
    @wazz6003 6 місяців тому +2

    Great usecase for different customer/projects working with Devcontainers and Neovim, thanks alot!

  • @zehph
    @zehph 6 місяців тому +2

    My nvim config has a setup for auto installing my lsps, linters and formatters on first open as well, this is why I went for a custom cfg instead of using lazy. Took a little extra setup at first, but is smooth now.

    • @mischavandenburg
      @mischavandenburg  6 місяців тому

      But does it install all of the lsp's every time? With this setup, I can tailor it for each environment

    • @zehph
      @zehph 6 місяців тому

      @@mischavandenburg yeah, installs all of them, but maybe you could have the container endpoint run a nvim instance headless to install the extras here. You could pass the baby off the extras as a parameter to a little script there.

  • @CristianHeredia0
    @CristianHeredia0 6 місяців тому +1

    I use nix and nvim on osx and primarily develop in docker compose containers, so I’m eagerly looking forward to the next video. Using nvim inside of docker , with my conf, is a pain point I’ve been trying to solve for years.

  • @rwz
    @rwz 6 місяців тому +1

    I started using devbox and really like the nix experience without containers.

    • @teeeh_
      @teeeh_ 6 місяців тому

      I am wondering if this can provide the same security benefits of a (correctly configured) docker container.
      Pulling in many third party dependencies (npm etc.) feels more and more problematic. With the shown way of putting nvim into the container you also solve the same problem for it if there ever should be a malicious nvim plugin.
      Can I achieve the same isolation of main os/user and projects with nix?
      All I heard so far is that it is superior in setting up projects with pinned dependencies but does not bring any benefits in case of supply chain attacks.
      Honest question

  • @Ish_NotToday
    @Ish_NotToday 6 місяців тому

    How collaborative is this approach? Will there be issues when multiple people connect to it?

  • @_fr3d_
    @_fr3d_ 6 місяців тому

    Legit! the tradeoff is worth it as you can modify the environment as needed if custom variables or tool versions are needed. Bringing neovim along is a must! I'm gonna add neovim to my security research container soon!

  • @BTC.maximalist
    @BTC.maximalist 5 місяців тому

    @mischavandenburg : How did you get to install devpod on Talos Linux? I am new to Talos Linux and prefer to keep using it and not fall back to k3s.

  • @benarcher372
    @benarcher372 6 місяців тому

    Excellent and really interesting. I would much like to separate my various customer work in a safe and predictable way. Nix seems so hard to get my head around (not interested in the OS, only the package management part). Looking forward to your next video. Thanks and take care.

    • @mischavandenburg
      @mischavandenburg  6 місяців тому

      Thank you for the comment. When I discovered this method of separation I was sold immediately!

    • @ImperiumLibertas
      @ImperiumLibertas 4 місяці тому

      Nix as a package manager is really simple for simple use cases. You should give it a try. Nixos and Darwin nix is where things get difficult.

  • @zehph
    @zehph 6 місяців тому

    I need to setup a homelab with tailscale and using this setup I can use a macbook air to handle all my needs to work remotely with great workspace separation and compartimentalization of stuff

    • @mischavandenburg
      @mischavandenburg  6 місяців тому

      Yes I think this is the way to go. Homelab is best, but DevPod also lets you run the workspaces on a VM on your chosen cloud provider, so you can use that as well until you get your own setup.

  • @trancongminh2628
    @trancongminh2628 6 місяців тому

    Hi bro, Can you share me your colorscheme on your terminal and lazyvim?

  • @testolog
    @testolog 6 місяців тому

    This is pretty good, but motivation is immediately work from any computer. Is at least questionable about project what u are working, because ur motivation looklike could resolved ssh. Other hand how many time u should to run from different laptop? But i know real reason why u did it. Is pretty simple. U buy a cluster for home and try to find how to utilize it) I know this felling because i'm the same)

  • @bastian9945
    @bastian9945 6 місяців тому +1

    A Microsoft MVP using Mac. Blasphemy - I Like IT! xD

    • @mischavandenburg
      @mischavandenburg  6 місяців тому

      I am a man of several glaring contradictions. Thank you for the comment!

  • @艾曦-e4g
    @艾曦-e4g 6 місяців тому

    Wonderful topic and good video. Perhaps, I am going to subscribe your channel depending on your next video. IMO, your method is copying your neovim config every container and repeat it many times making it difficult to maintain, and which is different from vscode's client and server architecture. Nix can help automatically maintaining different but similar configs by pinning different commints . Working with mountable shared volumes or directories and nix's Experimental Local Overlay Store, the storage of the container will be small and much more portable. I am really looking forward to your next video. My further question is: how to combine the project its own container and code base with devcontainer? Config in devcontainer.json from images? and base on it to install your config?

    • @艾曦-e4g
      @艾曦-e4g 6 місяців тому

      BTW, what do you think about neovim --remote?

    • @mischavandenburg
      @mischavandenburg  6 місяців тому

      All of these I will explore in upcoming videos, so stay tuned! I did see nvim --remote but it did not seem to suit my needs. I prefer using devpod

    • @艾曦-e4g
      @艾曦-e4g 6 місяців тому

      @@mischavandenburg I am looking forward for it.

  • @comosaycomosah
    @comosaycomosah 3 місяці тому +1

    Oh yea gonna need this to use codespaces via machine with 0 room for dev environment lol

    • @mischavandenburg
      @mischavandenburg  3 місяці тому

      I have no idea what you mean

    • @comosaycomosah
      @comosaycomosah 3 місяці тому

      @@mischavandenburg I've not used dev containers before....it will be helpful for creating dev environment in github codespaces

    • @mischavandenburg
      @mischavandenburg  3 місяці тому

      @@comosaycomosah oh yeah they are super useful !!

  • @i.zhuravlev
    @i.zhuravlev 6 місяців тому

    first, autoliked

  • @guidyouguy7306
    @guidyouguy7306 6 місяців тому

    Surprise you hostname same with me

  • @MarcGris
    @MarcGris 6 місяців тому

    Very Nice !!! I'm "doubling down" on @CristianHeredia0 's comment: Looking very forward to your next video using nix instead of homebrew. Thx Misha 🙏😊

  • @ash1kh
    @ash1kh 6 місяців тому +3

    So sad. Even microsoft devs don't use windows.. or surface laptop.. is those products that bad and expected us to use.... 🤣

    • @mischavandenburg
      @mischavandenburg  6 місяців тому +1

      I don't think these products are bad. It's just that there are better alternatives available. I also think these devices are more designed for the general public and office workers who only need powerpoint and web browsers

    • @BTC.maximalist
      @BTC.maximalist 5 місяців тому

      @@mischavandenburg have you seen ChromeOS devices? They dont even have power point running 😆 . They do though run LXD containers 💪

    • @redcoreit
      @redcoreit 4 місяці тому

      Yeah, but many people are locked in Windows because of .NET Framework. No, you cant upgrade if your hands are tied by vendors who ignores newer .NET. And here I can watch the goodies from a MS dev. We are not even allowed to use wsl(1,2) with Windows dev, hail the
      deceision, not to mention the perf.

    • @ash1kh
      @ash1kh 4 місяці тому

      @@redcoreit LOL. thats how i discovered the taste of freedom for the first time of life in UNIX system 12 years ago.

    • @redcoreit
      @redcoreit 4 місяці тому

      @@ash1kh sigh

  • @alanfzf
    @alanfzf 5 місяців тому

    Im managed to create my own devcontainer, but some thing that's annoying me is the fact that nvim, just doesn't render properly sometimes, text on screen doesn't redraw, and it just gets stuck, may i ask? what terminal emulator are you using as it seems it's not happening to you

    • @mischavandenburg
      @mischavandenburg  5 місяців тому

      I get too many technical questions every day, so I answer these questions in my Skool community.

    • @alanfzf
      @alanfzf 5 місяців тому

      Found a fix if anyone needs it: just change you TERM environment to "screen-256color"