about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-02-24 19:12:04 -0800
committerFranck Cuny <franck@fcuny.net>2022-02-24 19:12:04 -0800
commitdaaacea6a2fb93df14ab6bc89175028fcf999360 (patch)
tree3bfba58707fa46e3b9f8bc408003357ef63c39c7
parentgnome: add more gnome settings (diff)
downloadworld-daaacea6a2fb93df14ab6bc89175028fcf999360.tar.gz
backups: initial configuration
Diffstat (limited to '')
-rw-r--r--users/fcuny/cli/backups.nix16
-rw-r--r--users/fcuny/cli/default.nix1
2 files changed, 17 insertions, 0 deletions
diff --git a/users/fcuny/cli/backups.nix b/users/fcuny/cli/backups.nix
index 2c5c05b..7edbc59 100644
--- a/users/fcuny/cli/backups.nix
+++ b/users/fcuny/cli/backups.nix
@@ -4,4 +4,20 @@
   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=rest:http://192.168.6.10:8010/"
+        "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";
+    };
+  };
 }
diff --git a/users/fcuny/cli/default.nix b/users/fcuny/cli/default.nix
index 65f81bd..1f906df 100644
--- a/users/fcuny/cli/default.nix
+++ b/users/fcuny/cli/default.nix
@@ -2,6 +2,7 @@
 
 {
   imports = [
+    ./backups.nix
     ./git.nix
     ./tmux.nix
     ./yt-dlp.nix