Loading
nixos/systemd-tmpfiles: add initrd support
This adds support for declaring tmpfiles rules exclusively for the systemd initrd. Configuration is possible through the new option `boot.initrd.systemd.tmpfiles.settings` that shares the same interface as `systemd.tmpfiles.settings`. I did intentionally not replicate the `rules` interface here, given that the settings attribute set is more versatile than the list of strings used for `rules`. This should also make it unnecessary to implement the workaround from 1a68e21d again. A self-contained `tmpfiles.d` directory is generated from the new initrd settings and it is added to the initrd as a content path at `/etc/tmpfiles.d`. The stage-1 `systemd-tmpfiles-setup.service` is now altered to no longer operate under the `/sysroot` prefix, because the `/sysroot` hierarchy cannot be expected to be available when the default upstream service is started. To handle files under `/sysroot` a slightly altered version of the upstream default service is introduced. This new unit `systemd-tmpfiles-setup-sysroot.service` operates only under the `/sysroot` prefix and it is ordered between `initrd-fs.target` and the nixos activation. Config related to tmpfiles was moved from initrd.nix to tmpfiles.nix.