News for hackers. Stuff that matters.
Re:My First Impressions of Nix by hamandcheese on Monday June 19, 2023 @03:20AM (#36388241)
Most of the above.

- Nix is a tool for building and installing software.

- Nix is a language for expressing how to build a package. Nix-the-tool reads expressions defined in Nix-the-language to know what to do. At the end of the day, this translates into normal commands that run in a sandboxed build environment.

- Nixpkgs is a monolithic repository of 80000+ packages, defined literally as one giant expression in the Nix language (this works fine because Nix is an extremely lazy language). This also includes lots of helpers and abstractions for building packages that can be handy in your own projects. It is possible to use Nix-the-tool without Nixpkgs, but nobody does.

- NixOS is a Linux distribution built on these foundations. Everything under /etc is built from nix expressions. You can not directly edit these. Mostly NixOS is about building systemd unit files from Nix expressions - viewed through that lens it's not really all that exotic of an OS. NixOS has modules that make it very easy to configure and run lots of software.

Re:My First Impressions of Nix by prox on Monday June 19, 2023 @09:50AM (#36391087)
So does this allow for different boot setups for NixOS? Say “webserver” or “office management” , “media streamer” profiles?
Re:My First Impressions of Nix by SAI_Peregrinus on Monday June 19, 2023 @10:38AM (#36391548)
Yes. E.g. some guy's config with 6 different machines[1]: multiple desktops, laptops, servers, a Raspberry Pi, and a VPS. That's a rather advanced use of Nix for configuration, but definitely shows what it's capable of.

[1] https://github.com/Misterio77/nix-config

Re:My First Impressions of Nix by prox on Monday June 19, 2023 @12:25PM (#36392922)
Wow! Really impressive.
Re:My First Impressions of Nix by mindslight on Monday June 19, 2023 @03:17PM (#36395396)
I wouldn't even say that's so advanced. I've got a similar config (not published, sorry). All built from source, with the resulting binaries pushed to less-trusted hosts. My cloud servers, router, wifi APs, Kodi boxes, etc, all running self-hosted self-built software with config kept in git.

Previously I used to run Debian across my setup (with a homemade configuration templating/distribution tool) but it feels like Nix really bundles up the accidental complexity of most software in a contained way, much more than a traditional distro.

I'll be much happier when Nix gains full reproducibility and functionality like Guix's `challenge`. But even now it feels like one of the closest implementations to the Free Software dream.

Re:My First Impressions of Nix by hamandcheese on Monday June 19, 2023 @01:34PM (#36394038)
I'm not exactly sure what you mean. NixOS doesn't have, like, a profile switcher to let you switch between work mode and play mode on the same PC. At least not out of the box.

But if you mean distinct computers, then that's just three distinct configs. And it's easy to factor out common bits and use it in all three configs, since you configure things using Nix-the-language.

And if you mean all three at the same time on one PC, that's exactly what I do with my home server.

Re:My First Impressions of Nix by ElectricalUnion on Monday June 19, 2023 @03:37PM (#36395609)
> NixOS doesn't have, like, a profile switcher to let you switch between work mode and play mode on the same PC.

I thought that `sudo nixos-rebuild switch` was supposed to do exactly that; swap from whatever "state" your PC is on to the result of the nix expresison on "/etc/nixos/configuration.nix"

Re:My First Impressions of Nix by hamandcheese on Wednesday June 21, 2023 @10:55PM (#36427500)
Yes, that is how you update your system.

But it would be very unusual to constantly switch between two long-lived configs. I don't see why it wouldn't work, though.

Re:My First Impressions of Nix by misterio7 on Monday June 19, 2023 @06:13PM (#36397103)
Yeah! There's specializations[1] to make this even simpler.

[1] https://nixos.wiki/wiki/Specialisation