this post was submitted on 02 Feb 2024
128 points (93.8% liked)

Selfhosted

40201 readers
508 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Edit: wow, this is a never ending comment section!

you are viewing a single comment's thread
view the rest of the comments
[–] chris@lem.cochrun.xyz 33 points 9 months ago (3 children)
[–] Voroxpete@sh.itjust.works 11 points 9 months ago (1 children)

I just heard of NixOS for the first time because of this thread. Looked up some videos on it, and my jaw hit the fucking floor.

[–] xamino@feddit.de 4 points 9 months ago

I really liked https://www.youtube.com/watch?v=AGVXJ-TIv3Y - step by step, with examples and great explanations. Warning: it's long, but I watched it in one session.

[–] bzLem0n@lemmy.ca 8 points 9 months ago

Same here. I came for the integrated ZFS support and stayed for the declarative config.

[–] umbrella@lemmy.ml 6 points 9 months ago (3 children)

how is nix better than debian for servers?

[–] 2xsaiko@discuss.tchncs.de 21 points 9 months ago

Declarative configuration of services and the rest of the entire system, and everything that brings with it.

  • Want to test some new service, or make changes to an existing one, but don't know if you want to keep it? Sure, just temporarily switch to the new configuration, you can always switch back to the old one and everything will be back as it was.
  • Have multiple servers and want to share configuration between them? Absolutely, just import the same file from both. I have a git repo storing configurations for 10 machines and a huge part of it is shared configuration.
  • Want to use one service's endpoint (such as a socket path) in another? Sure, just use the socket path configuration option for the first service in the configuration for the second, such as here. This works since everything is a single tree of options which all the service configuration files are then generated from, so interpolate stuff as you wish.
  • Checks for configuration correctness during build of the system (NixOS options are type checked during evaluation, and then during the actual system build there's more checks, like nginx config has to succeed nginx -t, otherwise the system build fails and you can't switch to it)
  • Want to spin up a VM to test changes before putting it on the actual target? There's a builtin command (nixos-rebuild build-vm) that makes a script that starts a QEMU VM with your configuration running in it. It's as fast as building the real system, so a couple seconds if you're making small changes.
  • Setting up services is also often as easy as putting services.foo.enable = true; in your configuration. And, if you remove that line, the service is gone, so you're never left with "the random package or file you installed once to test something and has been forgotten about". That's the biggest thing it has over any kind of imperative solution IMO.

I feel like even if I want to distro hop again and end up putting something else on my desktop, NixOS is going to stay on my servers indefinitely. It's pretty much a perfect fit for servers.

[–] baduhai@sopuli.xyz 6 points 9 months ago

It isn't, it's just different. I use NixOS because of stupid easy rollbacks, which is great for experimenting in production, and its declarative nature, which is great in a server setting.

[–] chris@lem.cochrun.xyz 2 points 9 months ago* (last edited 9 months ago)

Everything is declared, from packages to configuration, and then I can put it in a git repo locked to versions. If something breaks on updates, you have free rollbacks. Which means you can't screw up too much. Also it has almost all the software.