trying out stuff
This commit is contained in:
parent
155dd8c0ad
commit
ba7d17816a
2 changed files with 28 additions and 25 deletions
28
backup.nix
28
backup.nix
|
@ -27,4 +27,30 @@ let
|
||||||
systemctl start forgejo.service
|
systemctl start forgejo.service
|
||||||
# Prune old backups
|
# Prune old backups
|
||||||
${pkgs.borgbackup}/bin/borg prune --list $BORG_REPO --prefix 'forgejo-' --show-rc --keep-daily=7 --keep-weekly=4 --keep-monthly=6
|
${pkgs.borgbackup}/bin/borg prune --list $BORG_REPO --prefix 'forgejo-' --show-rc --keep-daily=7 --keep-weekly=4 --keep-monthly=6
|
||||||
'';
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
environment.systemPackages = [ pkgs.borgbackup ];
|
||||||
|
# Create folders
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d /borgbackupcache 700 root root"
|
||||||
|
];
|
||||||
|
# Backup timer
|
||||||
|
systemd.services.borg-backup = {
|
||||||
|
description = "Borg Backup for Forgejo and MySQL";
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${forgejo-borgbackup}";
|
||||||
|
User = "root";
|
||||||
|
};
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.borg-backup = {
|
||||||
|
description = "Daily Borg Backup Timer";
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "daily";
|
||||||
|
Persistent = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -56,13 +56,9 @@
|
||||||
vim
|
vim
|
||||||
wget
|
wget
|
||||||
curl
|
curl
|
||||||
borgbackup
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# Create folders
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"d /borgbackupcache 700 root root"
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
# Enable the OpenSSH daemon.
|
||||||
|
@ -111,25 +107,6 @@
|
||||||
AuthorizedKeysFile ${config.users.users.forgejo.home}/.ssh/authorized_keys
|
AuthorizedKeysFile ${config.users.users.forgejo.home}/.ssh/authorized_keys
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Backup timer
|
|
||||||
systemd.services.borg-backup = {
|
|
||||||
description = "Borg Backup for Forgejo and MySQL";
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "${forgejo-borgbackup}";
|
|
||||||
User = "root";
|
|
||||||
};
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.timers.borg-backup = {
|
|
||||||
description = "Daily Borg Backup Timer";
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
OnCalendar = "daily";
|
|
||||||
Persistent = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#enable qemu-guestagent
|
#enable qemu-guestagent
|
||||||
services.qemuGuest.enable = true;
|
services.qemuGuest.enable = true;
|
||||||
# Disable password checking for wheel group users so we can solely rely on ssh keys
|
# Disable password checking for wheel group users so we can solely rely on ssh keys
|
||||||
|
|
Loading…
Reference in a new issue