pull down to refresh
25 sats \ 5 replies \ @nym 20 Apr \ on: wtf, nix is magic NixOS
Thank you for the tip. I’m just getting familiar with Nix. What are your favorite features, and what is still giving you trouble?
What are your favorite features
The declarative configuration via configuration.nix and applying it with
nixos-rebuild
.1For example, knowing which packages are installed and how the firewall is configured at all times gives me peace. I also intend to check this file into version control so I will never lose it. I can simply copy this file into a new NixOS install and run
nixos-rebuild switch
and then I should have everything up and running again iiuc.Additionally, having to configure the system in this declarative way seems to be well-enforced: I literally can't change the system configuration myself since the system is mounted read-only.
what is still giving you trouble?
Imperative vs declarative user management. Not sure yet which one I should use. Imperative with manual password configuration via
passwd
seems to be recommended but feels weird to not go full declarative and set hashedPassword
inside configuration.nix.But I probably don't want to expose my hashed passwords or I can't share my configuration.nix publicly in a git repository.
Footnotes
-
I guess that's the obvious killer feature of NixOS. ↩
reply
I absolutely love NixOS! I use it as my main OS both on my desktop and my VPS.
What is truly magical is the ability to configure even projects with pinned dependencies via
shell.nix
and if you have NixOS on a server you can also write and import a default.nix
to set up a reproducible deploy on any NixOS machine.Here a couple of tips I learned myself:
-
If you want you can also use the
passwordFile
rule to store the encrypted passwords outside of your config code. -
It's better to avoid
nix-env
entirely as it's NOT reproducible, it's better to usenix-shell
for occasional use or add them to the environment directly. -
Even cooler, you can write scripts with a special shebang that let you automatically load various languages or packages.More info about that here: https://nixos.wiki/wiki/Nix-shell_shebang
reply
reply