Live data from Hacker News

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

zero-to-nix.com

31–40 of 227 posts

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

#32
post #11

Earlier quoted context omitted.

I'd also suggest that, once you _do_ feel comfortable enough to step foot into NixOS territory, that you start off by version-controlling your configuration. It doesn't necessarily have to be public, but I've found it very helpful in the past when I've had to debug various issues due to misconfiguration by me.

Do you symlink your config repo to /etc/nixos or something else? So far, I've just been rsyncing my config repo folder after I modify it.

You can actually put your NixOS config anywhere. Assuming you're not using flakes, `nixos-rebuild` finds the config through NIX_PATH:

grahamc@scruffy:~/ > echo $NIX_PATH

nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels

you can change the `nixos-config` value to point to somewhere else, or call it like this:`nixos-rebuild -I nixos-config=./configuration.nix`

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

#33
post #11

Earlier quoted context omitted.

I'd also suggest that, once you _do_ feel comfortable enough to step foot into NixOS territory, that you start off by version-controlling your configuration. It doesn't necessarily have to be public, but I've found it very helpful in the past when I've had to debug various issues due to misconfiguration by me.

Do you symlink your config repo to /etc/nixos or something else? So far, I've just been rsyncing my config repo folder after I modify it.

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

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

#34
post #11

Earlier quoted context omitted.

I'd also suggest that, once you _do_ feel comfortable enough to step foot into NixOS territory, that you start off by version-controlling your configuration. It doesn't necessarily have to be public, but I've found it very helpful in the past when I've had to debug various issues due to misconfiguration by me.

Do you symlink your config repo to /etc/nixos or something else? So far, I've just been rsyncing my config repo folder after I modify it.

Yeah, I symlink `/etc/nixos/configuration.nix` to my git repo. (I do keep a `hardware-configuration.nix` which isn't version controlled. I probably should add version-control at some point but for now it is simple enough to copy around and maybe make some minor tweaks).

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

#35
UX feedback: for an opinionated guide targeted at newbies, I think the 'concepts' page should be much more of a guided introduction. I click on it and have a big basket of things in _alphabetical order_. I think it should be a top-to-bottom ordering of how a user should read them if encountering for the first time. Maybe have a separate glossary page if thats what you are going for with the alphabetical order.

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

#36

UX feedback: for an opinionated guide targeted at newbies, I think the 'concepts' page should be much more of a guided introduction. I click on it and have a big basket of things in _alphabetical order_. I think it should be a top-to-bottom ordering of how a user should read them if encountering for the first time. Maybe have a separate glossary page if thats what you are going for with the alphabetical order.

Thanks for this. Our goal is to keep people on the "rails" of the quick start, with the Concepts as a way to fill out knowledge people are curious about. I wonder if we should downplay the concept docs in service of that? Or put more CTA's to go take the quickstart?

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

#37
post #13
post #7

> Zero to Nix is opinionated because it advocates learning and using flakes and treating channels as deprecated. I think I need a “Channels to Flakes”. I have an existing system configuration that seems to work fine without flakes. What am I missing out on?

In your specific case - a _channel_ versus a flake _input_ - consider how you're tracking your system configuration. If you have an /etc/nixos/configuration.nix, then your system can be reconstituted _only_ if you have that configuration.nix in addition to the revision that your channel is currently on. Compare this with a system defined in a flake's `nixosConfiguration`, which accepts its version of nixpkgs from the…

Is this more deterministic than pointing Nixpkgs at a specific commit/tarball in the configuration? I have often done this to make reproducible builds in other Nix settings and it has worked well.

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

#38
post #11

Earlier quoted context omitted.

I'd also suggest that, once you _do_ feel comfortable enough to step foot into NixOS territory, that you start off by version-controlling your configuration. It doesn't necessarily have to be public, but I've found it very helpful in the past when I've had to debug various issues due to misconfiguration by me.

Do you symlink your config repo to /etc/nixos or something else? So far, I've just been rsyncing my config repo folder after I modify it.

I use an update script that overrides that location to $(pwd), and also uses nvd to print a package diff for the update. Among a few other niceties. With flakes, that's a regular nixos-rebuild flag; otherwise it's an envvar.

/etc/nixos is just the default, there's a number of ways to set your own path. One of the simplest might be to put "import /home/wherever" as the sole contents of configuration.nix.

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

#39
post #37
post #13

Earlier quoted context omitted.

In your specific case - a _channel_ versus a flake _input_ - consider how you're tracking your system configuration. If you have an /etc/nixos/configuration.nix, then your system can be reconstituted _only_ if you have that configuration.nix in addition to the revision that your channel is currently on. Compare this with a system defined in a flake's `nixosConfiguration`, which accepts its version of nixpkgs from the…

Is this more deterministic than pointing Nixpkgs at a specific commit/tarball in the configuration? I have often done this to make reproducible builds in other Nix settings and it has worked well.

It is: using Flakes you're thrusted into a more pure evaluation mode by default, and it creates a (standard) artifact of the revision you're on: the flake.lock.

You can get almost all the benefits Flakes brings without Flakes using alternatives like niv.

Post reply on HN