NixOS 让我不那么害怕了。
NixOS is making me less afraid

原始链接: https://entropicthoughts.com/nixos-is-making-me-less-afraid

作者在 NixOS 服务器上开始使用 FreshRSS;此前 RSS 订阅只保存在手机上,其中的已读/未读状态很脆弱,且迁移时经常丢失。他们曾想使用服务器端订阅聚合器,但因部署和维护似乎太麻烦而避免。NixOS 使 FreshRSS 的设置(包括备份)只需几行代码加上 nginx 代理配置,并且运行稳定、几乎无需人工干预;损坏的服务器大约 15 分钟就能重建。这种可复现性让尝试新软件变得容易。相比之下,非 NixOS 安装需要很多手动步骤,容器镜像也会随时间漂移。作者不喜欢维护副项目,也发现其他配置/部署工具帮不上忙;NixOS 配置就像可执行、可复现的说明。

用户讨论 NixOS 的声明式、可复现系统配置,以及 LLM 代理(尤其是 Claude Code)如何让其晦涩的语法和摸索过程不再那么令人生畏。许多人称赞回滚、flakes、Home Manager 和一致的跨机器设置;其他人则指出 Nix 学习曲线陡峭、工具复杂以及硬件相关问题。有些人根据需求偏好 Arch、Omarchy、Guix、容器或 Ansible。评论者还讨论供应链信任、社区纷争与分叉,以及 LLM 是否降低了理解底层系统的必要性。总体而言,NixOS 被认为对可复现的开发和系统配置很强大,尤其在 AI 辅助下,但并非放之皆宜。
相关文章

原文

nixos-is-making-me-less-afraid.jpg

Something funny happened a little while ago: I read about FreshRSS, and it sounded nice, so I installed it on a server and started using it. That would not have happened a year ago, but then again, a year ago I didn’t have any NixOS servers.


For the past few years, my rss feeds have lived locally on my phone only. There was a good idea behind that1 I can mostly take time to read when I’m away from my computer anyway., but it never quite worked in practice. For one, many things are easier to read on a larger screen. But it was also brittle to trust a phone app to manage the read/unread status of thousands of articles across a hundred feeds.2 In particular, when I switched to a different phone I could migrate all feeds to it, but the read/unread status was lost along the way. What I really wanted was a server-side feed aggregator. This is software that runs on a server, manages rss feeds, and then I can read the rss feeds either through a web interface, or through client applications. I’ve wanted that for a while, but I’ve never taken the step, because it would be yet another side project to maintain the deployment of.

But now, with some NixOS experience, adding a working FreshRSS configuration (including backups) took 9 lines of Nix code3 Plus a dozen more lines for the nginx reverse proxy configuration. It got a little complicated because I wanted to proxy_pass from a specific location block which required rewriting cookie paths. But that’s a me problem, not a NixOS problem.. That installation has just hands-off worked for the past few months. If or when that server breaks, I can spin up a new one running the exact same configuration, probably in something like 15 minutes. When we can do something like that, there is literally no reason to not just try the new software.

Contrast this against how FreshRSS is installed outside of NixOS. Then we’d

  1. download and extract an archive to the right location;
  2. configure permissions according to instructions;
  3. install nginx and php-fpm with necessary extra dependencies to the server;
  4. configure php-fpm pools and make nginx pass requests through to php-fpm;
  5. set up Let’s Encrypt certificates;
  6. set up backups; and
  7. hopefully remember how to do all the above if something breaks and we need to reinstall FreshRSS on a new or upgraded server later.

Of course, the FreshRSS project provides a container image which would shorten the process a little bit. It purports to set up Apache with mod_php and configure them the right way. Then we’d only need to configure backups, create a systemd service that runs the container, and manage nginx as a tls terminating reverse proxy in front of that, because the container image reasonably does not come with tls support. This is still stuff to remember, and there’s also no guarantee the same thing works six months down the line when reinstalling, unless we wrote down which exact container image we downloaded.4 It does not help to build the container image from source, because two builds from the same Dockerfile separated by time can result in rather different container images.


I have mentioned before how much I dislike maintaining side projects. That includes my own code, but also self-hosted services developed by someone else. I’m okay with a few minutes of maintenance here and there, but having to schedule hours of uninterrupted work to upgrade something, or spending any amount of time at all on emergency maintenance, really kills my desire to work with computers.

You’d think someone of my disposition would be deep into configuration management, container orchestration, or both, but no. I have made honest attempts with CFEngine, Ansible, podman, and k3s but none of them improved my installation/configuration/deployment experience significantly over (a) carefully writing things down, and sometimes (b) turning those careful notes into a shell script performing a sequence of ssh commands.5 Yes, this is essentially reinventing Ansible – but less brittle. It won’t break the next time someone glances sideways at pip. The drawback of the shell script is that it often ends up relying on assumptions that become invalid with time, or when it is used in a different environment. A NixOS configuration reads a lot like the careful instructions to myself, except they’re executable and they produce the same result every time.

联系我们 contact @ memedata.com