h: add restic wrapper for easier management

while here backup /home
This commit is contained in:
Aaron Bieber 2022-08-26 20:24:39 -06:00
parent 5371da7e11
commit d8fc0db566
No known key found for this signature in database
3 changed files with 20 additions and 8 deletions

9
bins/restic.nix Normal file
View File

@ -0,0 +1,9 @@
{ pkgs }:
let resticBin = "${pkgs.restic}/bin/restic";
in ''
#!/usr/bin/env sh
export $(cat /run/secrets/restic_env_file)
${resticBin} --password-file /run/secrets/restic_password_file $@
''

14
flake.lock generated
View File

@ -190,11 +190,11 @@
},
"stable": {
"locked": {
"lastModified": 1661427965,
"narHash": "sha256-LJeSDbiebN0/eRt9vyOm+Bxljdsq5ZdalmmTk9Xpp30=",
"lastModified": 1661486448,
"narHash": "sha256-GAt/OkQ/pAPd3p4QuLJU8a/gHPqTFo5P9ziBm/rYJmM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "058de3818577db19d1965c21e2479916a3eaaf95",
"rev": "5545afa395e8c5ff7b11fe8a9e3afcdc597c8583",
"type": "github"
},
"original": {
@ -242,11 +242,11 @@
"stable": "stable_2"
},
"locked": {
"lastModified": 1661487344,
"narHash": "sha256-6gQ2xCYsXa3RmIztnxfOyBFLD7V3cSHjdyuK33KnxTw=",
"lastModified": 1661566075,
"narHash": "sha256-NaL2nzHOO1W4YsU+au4wQLZ/8qtnWq9PfMuwbPcjRJI=",
"ref": "main",
"rev": "ec7e7a9d6e5104443dd1c11613841280c4b463aa",
"revCount": 27,
"rev": "b9c4d1e5109df8b561a83b50ddb98b5191688d22",
"revCount": 28,
"type": "git",
"url": "ssh://xin-secrets-ro/qbit/xin-secrets.git"
},

View File

@ -1,6 +1,8 @@
{ config, pkgs, lib, isUnstable, ... }:
with pkgs;
let
restic = pkgs.writeScriptBin "restic"
(import ../../bins/restic.nix { inherit pkgs; });
gqrss = callPackage ../../pkgs/gqrss.nix { inherit isUnstable; };
icbirc = callPackage ../../pkgs/icbirc.nix { inherit isUnstable; };
mcchunkie = callPackage ../../pkgs/mcchunkie.nix { inherit isUnstable; };
@ -148,7 +150,8 @@ in {
environmentFile = "${config.sops.secrets.restic_env_file.path}";
passwordFile = "${config.sops.secrets.restic_password_file.path}";
paths = [ pgBackupDir "/var/lib/synapse/media_store" "/var/www" ];
paths =
[ pgBackupDir "/var/lib/synapse/media_store" "/var/www" "/home" ];
timerConfig = { OnCalendar = "00:05"; };