Added a backup for a specific shared folder

This commit is contained in:
Nickiel12 2024-12-28 11:26:55 -08:00
parent 716da06947
commit 663e78e5dd
3 changed files with 34 additions and 2 deletions

View file

@ -37,6 +37,11 @@
backup_dir = "/Aurora/Backups/Vaultwarden";
};
samba_shares = {
enable = true;
backup_dir = "/Aurora/SharedFolders/Blizzard"; # only backup one folder
};
forgejo = {
enable = true;
backups_dir = "/Aurora/Backups/Forgejo";

View file

@ -63,6 +63,18 @@ in
};
};
samba_shares = {
enable = lib.mkEnableOption (lib.mdDoc "Back up Samba shared folders");
backup_dir = lib.mkOption {
type = lib.types.path;
default = "/Aurora/SharedFolders";
description = lib.mdDoc ''
The path of the shared folders used by samba
'';
};
};
nextcloud = {
enable = lib.mkEnableOption (lib.mkDoc "Back up nextcloud instance");
root_dir = lib.mkOption {
@ -139,6 +151,12 @@ in
echo "Mounting the external backup drive"
mount /dev/disk/by-label/${cfg.backup1_drive_label} ${builtins.toString cfg.tmp_mount_point} -t ntfs3
#----- BEGIN SAMBA SHARES
if [ "${builtins.toString cfg.samba_shares.enable}" = "1" ]; then
rsync -av ${cfg.samba_shares.backup_dir} ${builtins.toString cfg.tmp_mount_point}
fi
#----- END SAMBA SHARES
#------ BEGIN NEXTCLOUD
if [ "${builtins.toString cfg.nextcloud.enable}" = "1" ]; then
echo "Putting nextcloud into maintenance mode so that changes cannot happen during the backup"

View file

@ -7,18 +7,27 @@ in {
enable = true;
openFirewall = true;
settings = {
global.workgroup = "WORKGROUP";
global."invalid users" = [
"root"
];
global.security = "user";
global."passwd program" = "/run/wrappers/bin/passwd %u";
Iceberg = {
iceberg = {
comment = "the Alaska SMB share";
path = "/Aurora/SharedFolders/Iceberg";
"guest ok" = "yes";
"guest ok" = "no";
"read only" = "no";
browseable = "yes";
};
blizzard = {
comment = "Backed up Alaska SMB share";
path = "/Aurora/SharedFolders/Blizzard";
"guest ok" = "no";
"read only" = "no";
browseable = "yes";
};
};
};