backup: backup to external hard drive

This commit is contained in:
Ingolf Wagner 2020-01-17 22:35:43 +13:00
parent 46b72219b9
commit 004820f508
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
5 changed files with 31 additions and 10 deletions

View file

@ -89,6 +89,27 @@ in {
where = "/media";
}];
})
(let backupUUID = "f7fa1c0e-ac9f-4955-b4bd-644c1ddb0d89";
in {
fileSystems."/backup" = {
device = "/dev/disk/by-uuid/${backupUUID}";
fsType = "ext4";
options = [
"nofail"
"noauto"
#"x-systemd.device-timeout=1ms"
];
};
systemd.mounts = [{
enable = true;
options = "nofail,noauto";
type = "ext4";
wantedBy = [ "multi-user.target" ];
what = "/dev/disk/by-uuid/${backupUUID}";
where = "/backup";
}];
})
];
}

View file

@ -1,8 +1,8 @@
{ config, ... }: {
backup.services.restic = {
"on-porani".enable = false;
"on-workhorse".enable = true;
"on-porani.private".enable = false;
"on-workhorse.private".enable = true;
};
}

View file

@ -8,7 +8,7 @@
};
config = let
servers = [ "porani" "workhorse" "workout" ];
servers = [ "porani.private" "workhorse.private" "workout.private" ];
dirs = config.backup.all.restic.dirs;
setup = server: {
@ -44,7 +44,7 @@
in {
backup.services.restic = lib.zipAttrsWith (name: vals: lib.head vals)
(map (server: { "on-${server}" = setup "${server}.private"; }) servers);
(map (server: { "on-${server}" = setup server; }) servers);
environment.etc."info/restic-${hostname}.json" = {
enable = true;

View file

@ -1,9 +1,9 @@
{
backup.services.restic = {
"on-porani".enable = true;
"on-workhorse".enable = true;
"on-workout".enable = true;
"on-porani.private".enable = true;
"on-workhorse.private".enable = true;
"on-workout.private".enable = true;
};
backup.all.restic.dirs = [ "/home/palo/.password-store" ];

View file

@ -1,9 +1,9 @@
{ lib, ... }: {
backup.services.restic = {
"on-porani".enable = lib.mkDefault true;
"on-workhorse".enable = lib.mkDefault true;
"on-workout".enable = lib.mkDefault true;
"on-porani.private".enable = lib.mkDefault true;
"on-workhorse.private".enable = lib.mkDefault true;
"on-workout.private".enable = lib.mkDefault true;
};
}