setupSystemdUnits: use /nix/var/nix/profiles/default/lib/systemd/system as fallback

The previous commit stopped systemd from looking for system units in
/etc/systemd-mutable/system, which was a Dysnomia-specific path.

While this script doesn't seem to be used anywhere inside nixpkgs (also
not in the gone-since #110799 Dysnomia), its fallback mode (when
/etc/systemd/system is read-only) did write units to that
Dysnomia-specific path, which systemd now doesn't look at anymore.

It might be up for another debate on whether systems with read-only
/etc/systemd/system should probably just use /run/systemd/system, and
not some NixOS-specific paths, as such conditions can happen on other
distros too, but let's pick the other NixOS-specific path
/nix/var/nix/profiles/default/lib/systemd/system for now, which is
probably better than a path that surely is never looked at.
This commit is contained in:
Florian Klink 2021-02-05 00:06:17 +01:00
parent e373b423c7
commit 2417421615

View file

@ -58,7 +58,7 @@
unitDir=/etc/systemd/system
if [ ! -w "$unitDir" ]; then
unitDir=/etc/systemd-mutable/system
unitDir=/nix/var/nix/profiles/default/lib/systemd/system
mkdir -p "$unitDir"
fi
declare -a unitsToStop unitsToStart