about summary refs log tree commit diff
path: root/users/fcuny/cli/backups.nix
blob: 57bd8b777f92654993d4e46baeea8247c1b8987e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ pkgs, ... }:

{
  home.packages = with pkgs; [ restic ];

  systemd.user.services.backup = {
    Unit = {
      Description = "backup my home directory";
      Documentation = "man:resitc(1)";
    };
    Service = {
      Type = "oneshot";
      Environment = [
        "RESTIC_REPOSITORY=sftp:fcuny@192.168.0.107:/data/slow/backups/users/fcuny"
        ''RESTIC_PASSWORD_COMMAND="pass backup/restic@%H"''
      ];
      ExecStartPre =
        "${pkgs.systemd}/lib/systemd/systemd-networkd-wait-online --interface=wg0";
      ExecStart =
        "${pkgs.restic}/bin/restic --tag=home-nixos --exclude=%h/media --exclude=%C --exclude=%E backup %h";
    };
  };
}