Which makes it nice to distribute a tool for NixOS so that it can lean into systemd instead of as some bolted-on afterthought.
Makes me wonder what you'd do if you were distributing a lifecycle-heavy tool for Linux users in general since systemd isn't ubiquitous.
I use a systemd timer to run a monthly scrub for my btrfs pool. Kinda cool how you can do increasingly useful things like skip the next scheduled event if the user initiates a scrub, do or don't accumulate tasks if you have a monthly task but the machine was offline for 6 months -- or fold them into a single task, etc.
The problem I have found is that nixos doesn't seem to pickup and run systemd timers and services placed into the ~/.config/systems/user folder and additionally things like WantedBy=default.target have no effect.
So after I restart all my services manually on reboot I agree, systems timers are cool.
a) It is way nicer and you get decent validation at build time
b) I personally don’t see how I would ever move to another distro :)
c) A LLM can port units over if the need arises; it’s a light abstraction around systemd syntax
systemd.services.sync-recyclarr = {
serviceConfig.Type = "oneshot";
path = [ pkgs.podman ];
script = ''
podman exec -it recyclarr recyclarr sync radarr
podman exec -it recyclarr recyclarr sync sonarr
'';
};
systemd.timers.sync-recyclarr = {
timerConfig = {
OnCalendar = "daily";
Persistent = true;
Unit = "sync-recyclarr.service";
};
partOf = [ "sync-recyclarr.service" ];
requires = [ "podman-recyclarr.service" ];
wantedBy = [ "timers.target" ];
};Btw this is my repo for the backup automation: https://github.com/gchamon/borg-automated-backups
jjgreen•3h ago
WesolyKubeczek•52m ago
Could have been YAML.
Could have been XML.
silvestrov•51m ago
It would also make it much simpler to make good GUI editors for the files instead of the Notepad approach most unix config files take.
Juliate•49m ago
WesolyKubeczek•41m ago
XML is that wonderful format that gave us vulnerabilities like death by million laughs, up to a certain moment, you could MitM DTDs, and a whole slew of everything-XML stuff back when XML was like AI is today, none of which I miss today.
Oh, and remember times when programmers would argue whether argument order in XML files should be significant or not?
But XML books with their idealized XML future description did give me the same warm fuzzies as some intricate clockwork mechanism to a Victorian geek.
pwdisswordfishq•7m ago
https://www.freedesktop.org/software/systemd/man/latest/syst...
jjgreen•46m ago
WesolyKubeczek•40m ago
whateveracct•48m ago
zamadatix•45m ago
jjgreen•37m ago
yjftsjthsd-h•13m ago
ramon156•6m ago
mrweasel•33m ago
Over all I think Systemd get way to much criticism. You don't have to use all the parts, but if you care to go through the documentation you'll find interesting features such as journald log-shipping and systemd-machined which can manage containers and VMs.
SEJeff•23m ago
If I never recall hacking in ulimit calls in the top of buggy shell scripts for crappy old services that done respect pam_limits it won’t be soon enough.