Commit 78614122 authored by Bjørn Forsman's avatar Bjørn Forsman
Browse files

nixos/borgbackup: fix directory ownership regression

Re-add separate creation of the ~/.config and ~/.cache directories so
that they get correct ownership. Or else they get owned by root.

systemd-tmpfiles also warns about it:

  machine # [    3.022195] systemd-tmpfiles[472]: Detected unsafe path transition /home/user1 (owned by user1) → /home/user1/.cache (owned by root) during canonicalization of home/user1/.cache.
  machine # [    3.024566] systemd-tmpfiles[472]: Detected unsafe path transition /home/user1 (owned by user1) → /home/user1/.config (owned by root) during canonicalization of home/user1/.config.

Fixes: 8d3cf213 ("nixos/borgbackup: replace activationScript via tmpfiles")
parent 9c926d3d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -147,6 +147,9 @@ let
    let
      settings = { inherit (cfg) user group; };
    in lib.nameValuePair "borgbackup-job-${name}" ({
      # Create parent dirs separately, to ensure correct ownership.
      "${config.users.users."${cfg.user}".home}/.config".d = settings;
      "${config.users.users."${cfg.user}".home}/.cache".d = settings;
      "${config.users.users."${cfg.user}".home}/.config/borg".d = settings;
      "${config.users.users."${cfg.user}".home}/.cache/borg".d = settings;
    } // optionalAttrs (isLocalPath cfg.repo && !cfg.removableDevice) {