Why would I write a Dockerfile in a minute or two, when I can spen the afternoon doing the same thing in Nix?
@vimjoyer2 ай бұрын
Exactly
@vojtechralis60752 ай бұрын
chatGPT writes nix files not me
@parsanobahari60892 ай бұрын
@@vojtechralis6075dear god
@mikemerinoff2 ай бұрын
@@vojtechralis6075who’s writing gpt prompts for you?
@anonymouscommentator2 ай бұрын
@@vojtechralis6075chatgpt sucks at nix 😂
@gregf30212 ай бұрын
Every time I sit down and think hmm I really want a new vimjoyer video it appears. Thank you for your hard work.
@vimjoyer2 ай бұрын
👍
@ベース-l1f2 ай бұрын
I like the new visual style you have for your videos
@vimjoyer2 ай бұрын
Didn't quite have enough time to polish it for this one, hope it's going to look even better in the next one
@LuxioTheMan22 күн бұрын
@@vimjoyer you're good, great even
@lowgos06062 ай бұрын
You are the best. I love how you show both the flake and classic ways, this is really helpful. And the building debug technique is great
@Dominik-K2 ай бұрын
Thanks a bunch for this video. This is one of the super powers of nix and those shells are just way easier to use than any container setup I know
@mastermach502 ай бұрын
Note that if you use `nix-shell` (no flakes) only the packages and dependencies specified in shell.nix get added to the /nix/store, but if you use `nix shell` (flakes) the entire folder that contains flake.nix gets added to /nix/store. So if there are many large files in your project (like some AI models) those also get added to /nix/store taking up a lot of space.
@yash11522 ай бұрын
thanks a lot for sharing this. the obvious difference between those is default channel, but thanks for sharing this too.... but also, it feels counter intuitive for even the ... umh wait, so, there's "nix shell" and "nix develop"... are these two same? 9:41 but kinda not clear what's the difference in "shell" and "build shell"
@kinzoku-dev2 ай бұрын
vimjoyer never fails to make our toes wiggle
@vimjoyer2 ай бұрын
Oh hi kinzoku
@kinzoku-dev2 ай бұрын
@@vimjoyer greetings fellow vim enthusiast
@MrVampify2 ай бұрын
This video showed up right on time. I just started learning how to make derivations. This is PERFECT.
@benjaminwagner45972 ай бұрын
Your videos are always 10/10. Thank you for your contributions to the community!
@WaterGame77772 ай бұрын
Wow, I know FOSS developers especially always talk about how prompting people to donate works, but this really made it click with me. Love your videos, it just never appeared in my mind that you take donations. so yay! PS: your videos are absolutely amazing and are how I got into Nix. Without them I might have ended up giving up on it again. Every time someone asks for advice on learning Nix(OS) I always recommend your videos!
@Bvngee2 ай бұрын
Note that any nix-shell command _can_ be replaced by nix develop. For example, `nix-shell -E "with import ; …"` can be replaced with `nix develop -expr "with import ; …"`. Also see nix develop -f. Another immensely useful option is nix-shell’s -command (or just -c for nix develop). This lets you, for example, use zsh instead of bash.
@vimjoyer2 ай бұрын
facts
@simquinoa20302 ай бұрын
I NEVER KNEW ABOUT -c. That's so useful thank you
@saitheninja2 ай бұрын
I like to use `shellHook = ''exec $SHELL''` in my file. Then `nix develop` will open your configured shell automatically, without having to type the extra flag. (Not sure if this works with `nix-shell` because I'm using flakes exclusively.)
@NabekenProG872 ай бұрын
Yoooooo, thx for introducing me to build shells. I just got started making derivations, this seems to be a much more efficient way
@computing110 күн бұрын
love this channel, please keep going!
@XDtaylormagic2 ай бұрын
Great video! Always look forward to when you post! Hope you have a great day!
@lieywe34382 ай бұрын
I really enjoy your videos! I think mentioning lorri (to prevent certain shells' packages from being garbage collected) would've been informational too 🤔
@vimjoyer2 ай бұрын
I think I can make a general video for useful tools from nix-community
@codeman99-dev2 ай бұрын
2:30 Thank you stating right up front why I won't switch. The isolation is paramount. Not only are devcontainers easy to share, but you are forced to update that configuration. Nothing is worse than a dev configuration that only one person on the team cares about.
@doce36092 ай бұрын
you are truly the nix god our world needed
@LucianThorrАй бұрын
I've wanted to have a quick way to run a Jupyter notebook without having to deal with python virtual environments on my home computer. This seems like the perfect way to keep things clean and reproducible without having to worry about my python package manager going breaking itself every few months. Thanks for the pointers.
@Gilded_Seraphim2 ай бұрын
You terrify me you mind reader, keep your dark magic away from me, CAUSE THERE AINT NO WAY you could know EXACTLY what I am struggling with
@vimjoyer2 ай бұрын
I'm in your walls
@bencarmichael7902 ай бұрын
@@vimjoyerIn my shell more like
@jheregreign2 ай бұрын
@@bencarmichael790 👻
@Majiy002 ай бұрын
As always amazing video!!!!
@edhyjoxenbyl14092 ай бұрын
Setting environment variable in the mkShell scope is a legacy behavior. The recommended way is to use `env` sub attribute set. (like `env.MY_VAR = 1;`)
@yash11522 ай бұрын
thanks for sharing this. the "every not recognised var is considered env-var" thing is super yucky for me. > _" recommended way is to use `env` sub attribute set "_
@callanambulancebutnotforme57022 ай бұрын
Loved the explanation 👏
@coramuirgen29592 ай бұрын
your videos are helpful overviews, thanks
@MonSteh2 ай бұрын
First comment, but have to say I like the speed at which you present in this video is the best (I'm a pretty slow guy tho).
@starving2072 ай бұрын
ХФФІХвзхфізвфхівхїфі ЛУчший Продолжай мой любимый ютубер по NIXOS
@vimjoyer2 ай бұрын
thanks
@starving2072 ай бұрын
@@vimjoyer I LOVE U MY CRUSADER BOY
@SebastianLopez-nh1rrАй бұрын
Awesome work!
@gabrielnuetzi2 ай бұрын
to the point ❤ well done!!
@HiramBarrozo2 ай бұрын
Hi! I really enjoy your videos, they're super helpful! I have a question: I'm starting to learn Nix (I love flakes) but sometimes I get stuck. What IDE would you recommend for a beginner like me? Thanks in advance!
@vimjoyer2 ай бұрын
I use neovim, use whatever you feel most comfortable with.
@berkano46172 ай бұрын
Every time i rebuild my NixOS new father appears. Btw, now i have 112 version🥳😝
@s1n7ax2 ай бұрын
Boii waiting for this
@darux2682 ай бұрын
Being able to launch gui applications without having to fuck around with the x server is great, this sounds super useful on nix os but I don't think it'll kill dev containers anytime soon. If you want to share a dev environment with someone else it's much more likely they already have docker and docker knowledge than nix and nix knowledge
@JokingChickenn2 ай бұрын
Yes! Was literally just researching this. Are u a mindreader? Thx for video
@vimjoyer2 ай бұрын
Nice
@anakin13372 ай бұрын
i see a nix video i instantly press 👍
@CoinedBeatz2 ай бұрын
this video some weeks ago would have helped me quite a bit :P. I really like the approach nix shells provide to specify project based dependencies especially with flakes to even lock those versions. I'm trying to switch fully to NixOS but my work environment prevents me from doing so. The main reason being that `schroot` is not available in nixpkgs. I'm currently trying to package that but get quite some resistance along the way. After all I'm not even sure if `schroot` will work as expected. That's why I'm pursuing distrobox for my work environment which I could more or less plug-in-replace the schroot calls. But then again the nix store gets mounted to my container, which creates conflicts... (most likely due to home-manager). So right now I'm trying to get a pure podman command that does the trick for now until I'm done with writing a dozen derivations for all the stuff that's missing. But every new project I'll create will be based on dev shells.
@diego552 ай бұрын
Nice video! It would be great if you could use a specific version of Node, especially an older one. For example, I have a project running Node v12.22.2. Thank you for your videos, I'm starting to love Nixos thanks to you!
@vimjoyer2 ай бұрын
That's what flakes allow you to do! You can check the nixpkgs package version history, and find nixpkgs that contain the version you need
@anticrisis90062 ай бұрын
How can I upvote this twice? I've come back to review it multiple times. Very helpful, thank you!
@enriquecasas40012 ай бұрын
Awesome content!
@cyrus013372 ай бұрын
Since I already use Docker and Devpods, I don't see much use case for NixOS and it's various Nix* tooling, though it's quite the exotic distro that I'd love to trial in a VM some day.
@guifuentes82 ай бұрын
Amazing, bro.
@tortilla-dev2 ай бұрын
Hey! I just wanted to congratulate you on the amazing work you're doing with Nix, your explanations are super clear and helpful. It would be awesome if you could create a tutorial on Prisma since it has some conflicts on NixOS when used as a dependency in Node projects. Thanks for all the great content you share, and keep up the fantastic work! 💪🚀
@BaiDamqn2 ай бұрын
I love your videos !!!
@ruroruro2 ай бұрын
I strongly recommend using the nix3 cli in this case ("nix shell" with a space, it is enabled by the nix-command experimental feature). nix-shell isn't actually equivalent to "nix shell", it's equivalent to "nix develop". The older nix-shell command was originally intended to be used for developing/debugging nix derivations, not for ephemeral shells. If you want ephemeral shells (basically, if you want to temporarily emulate actually "installing" the packages) then "nix shell" is much better compared to nix-shell. For example, "nix shell nixpkgs#gcc" would use YOUR default shell and it would also populate a bunch of environment variables so that stuff like "man gcc" works inside that ephemeral shell. On the other hand "nix-shell" would always use bash and you won't be able to access the man pages.
@alyti2 ай бұрын
actually useful yt comments, wild, thanks for info
@NabekenProG872 ай бұрын
Thx for the tip. But I guess now I have to type "nix shell nixpkgs#python312 nixpkgs#python312Packages." instead of "nix shell python312 python312Packages."? Seems kinda verbose
@ruroruro2 ай бұрын
@@NabekenProG87 you can significantly reduce the amount of typing required by 1) creating an alias for nix shell 2) creating a shorter name for nixpkgs in the flake registry and 3) using bash brace expansions. Applying all 3 tricks will result in something along the lines of ns pkgs#{hello,gcc,gnumake,python3.12}
@NabekenProG872 ай бұрын
@@ruroruro thx for the tip, but fuck me for not using bash lmao
@ruroruro2 ай бұрын
@@NabekenProG87 What shell are you using? Brace expansions are also available in zsh and fish. Of the shells I know, only dash doesn't support them. Try running echo x{a,b}y in your shell. You should get "xay xby" if your shell supports brace expansions.
@pupip552 ай бұрын
that thumbnail though
@vimjoyer2 ай бұрын
Clickbait 👍👍👍
@pupip552 ай бұрын
@@vimjoyer it definitely worked
@yash11522 ай бұрын
hi! what's the summary difference in * this current video titled: " Best Way To Manage Project Dependencies | Nix Shells " and * the older one titled: " Nix Dev Environments | Declare Your Coding Projects " i've watched these both, but can't recall the differences in these, and hence, can't decide which one to refer some other person to for which situation
@vimjoyer2 ай бұрын
I like the newer one more, it focuses on the devshells, and leaves the flakes explanation to the flakes video
@Heshamelfakharani2 ай бұрын
i know this kinda goes against the purpose of nix shell but can i use docker insid them? would the docker instance be isolated in that shell? im working with big docker compose setups that i don't have the time to move entirely to nix
@vimjoyer2 ай бұрын
You can use nixos-shell, it's like nix-shell but with docker
@Heshamelfakharani2 ай бұрын
@@vimjoyer thank you!!
@bobmcbob43992 ай бұрын
But you also get isolation of your home data in containers. You don't get that with nix shell.
@vimjoyer2 ай бұрын
But you can still achieve that, I'll make a video about that soon
@bobmcbob43992 ай бұрын
@@vimjoyer ok, that would be interesting. My main motivation for dev containers is to stop the data hoovering from software within the container.
@rodrigof.59562 ай бұрын
I recommend using lorri, it autoloads the nix-shell when opening the directory, and it's also useful for using shells different to bash
@xlustx55912 ай бұрын
Man but python packages in nix make me cry every time
@RobertFletcherOBE2 ай бұрын
yeah python packaging was bad enough, using python on nix is a complete pain.
@anonymouscommentator2 ай бұрын
when you find out you have to recompile the entire cuda toolchain just because you wanted to use pytorch right after you had to compile the entire cuda toolchain because you wanted to use ollama
@nobody-bt3iwnobod2 ай бұрын
You could use nix shell for installing python interpreter and then create a virtual envrionment for project specific packages. Similar to pyenv + venv
@MWLaboratories2 ай бұрын
Im stuck on installing npm packages not available in nix pkgs like vuetify.
@alyti2 ай бұрын
shout out to devenv flake and it's pre-commit-hooks and background process stuff, great for bootstrapping more complex envs than a few packages
@rishivora10762 ай бұрын
i still havent figured out how to work with python and its libraries using nix shell. for now, i just use devenv, but it doesnt protect installed packages from garbage collection.
@madol37282 ай бұрын
Man. I was just setting my new project with docker. I really just pushed the changes, closed my terminal and went to youtube. Yeah I'm opening my terminal up again
@Cypekeh2 ай бұрын
What is the easiest way to always run the same shell with nix develop (like zsh), without always specifying the -c flag?
@vimjoyer2 ай бұрын
Make an alias
@dezly-macauley2 ай бұрын
Any way to ensure that dynamically linked binaries work with this setup? Certain NixOS packages are a headache to use.
@vimjoyer2 ай бұрын
All nixos packages will work just fine, but if you want to run foreign binaries, there are many ways to do it. You can try nix-ld/nix-alien, steam-run, or patch the binaries yourself
@dezly-macauley2 ай бұрын
@@vimjoyer Thanks!!!
@bulldoser26102 ай бұрын
Just one question. If i use the unstable branch in flake is my system really reproducable? if not how do I acheive absolute reproducibility including package with exact versions? Thanks.
@vimjoyer2 ай бұрын
Unstable version is perfectly fine. The name is scary, but it's very much reproducible, and more stable than most distros repos
@bulldoser26102 ай бұрын
@@vimjoyer does flake.lock pin every package version from unstable branch?
@panchohorrillo5092 ай бұрын
@@bulldoser2610 Yes it does. That's how I live 🙂
@anticrisis90062 ай бұрын
Thanks
@yash11523 күн бұрын
i am running nix run. it is running the package i build fine, but i think it is not running the checkPhase (aka make check), as i deliberately added a failing test, yet i still see no output regarding that.
@v3rm1n2 ай бұрын
I like devenvs that way I can start services haven’t found a ways to do it in a flake devshell
@yash11522 ай бұрын
6:22 > _" pkgs.mkShell.inputsFrom "_ how to specify a local mkDerivation.nix file inside the inputsFrom list?
@vimjoyer2 ай бұрын
Those are just packages, so you can add your local packages there by wrapping callPackage in some parentheses().
@Resursator2 ай бұрын
> solves "it work for my machine" problem Yeah, instead you will have "it doesn't work for any machine" problem :D
@NabekenProG872 ай бұрын
Thats a possibility for all software. I can write a Python program that craps itself in 1min, tremble mortals
@nicholasantidormi62382 ай бұрын
How to manage different projects, with different nodejs versions (usually .nvmrc) and different package managers (in the last one usually done by specifying it in the package.json and using corepack)?
@vimjoyer2 ай бұрын
You can get different versions of nodejs/npm/yarn in your shell with flakes. You just need to include additional inputs with correct versions for them
@nasang74782 ай бұрын
What if nixpkgs doesn't have a specific dependency?
@vimjoyer2 ай бұрын
You can package it, it's much easier on nixos. I'll make a better video about it soon
@MWLaboratories2 ай бұрын
@@vimjoyer sounds like the same problems I'm facing with adding vue/vite/vuetify to my nodejs dev shell. It isn't to be found in nixpkgs.
@Folvin-x1o2 ай бұрын
Пон пон пон пон Согл согл согл Баз база Основа основа
@ДашаГолік2 ай бұрын
Nice
@alexander130942 ай бұрын
And you need to figure out how to run it unprivileged. For docker it is just adding yourself into docker group
@vimjoyer2 ай бұрын
you do not need any privileges to use nix shells
@alexander130942 ай бұрын
Yeah, didn't noticed there is nix-users group. Will test
@alejandrobonilla77592 ай бұрын
Hey just one thing the aliases do not go from your shell to the new one (at least with zsh does not happen)
@alejandrobonilla77592 ай бұрын
Nice video, I got into nixos thanks to you keep it up
@alejandrobonilla77592 ай бұрын
So I tested it and it is because the -p invokes bash but the flakes way opens your default shell (in my case zsh)
@vimjoyer2 ай бұрын
You can use add `--command $SHELL` at the end to get into your favorite shell
@ruroruro2 ай бұрын
or just use the nix3 cli (the ones with the spaces, enabled by the nix-command experimental feature) nix-shell isn't actually equivalent to "nix shell", it's equivalent to "nix develop". nix-shell was originally intended to be used for developing/debugging nix derivations. If you want ephemeral shells (basically, if you want to temporarily emulate actually "installing" the packages) then "nix shell" is much better compared to nix-shell. For example, "nix shell nixpkgs#gcc" would use YOUR default shell and it would also populate a bunch of environment variables so that stuff like "man gcc" works inside that ephemeral shell. On the other hand "nix-shell" would always use bash and you won't be able to access the man pages.
@isaacaymerich27412 ай бұрын
you forget an important thing, what about pining package versions :) ?
@vimjoyer2 ай бұрын
I have a whole 15 minute video about it, it's linked in the description
@3ChunkyPL2 ай бұрын
Alright, so now we can talk about nix-direnv
@imnotchinese62352 ай бұрын
do you daily drive nixos?
@vimjoyer2 ай бұрын
Of course
@imnotchinese62352 ай бұрын
@@vimjoyer i tried and failed, but i'll be back
@martianhunter71682 ай бұрын
I started my minor programming hobby with nix shells, I don’t know real devs live without them.
@jabahuntercrypto2 ай бұрын
hmmm
@doce36092 ай бұрын
0:12 you have a grammatical issue. 2. should be than not then.
@Bvngee2 ай бұрын
7 seconds ago wtf
@cbleslie2 ай бұрын
Wait until these fools learn about nix-pre-commit-hooks.
@jamesgphillips912 ай бұрын
meh... why do this when you can wasi use shims?
@vimjoyer2 ай бұрын
This is a completely different concept
@justadude87162 ай бұрын
regards, guy who never worked with proprietary systems and assumes usecase for webshitters is best usecase for rest of us. Nice click bait title.