Systemd.tmpfiles does not create files and directories

Part of my configuration.nix:

    systemd.tmpfiles.rules = [
        "d /var/log/timers - ${variables.username} ${variables.username} - -"
        "f /var/log/timers/archive - ${variables.username} ${variables.username} - -"
        "f /var/log/timers/backup - ${variables.username} ${variables.username} - -"
    ];

directory /var/log/timers doesn’t exist, the files that should be init don’t either

Not sure entirely what the problem is, but you can get some more information on what’s going wrong with these steps:

systemctl status systemd-tmpfiles-clean

This should trigger on boot and around every day-ish. You can also check it shows up in systemctl list-timers --all.

To show all current rules, do: systemd-tmpfiles --tldr.

If everything above looks fine, the following step should help you see if anything is going wrong.

SYSTEMD_LOG_LEVEL=debug systemd-tmpfiles --create

This will show all operations systemd-tmpfiles is trying. You can replace --create with --remove or --clean.

1 Like

Thank you, the last command gave me a log that helped me identify the problem. I didn’t have a group named the same as my user. Used users.users.name.group to define it.

By the way, did you by chance develop Minecraft modes? I think I used your block outlines mod :blush:

1 Like

Glad that you got it to work! (I’ve spent way to much time trying to debug tmpfile issues lol).

And yes, that’s me, the chat (+ outline) modder :stuck_out_tongue: (tho haven’t been doing too much recently).

1 Like