nixos/restic-rest-server: Autocreate empty .htpasswd if needed for service boot

When `privateRepos = true`, the service will not start if the `.htpasswd` does not exist.
Use `systemd-tmpfiles` to autocreate an (empty) file to ensure the service can boot
before actual `htpasswd` contents are registered.

This is safe as restic-rest-server will deny all entry if the file is empty.
main
Aneesh Agrawal 2 years ago
parent 4bc4c7f1a0
commit 8729e8e261
  1. 4
      nixos/modules/services/backup/restic-rest-server.nix

@ -95,6 +95,10 @@ in
};
};
systemd.tmpfiles.rules = mkIf cfg.privateRepos [
"f ${cfg.dataDir}/.htpasswd 0700 restic restic -"
];
users.users.restic = {
group = "restic";
home = cfg.dataDir;

Loading…
Cancel
Save