backup shenanigan
This commit is contained in:
parent
184e8b9274
commit
96d8987296
18
flake.lock
18
flake.lock
|
@ -60,11 +60,11 @@
|
||||||
"utils": "utils_2"
|
"utils": "utils_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1658751516,
|
"lastModified": 1659484873,
|
||||||
"narHash": "sha256-Y/3dHoTjbvYBtWd+TTBQJUIgDPO9d+Gqt05C5dyR7E4=",
|
"narHash": "sha256-6VoPiGyDdjBHOJ3IpS24lY1lrDiOHeuEefOFI0qz3WE=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "dbed4c794d20d51027fc1107f063ec5be027dafc",
|
"rev": "d8d9ff0b2df77defa10375c6665b51f0251c34d6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -134,11 +134,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1658346836,
|
"lastModified": 1659375853,
|
||||||
"narHash": "sha256-c9BZZbi0tqCQ4j6CMVDlsut3Q3ET1Fezf+qIslCfkhs=",
|
"narHash": "sha256-aiMfO6U1w1u93vB+5qCHCQDZKgpJ7qs4GJOQvI3CN/4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a1fe662eb26ffc2a036b37c4670392ade632c413",
|
"rev": "511f6a5c3248f9019a41e70c1891484de2bc906c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -150,11 +150,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1658737577,
|
"lastModified": 1659305579,
|
||||||
"narHash": "sha256-xosJ5nJT9HX+b6UWsSX6R+ap4AdZOCrl/r+IKFp2ASQ=",
|
"narHash": "sha256-SFeQTmh7hc9Y2fSkooHaoS8mDfPa04sfmUCtQ8MA6Pg=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5a0e0d73b944157328d54c4ded1cf2f0146a86a5",
|
"rev": "5857574d45925585baffde730369414319228a84",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
1
home/apps/rclone.nix
Normal file
1
home/apps/rclone.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ config, pkgs, ... }: { home.packages = with pkgs; [ rclone ]; }
|
1
home/apps/restic.nix
Normal file
1
home/apps/restic.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ config, pkgs, ... }: { home.packages = with pkgs; [ restic ]; }
|
|
@ -1,4 +1,4 @@
|
||||||
_:
|
{ lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
|
|
||||||
mail_config = (import ./mailserver/config.nix { });
|
mail_config = (import ./mailserver/config.nix { });
|
||||||
|
@ -18,21 +18,46 @@ let
|
||||||
OnBootSec = "1m";
|
OnBootSec = "1m";
|
||||||
OnCalendar = "daily";
|
OnCalendar = "daily";
|
||||||
};
|
};
|
||||||
in {
|
repos = {
|
||||||
services.restic.backups.hetzner-vm = {
|
Chaos-Backups-HetznerVM = {
|
||||||
user = backupUser;
|
repository = "b2:Chaos-Backups:HetznerVM";
|
||||||
paths = backupPaths;
|
passwordFile = "/secrets/restic-Chaos-Backups-HetznerVM-password";
|
||||||
inherit timerConfig;
|
environmentFile = "/secrets/restic-Chaos-Backups-HetznerVM-env";
|
||||||
repository = "b2:Backups-HetznerVM:/";
|
|
||||||
passwordFile = "/secrets/restic-password";
|
|
||||||
environmentFile = "/secrets/restic-env";
|
|
||||||
};
|
};
|
||||||
services.restic.backups.cassie-hetzner-vm = {
|
Cassie-Backups-HetznerVM = {
|
||||||
user = backupUser;
|
|
||||||
paths = backupPaths;
|
|
||||||
inherit timerConfig;
|
|
||||||
repository = "b2:Cryptidz-Backup:HetznerVM";
|
repository = "b2:Cryptidz-Backup:HetznerVM";
|
||||||
passwordFile = "/secrets/restic-password-cassie";
|
passwordFile = "/secrets/restic-Cassie-Backups-HetznerVM-password";
|
||||||
environmentFile = "/secrets/restic-env-cassie";
|
environmentFile = "/secrets/restic-Cassie-Backups-HetznerVM-env";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
restic_commands = lib.mapAttrsToList (repoName: repoInfo: (
|
||||||
|
# nya
|
||||||
|
pkgs.writeShellScriptBin "restic-${repoName}" ''
|
||||||
|
env \
|
||||||
|
$(cat ${repoInfo.environmentFile}) \
|
||||||
|
RESTIC_PASSWORD_FILE=${repoInfo.passwordFile} \
|
||||||
|
RESTIC_REPOSITORY=${repoInfo.repository} \
|
||||||
|
${pkgs.restic}/bin/restic $@
|
||||||
|
''
|
||||||
|
)) repos;
|
||||||
|
in {
|
||||||
|
environment.systemPackages = restic_commands;
|
||||||
|
|
||||||
|
services.restic.backups.hetzner-vm = lib.mkMerge [
|
||||||
|
{
|
||||||
|
user = backupUser;
|
||||||
|
paths = backupPaths;
|
||||||
|
inherit timerConfig;
|
||||||
|
}
|
||||||
|
repos.Chaos-Backups-HetznerVM
|
||||||
|
];
|
||||||
|
services.restic.backups.cassie-hetzner-vm = lib.mkMerge [
|
||||||
|
{
|
||||||
|
user = backupUser;
|
||||||
|
paths = backupPaths;
|
||||||
|
inherit timerConfig;
|
||||||
|
}
|
||||||
|
repos.Cassie-Backups-HetznerVM
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,9 @@ in {
|
||||||
home.apps.mullvad
|
home.apps.mullvad
|
||||||
home.apps.aria2
|
home.apps.aria2
|
||||||
home.apps.aegisub
|
home.apps.aegisub
|
||||||
|
home.apps.rclone
|
||||||
|
home.apps.restic
|
||||||
|
|
||||||
|
|
||||||
home.programming.editors.vscode
|
home.programming.editors.vscode
|
||||||
home.programming.languages.go
|
home.programming.languages.go
|
||||||
|
|
Loading…
Reference in a new issue