|
|
|
|
|
by evil-olive
1848 days ago
|
|
I run several personal NixOS servers. it's definitely doable without custom expressions (I can't remember the last time I had to write one). lots of services defined in the NixOS options will have an "escape hatch" option named something like `extraConfig`. this usually lets you append verbose text to a complex config file, like in the case of Postfix where the options couldn't conceivably cover everything. you can also always just write a static file to /etc if you want or need to: environment.etc.foo-config = {
target = "foo.conf";
text = ''
enable_spline_reticulator = true
'';
};
as well as running one-off systemd services declaratively: systemd.services.foo = {
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = ''
${pkgs.foo}/bin/food \
--config /etc/foo.conf
'';
User = "foo";
Restart = "on-failure";
};
};
(both of those examples are copied more or less straight from my daily driver NixOS 20.09 laptop before I made the details generic)another useful escape hatch is that you can run Docker/Podman containers declaratively. I have some things I want the flexibility to upgrade on a different cadence than NixOS itself (such as my family's "production" Jellyfin server) that I just run as standalone Docker containers with volume mounts for their data. |
|