Lots of background information, TLDR at the bottom
I'm using NixOS, and in the pursuit of making my system declarative, I've linked ~/.config/monitors.xml
to a file I keep in my configuration, like this:
systemd.tmpfiles.rules = [ "L /home/thomas/.config/monitors.xml - - - - ${pkgs.writeText "thomas_monitors.xml" "${builtins.readFile ./monitors.xml}"}" ];
This attribute adds a tmpfiles.d
rule to link /home/thomas/.config/monitors.xml
to a file stored in the Nix store containing the contents of <my nixos configuration directory>/monitors.xml
.
However, while looking through my .config
directory, I noticed that monitors.xml
was a normal file, not a link.
The systemd-tmpfiles-setup.service
and systemd-tmpfiles-clean.service
services are ran on every boot according to systemctl status
, so I know it must be trying to make the symlink, even though it's not being made.
When I diff ~/.config/monitors.xml
with the monitors.xml
in my configuration, there is no difference, so my best guess is that Gnome somehow notices when the link is made and replaces it with the file it's being linked to?
Alternatively, maybe systemd-tmpfiles
isn't making the link, and the monitors.xml
currently there is generated by Gnome and just happens to be the same as what I've defined in my configuration? If that's the case, is there a way I can force systemd-tmpfiles
to make the link?
I also have two other tmpfiles.d
rules for monitors.xml
, one to link it to /run/gdm/.config/monitors.xml
and another to link it to /root/.config/monitors.xml
, which are both linking the file properly. The only one that's not working is ~/.config
.
Also, /home/thomas
is my home directory, so /home/thomas/.config
is ~/.config
. I know that's not the issue.
TL/DR:
Why is ~/.config/monitors.xml
not symlinked to the file I want it to be? Is Gnome removing the link? Or, if systemd-tmpfiles
isn't making the link for some reason, how do I force it to?