Closed dpk closed 3 months ago
- I almost certainly want to the OS-managed systemd to run these services, not the version in Nix
A systemd service simply existing in a package will do absolutely nothing.
2. on systems such as Void (currently my preferred Linux distribution) which eschew systemd for more lightweight solutions making it more practical to use them in containers etc., I don’t want systemd at all.
Similarly, systemd
existing in the nix store as a dependency will not change your init system.
See also #98094/#99240.
In my experience, adding systemd
is often necessary to get libudev
. (Indeed udev
is an alias for systemdMinimal
.)
on systems that already manage services using their own version of systemd
This assumption is wrong. Please familiarize yourself how systemd works and loads units. The packages most likely draws in a shared object like libudev (see comment above) or sd_notify functionality. Some packages have flags to compile the package without that library (or systemd at all) but the functionality is then missing and we cannot compile against the host library as that would be impure. Generally not every package will have such an option because our first priority is to compile packages for NixOS and only then for other OSs. Feel free to create PRs for more options to disable systemd as a dependency if that is something supported by upstream but providing this is not a top priority and those packages are currently not cached.
When installing packages which are usually long-running system services on Linux (I have tried
postgres_16
,mariadb
,apacheHttpd
,redict
,postfix
), very often they bring alongsystemd
orsystemd-minimal
as dependencies or transitive dependencies. I assume nobody notices this on NixOS because it’s already part of the base system managed by NixOS and thus already installed.On non-NixOS Linux platforms this is annoying for one or maybe two reasons:
The mentioned packages do not intrinsically depend on
systemd
to work; on Darwin they obviously have nosystemd
dependency. There may be some other reason they depend onsystemd
on Linux, but this seems very doubtful to me personally, considering they install fine throughxbps
on Void which doesn’t havesystemd
.This is not consistent across all ‘service’ type packages. Packages which can be long-running services but don’t drag in
systemd
orsystemd-minimal
on Linux includelighttpd
,caddy
,cockroachdb-bin
,opensearch
, … (this is not a scientific survey, I just tried some packages I thought of).