mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-27 17:02:31 +01:00
feat(idols-ai): restic backup to a local repository
Allowlist of the irreplaceable directories (Documents, work, Pictures, nix-config, .local/state); project checkouts under ~/codes live in git and are not backed up. Kept the excludes generic, since this repo is public. Also move the restic-password secret to a desktop.enable || server.storage gate so desktops get it without enabling a server group.
This commit is contained in:
1 parent
e37042f61c
commit
12ac5f45aa
2 files changed
+52
-6
No files matched your search
@@ -0,0 +1,40 @@
|
||||
{
|
||||
...
|
||||
}:
|
||||
{
|
||||
# Part 1 of the backup plan: a local restic repository on this machine.
|
||||
# The off-machine target (youko, or a cloud) is a later step.
|
||||
#
|
||||
# Be specific here and keep `exclude` minimal: an allowlist of the few
|
||||
# directories that are actually irreplaceable beats backing up a broad tree
|
||||
# and excluding half of it. Project checkouts under ~/codes are tracked in
|
||||
# git (or have remotes), so they are not backed up at all.
|
||||
modules.restic-backup = {
|
||||
enable = true;
|
||||
repository = "/var/lib/backups/restic/idols-ai";
|
||||
|
||||
paths = [
|
||||
"/home/ryan/Documents"
|
||||
"/home/ryan/work"
|
||||
"/home/ryan/Pictures"
|
||||
"/home/ryan/nix-config"
|
||||
"/home/ryan/.local/state"
|
||||
];
|
||||
|
||||
exclude = [
|
||||
# generic patterns only; this repository is public
|
||||
"**/node_modules"
|
||||
"**/target"
|
||||
"**/.venv"
|
||||
"**/venv"
|
||||
"**/.next"
|
||||
"**/dist"
|
||||
"**/build"
|
||||
"**/.direnv"
|
||||
"**/result*"
|
||||
"**/__pycache__"
|
||||
"**/.pytest_cache"
|
||||
"**/.ruff_cache"
|
||||
];
|
||||
};
|
||||
}
|
||||
+12
-6
@@ -213,6 +213,16 @@ in
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf (cfg.desktop.enable || cfg.server.storage.enable) {
|
||||
# the restic repository password, needed by modules.restic-backup on both
|
||||
# the homelab servers and the desktops
|
||||
age.secrets."restic-password" = {
|
||||
file = "${mysecrets}/restic-password.age";
|
||||
mode = "0400";
|
||||
owner = "root";
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.server.storage.enable {
|
||||
age.secrets = {
|
||||
"hdd-luks-crypt-key" = {
|
||||
@@ -220,12 +230,8 @@ in
|
||||
mode = "0400";
|
||||
owner = "root";
|
||||
};
|
||||
# restic repository password (used by modules.restic-backup)
|
||||
"restic-password" = {
|
||||
file = "${mysecrets}/restic-password.age";
|
||||
mode = "0400";
|
||||
owner = "root";
|
||||
};
|
||||
# restic repository password (used by modules.restic-backup). Gated
|
||||
# separately below so desktops get it without enabling a server group.
|
||||
};
|
||||
|
||||
# place secrets in /etc/
|
||||
|
||||
Reference in new issue
Block a user