[Solved] Add /var/run directory?

Some services need some place to store (temporary) files, e.g. WebDAV (on lighttpd) needs a lock-file. Usually, /var/run/ is used for these cases.

BUT: How can I tell NixOS to create a directory (with owner/group/permissions) under /var/run at each boot? Or should a different directory or a different way be used?

Ok, I’ve found out: The best way is probably to use systemd.tmpfiles:

systemd.tmpfiles.rules = [ "d /run/lighttpd 0750 lighttpd lighttpd -" ];

See also:

This PR might be relevant to you too: https://github.com/NixOS/nixpkgs/pull/51918

1 Like