From 03cbf084e0f6788d31c4e9504e80a3326ee00358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 5 Mar 2024 09:27:58 +0100 Subject: [PATCH] Add backup home service and timer --- home/default.nix | 1 + home/services/backup-home.nix | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 home/services/backup-home.nix diff --git a/home/default.nix b/home/default.nix index 2565d6e..424fac0 100644 --- a/home/default.nix +++ b/home/default.nix @@ -18,6 +18,7 @@ ./packages ./hyprland ./ssh + ./services/backup-home.nix ]; firefox.enable = true; tmux.enable = true; diff --git a/home/services/backup-home.nix b/home/services/backup-home.nix new file mode 100644 index 0000000..7a9a173 --- /dev/null +++ b/home/services/backup-home.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: { + systemd.user.services.backup-home = { + Unit = { + Description = "Backup home directory"; + After = [ "network.target" ]; + }; + Service = { + Type = "oneshot"; + ExecStart = "/home/torjus/.local/bin/backup-home"; + }; + }; + systemd.user.timers.backup-home = { + Unit = { + Description = "Backup home directory"; + After = [ "network.target" ]; + }; + Timer = { + OnCalendar = "*-*-* 00:00:00"; + Persistent = true; + }; + Install = { + WantedBy = [ "timers.target" ]; + }; + }; +}