backup: backup to external hard drive
This commit is contained in:
parent
46b72219b9
commit
004820f508
5 changed files with 31 additions and 10 deletions
|
@ -89,6 +89,27 @@ in {
|
||||||
where = "/media";
|
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";
|
||||||
|
}];
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ config, ... }: {
|
{ config, ... }: {
|
||||||
|
|
||||||
backup.services.restic = {
|
backup.services.restic = {
|
||||||
"on-porani".enable = false;
|
"on-porani.private".enable = false;
|
||||||
"on-workhorse".enable = true;
|
"on-workhorse.private".enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config = let
|
||||||
servers = [ "porani" "workhorse" "workout" ];
|
servers = [ "porani.private" "workhorse.private" "workout.private" ];
|
||||||
dirs = config.backup.all.restic.dirs;
|
dirs = config.backup.all.restic.dirs;
|
||||||
|
|
||||||
setup = server: {
|
setup = server: {
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
in {
|
in {
|
||||||
|
|
||||||
backup.services.restic = lib.zipAttrsWith (name: vals: lib.head vals)
|
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" = {
|
environment.etc."info/restic-${hostname}.json" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
backup.services.restic = {
|
backup.services.restic = {
|
||||||
"on-porani".enable = true;
|
"on-porani.private".enable = true;
|
||||||
"on-workhorse".enable = true;
|
"on-workhorse.private".enable = true;
|
||||||
"on-workout".enable = true;
|
"on-workout.private".enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
backup.all.restic.dirs = [ "/home/palo/.password-store" ];
|
backup.all.restic.dirs = [ "/home/palo/.password-store" ];
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{ lib, ... }: {
|
{ lib, ... }: {
|
||||||
|
|
||||||
backup.services.restic = {
|
backup.services.restic = {
|
||||||
"on-porani".enable = lib.mkDefault true;
|
"on-porani.private".enable = lib.mkDefault true;
|
||||||
"on-workhorse".enable = lib.mkDefault true;
|
"on-workhorse.private".enable = lib.mkDefault true;
|
||||||
"on-workout".enable = lib.mkDefault true;
|
"on-workout.private".enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue