massicot,fix: switch to fix drive
This commit is contained in:
parent
37f59db944
commit
5104c5943e
16 changed files with 512 additions and 248 deletions
5
machines/massicot/services/default.nix
Normal file
5
machines/massicot/services/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./restic.nix
|
||||
];
|
||||
}
|
51
machines/massicot/services/restic.nix
Normal file
51
machines/massicot/services/restic.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
sqliteBackup = path: ''
|
||||
mkdir -p /backup${path}
|
||||
${lib.getExe pkgs.sqlite} ${path} "vacuum into '/var/backup${path}'"
|
||||
'';
|
||||
in
|
||||
{
|
||||
sops.secrets = {
|
||||
"restic/repo" = {
|
||||
sopsFile = ../secrets.yaml;
|
||||
};
|
||||
"restic/password" = {
|
||||
sopsFile = ../secrets.yaml;
|
||||
};
|
||||
};
|
||||
|
||||
custom.restic = {
|
||||
enable = true;
|
||||
repositoryFile = config.sops.secrets."restic/repo".path;
|
||||
passwordFile = config.sops.secrets."restic/password".path;
|
||||
paths = [
|
||||
"/var/backup"
|
||||
"/mnt/storage"
|
||||
];
|
||||
};
|
||||
|
||||
services.postgresqlBackup = {
|
||||
enable = true;
|
||||
compression = "zstd";
|
||||
compressionLevel = 9;
|
||||
location = "/var/backup/postgresql";
|
||||
};
|
||||
|
||||
services.restic.backups.${config.networking.hostName} = {
|
||||
backupPrepareCommand = builtins.concatStringsSep "\n" [
|
||||
(sqliteBackup "/var/lib/hedgedoc/db.sqlite")
|
||||
(sqliteBackup "/var/lib/bitwarden_rs/db.sqlite3")
|
||||
(sqliteBackup "/var/lib/gotosocial/database.sqlite")
|
||||
(sqliteBackup "/var/lib/kanidm/kanidm.db")
|
||||
];
|
||||
extraBackupArgs = [
|
||||
"--limit-upload=1024"
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue