added backup module and backups for box and curve
also put a reverse proxy infront of radicale
This commit is contained in:
parent
ef507ca7aa
commit
5637febfd5
|
@ -12,4 +12,23 @@
|
|||
services."grasp".enable = true;
|
||||
services."grasp".path = "/home/anish/kitaab/grasp";
|
||||
services."grasp".user = "anish";
|
||||
|
||||
services.postgresqlBackup = {
|
||||
enable = true;
|
||||
databases = [ "wallabag" ];
|
||||
location = "/var/backup/postgresql";
|
||||
};
|
||||
|
||||
mossnet.backup = {
|
||||
enable = true;
|
||||
name = "mossnet";
|
||||
paths = [
|
||||
"/var/lib/taskserver" # taskwarrior
|
||||
"/var/www/shaarli-config" # sharli
|
||||
"/var/backup/postgresql" # wallabag
|
||||
"/var/lib/radicale" # radicale
|
||||
];
|
||||
# seafile?
|
||||
# syncthing
|
||||
};
|
||||
}
|
||||
|
|
|
@ -28,6 +28,12 @@
|
|||
|
||||
boot.supportedFilesystems = [ "ntfs" ];
|
||||
|
||||
mossnet.backup = {
|
||||
enable = true;
|
||||
name = "curve";
|
||||
paths = [ "/home/anish" ];
|
||||
};
|
||||
|
||||
# enable adb
|
||||
# TODO move this (it's for KaiOS WebIDE devShell?)
|
||||
programs.adb.enable = true;
|
||||
|
|
54
modules/backup.nix
Normal file
54
modules/backup.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
# Assumes the remote borg backup server has already been initialized
|
||||
# TODO:
|
||||
# This currently works on a per host basis, and the host file has to define all the locations it wants to back up.
|
||||
# Ideally, this would create a job for each profile instead, so the backup strategy is included in the profile regardless of host
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.mossnet.backup;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
mossnet.backup = {
|
||||
enable = mkEnableOption "Backup module using borg for Anish's computer nursery";
|
||||
name = lib.mkOption {
|
||||
type = types.str;
|
||||
default = { };
|
||||
example = literalExample ''
|
||||
shaarli
|
||||
'';
|
||||
description = ''
|
||||
name for the backup operator
|
||||
'';
|
||||
};
|
||||
paths = lib.mkOption {
|
||||
type = with types; attrsOf (listOf str);
|
||||
default = { };
|
||||
example = literalExample ''
|
||||
[ "/home/anish/usr" ];
|
||||
'';
|
||||
description = ''
|
||||
A list of folders to backup
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.borgbackup.jobs = {
|
||||
"${cfg.name}" = {
|
||||
paths = cfg.paths;
|
||||
doInit = true;
|
||||
repo = "20779@hk-s020.rsync.net:${cfg.name}";
|
||||
encryption = {
|
||||
mode = "repokey-blake2";
|
||||
passCommand = "cat /run/keys/borg-password";
|
||||
};
|
||||
environment = { BORG_RSH = "ssh -i /root/borg/borg-key"; }; # YOU NEED TO PUT THIS HERE MANUALLY
|
||||
compression = "auto,lzma";
|
||||
startAt = "weekly";
|
||||
extraArgs = "--remote-path=borg1";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -7,5 +7,18 @@
|
|||
server.hosts = [ "0.0.0.0:5252" ];
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 5252 ];
|
||||
|
||||
services.nginx.virtualHosts."cal.mossnet.lan" = {
|
||||
enableACME = false;
|
||||
forceSSL = false;
|
||||
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
proxy_pass http://localhost:5252/;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue