Hacker News new | ask | show | jobs
by cfcosta 1035 days ago
Not OP, but here's my take: I have two machines, one with NixOS, one with Mac. I use the same configuration on both. Keeping both machines in sync is a matter of two commands, adding a new machine is also a matter of two commands.

I have tried multiple orchestration options before, but they always fail in some way, ansible for example always work until I have to run something from scratch, then it fails miserably because of something that changed after the 20th time I've ran the script. On Nix, that's not even a consideration.

2 comments

What are the two commands for further reading? Not familiar with Nix.
(Not OP) cp to copy the /etc/nixos/configuration.nix file, and nixos-rebuild to build the system defined in the file on the new machine.
Or if you're sharing configuration, it's most likely a "git pull" rather than "cp".
Yes, to be specific it's a git clone and a command to apply the flake.
If you're using a flake, can't you apply itfrom git in a single command?
Actually, you can! I always want to clone it either way, so I just do it.
How do you configure and install low level hardware drivers? Aren't these different on both systems? And wouldn't proprietary drivers rely on hardcoded versions of libc, for example, causing a dependency hell?
> wouldn't proprietary drivers rely on hardcoded versions of libc, for example, causing a dependency hell?

You can have multiple copies of glibc on NixOS and it's fine as long as you don't need two different versions of it in the same process. Have you run into this on NixOS?

This is handled by having multiple config files. System specfic stuff goes into a dedicated file which wouldn't be shared.
And proprietary drivers?
I only use one, which is nvidia. It's already a nixos option, so I just set them on my configuration file.

Three options to be exact:

hardware.nvidia.modesetting.enable = true; services.xserver.videoDrivers = [ "nvidia" ]; hardware.opengl = { enable = true; driSupport = true; driSupport32Bit = true; };

First enables nvidia modesetting, second enables the driver, and the third enables opengl, with a special flag to also enable it for 32bit stuff (like old games on steam).