Nix in 100 Seconds [video]
youtube.comwas wondering when this guy would drop a video on nix. pleasantly surprised by the result, although i do find it funny that he had to go well over the usual 100 seconds. that's nix for you.
one benefit that doesn't get much lipservice in elevator pitches for nix, here included, is the experience of packaging. i think the average line count in my personal collection of obscure software is ~30, and that's including license/homepage metadata and other such junk -- it can make even bsd portfiles look tubby by comparison.
> over the usual 100 seconds
It's a running joke now. There hasn't been a "100 seconds" video shorter than 2 minutes in a long time. Most are around 3min.
As a Nix foundation person - If anyone gets a 100 second pitch for Nix, dinners on me and I'm using it in the Nix marketing efforts :D
Agreed on the packaging experience for nix. We've been talking about that for a while also on the Flox side when we're working with folks.
Nix sounds cool. Nowadays when I dev my research, I usually use docker so that I can move my "machine" to any server in my lab. Not sure how I should fit Nix into my workflow.
There's a bunch of tutorials out there now, but what's the main case you're trying to solve for? Just an easy dev environment? There's an ecosystem out there that ease up the entry for Nix and also nix.dev does a great job as part of documentation efforts inside of the community.
Hi, thanks for your reply! Yeah I was thinking about something easier for developement. Currently I use docker for most of my pipeline. But if it is possible, I would want to try something else more flexible.
Docker has dockerfile and all but even in 2024 I still have to compile and build stuff inside docker and then run 'docker commit' because building package with Nvidia gpu checking during 'docker build' usually fail for me.
And maybe something free me from the curse of distro. Previously I tried to run omniverse with isaac lab in my pc. Fedora, ubuntu 24.04 all failed. Only ubuntu 22.04 works. Distrobox actually didn't solve that case for me. And Omniverse docker image from nvidia doesn't support GUI. So I have to reinstall ubuntu 22.04 to use it. But currently the gnome is glitching with ubuntu 22.04 and I have to alt+f2 and type r to reset it frequently. I am just too tired to do another reset so I am here venting and looking for something more flexible.
I'll look into nix.dev.
Nice explanation. But Nix is known for a steep learning curve, there is any reason for this?
The learning curve depends strongly on what you are trying to do. Many things are very undocumented in Nix, and the interpreter being lazy creates very hard to read errors. No static typing makes everything worse.
If you are trying to configure your system using NixOS, the available options are very well documented so I personally rarely get into trouble.
Packaging an application however can be very difficult.
It's not a curve, it's a wall.
I've tried and failed twice. I think I irreparably messed up my macOS installation with tons of crap by trying.
macOS’s core is in a read-only volume for a few years now, so I doubt you can mess it up unless you disable system integrity.
Yeah, nix on macOS can be a pain…
You might be too deeply scarred to come close to it, but we just wrote a blog post about deploying NixOS servers without installing nix locally or provisioning work here that feels relevant: https://garnix.io/blog/hosting-nixos
if anyone is afraid of this happening to them, I'd recommend the deterministic nix installer. it has an atomic installation process where each step is reversible with the uninstaller. This is uniquely a macos issue since the setup is a bit different to other OS's in terms of creating a read only filesystem for the nix store, but the determinate installer was built to fix any worries of that happening.
can vouch for the detsys installer, and anecdotally, the resulting nix install seems more resilient across os updates. on a similar note, nix-darwin is a must-have. the typical nix-env stuff you see in introductions to nix on non-nixos systems really sells it short, as it feels like just another package manager to keep track of. by contrast, nix-darwin brings the centralised configuration.nix approach, which makes it way harder to hose your environment.
Yes, it’s the result of a doctoral degree.[1] It was never meant to be simple in the first place.
i.i.r.c. the answer to this question is the complexity of Nix is necessary to achieve the level of assurance it provides.
" You may quickly encounter Nix language expressions that look very complicated. As with any programming language, the required amount of Nix language code closely matches the complexity of the problem it is supposed to solve, and reflects how well the problem – and its solution – is understood. Building software is a complex undertaking, and Nix both exposes and allows managing this complexity with the Nix language. " https://nix.dev/tutorials/nix-language.html
My read of this is any other build system has random elements that are usually fine but sometimes cause issues. There are no random elements in a Nix expression.
i.e. Yarn has a lockfile, but does not guarantee the system underlying the Yarn process is "locked." Nix does this down to the fundamental Linux/Mac libraries.
The upside is this complex configuration is a one-time cost for your project. Using a project configured with Nix can be simple. For instance, a Nix Flake can be set up for your project which defines your project workflow commands in the shell. These commands are completely portable.
Nix is not a virtual machine. But it does guarantee the command will run the same way on equivalent systems (unless it does something that goes outside the Nix boundary).
The problem for me isn't installing packages and their dependencies but removing the dependencies when clearing a package. Too many package managers leave garbage on the system just in case and now I have packages for who knows what