Live data from Hacker News

Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

zero-to-nix.com

131–140 of 227 posts

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#131

Earlier quoted context omitted.

> Why should I invest time? It's not for everyone. Specifically, because Nix's 'costs' are upfront (for likely future benefit), nix isn't well suited to just-get-it-done pragmatic attitudes. -- e.g. if you'd prefer to just launch VMs from the web console, over using a tool like Terraform, then Nix isn't going to be for you. Nix isn't too difficult to use . I'd say it's 95% wonderful, 5% huge pain to deal with. (Writi…

How does Nix compare to Environment Modules: https://modules.sourceforge.net/ Am I correct in understanding they are similar, except Nix has the "pure" package building?

Modules imperatively modify the current (shell) environment (PATH and other variables) but you've to install anything required by modulefiles yourself. Nix handles package management and also allows you to declaratively create an environment to which you enter. For example `module load gcc` will bring gcc to your environment but it must already be installed by the administrator. On the other hand on Nix, you can either do something similar with `nix-shell -p gcc` which will give you an environment with gcc that if it isn't available on store will download it, but you can also create a `shell.nix` where you specify anything you need explicitly (have those packages available, download those dependencies not available as packages, make those config files, etc). Overall Modules has only a part of the functionality offered by Nix.

*Although `nix-shell` in newer unified `nix` command has been broken to few subcommands. Can find more info at https://blog.ysndr.de/posts/guides/2021-12-01-nix-shells/ if interested.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#132
As a Mac-using Python shop, we had serious file-sync performance issues when mounting our codebase inside a container via docker-compose. Nix completely freed us from them and allowed us to develop with Python natively speedily and without all the serious faff & headaches that usually comes with getting reproducible builds on everyone machines.

If you'd like to know more, I spoke at DjangoCon Europe late last year [1] on our setup; it's still paying serious dividends for us!

Happy to answer more.

[1] https://www.youtube.com/watch?v=Mx3yiE_CJOY

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#133

I'm glad this guide is focused on flakes. If you're starting out with Nix, forget about home-manager, nix-env, and the pre-flake configuration model.

But what if I manage my home-manager configuration with flakes.

Usually you’re on a single-user system anyway though. You should be able to manage all that with your global configuration.nix. You’ll also get the benefit of rollbacks.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#134
post #33

Earlier quoted context omitted.

I don't; my config lives in ~/flake, and I run `nixos-rebuild ... --flake ~/flake` whenever I update it.

You don't have to specify the nixosConfiguration name (e.g ~/flake#my-configuration)? Do you just name it "default" or something for that to work? I've never tried that.

You name it the same as your current system's hostname.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#135
post #6

Earlier quoted context omitted.

Thanks, Jorge! I think the nix3 interface and the Flakes solve a lot of UX problems. Maybe we could do a bit of a user study, to see where you get hung up?

What's the `nix3 interface`? I use NixOS with Flakes, but frankly it's quite obtuse lol. I don't even know how to specifically update my `nix`. I updated to the latest release the other week and my `nix` CLI is on `2.11`. Are you referencing a 3.0 version of the `nix` CLI? If is there a summary somewhere on what is different between 2.xx and 3.0? Though i still have no clue how to update to 3.0 if i wanted to. Search…

> I don't even know how to specifically update my `nix`

I just clean reinstalled when I went from v2 to v3. Thats the great thing about nix... the rebuilt system is still the same after I installed : )

Note that in nix v3, updating nix is a simple `sudo nix upgrade-nix`, which is really nice.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#136
post #109

Earlier quoted context omitted.

You're not wrong overall, but your example is. In the build environment, the current time is set to the epoch which removes that variability. An upcoming feature of nix is content addressed builds which use the output hashes to determine the store path. This should make it much more transparent which builds are reproducible and which are not.

> In the build environment, the current time is set to the epoch which removes that variability. The amount of time per build can vary. Embedded timestamps will all be in January 1970, but even a single second difference means the binaries are no longer bit for bit identical -- and that assumes the embedded timestamp isn't microseconds.

I think you're assuming that the timestamp only starts at the epoch and still advances in real time, which is not necessarily true.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#137
post #93
post #60

Just my two cents: Nix doesn’t guarantee “reproducible”, just “repeatable”. (I think it’s helpful to keep these technical concepts distinct, and to introduce the right terminology when teaching, since it makes elaboration easier in the future.)

These two words have the same meaning

Repeating a non-deterministic process can give you a different result, which makes the results non-reproducible.

Nix does provide a higher degree of functional reproducibility (builds will have the same behavior, if not identical bits) than other systems do, though, because of the way it locks down exact dependency versions and build flags, though. In that sense, Nix is 'more reproducible' than competing tools even when both are invoking non-deterministic compilers at the last step.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#138

Earlier quoted context omitted.

> In the build environment, the current time is set to the epoch which removes that variability. The amount of time per build can vary. Embedded timestamps will all be in January 1970, but even a single second difference means the binaries are no longer bit for bit identical -- and that assumes the embedded timestamp isn't microseconds.

I think you're assuming that the timestamp only starts at the epoch and still advances in real time, which is not necessarily true.

If it didn't advance, that would cause trouble for some build systems. So yes, I'm assuming it does.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#139

I would love to see a discussion from somebody who really likes Nix on why it isn't ready for prime time yet/just play devil's advocate aloud on why it isn't the greatest thing since sliced bread. I feel like I must not be doing anything "serious" enough to need package reproducibility at that high level. I'm aware of things like git checkout/tags, package-lock.json, Cargo.lock, Docker image tags. What is a real worl…

It's the composability that is the killer feature. Reproducibility is just a prerequisite to that.

It's kind of like Haskell. Composable programs is the sell. Purity is a means towards that.

Re: Zero to Nix, an unofficial, opinionated, gentle introduction to Nix

#140
About NixOS, there's something really basic that I cannot seem to grasp. I had already installed many linux distro's with time, after the years I was really found on KDE and ZFS.

I've stumbled upon this tutorial with great interests and yet I can't start to see what is the expected install workflow. Are you expected to write your nix config file booting on the live medium, how could you easily transfer this config file to your install medium.

As much as I understand that targeting the right ZFS dataset and so should not be included in box and I was still happy to find some mention of it in the official doc. I don't understand this mix of an all seeing doc, spanning across many technologies and configurations set and yet what I could call the context is rather absent.

Post reply on HN