Compare commits

...

6 commits

5 changed files with 67 additions and 6 deletions

View file

@ -12,6 +12,10 @@
./../../modules/services/dandelion.nix ./../../modules/services/dandelion.nix
]; ];
users.users.liv.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOLdcB5JFWx6OK2BAr8J0wPHNhr2VP2/Ci6fv3a+DPfo liv@violet" # allow violet to log in over ssh to do back ups
];
networking.hostName = "dandelion"; networking.hostName = "dandelion";
liv.server.enable = true; liv.server.enable = true;

54
hosts/violet/backups.nix Normal file
View file

@ -0,0 +1,54 @@
let
borgbackupMonitor =
{
config,
pkgs,
lib,
...
}:
with lib;
{
key = "borgbackupMonitor";
_file = "borgbackupMonitor";
config.systemd.services =
{
"notify-problems@" = {
enable = true;
serviceConfig.User = "liv";
environment.SERVICE = "%i";
script = ''
${pkgs.curl}/bin/curl -d "$SERVICE FAILED! - service $SERVICE on host $(hostname) failed, run journalctl -u $SERVICE for details."
'';
};
}
// flip mapAttrs' config.services.borgbackup.jobs (
name: value:
nameValuePair "borgbackup-job-${name}" {
unitConfig.OnFailure = "notify-problems@%i.service";
}
);
# optional, but this actually forces backup after boot in case laptop was powered off during scheduled event
# for example, if you scheduled backups daily, your laptop should be powered on at 00:00
config.systemd.timers = flip mapAttrs' config.services.borgbackup.jobs (
name: value:
nameValuePair "borgbackup-job-${name}" {
timerConfig.Persistent = true;
}
);
};
in
{
imports = [ borgbackupMonitor ];
services = {
borgbackup.jobs.liv-violet = {
paths = "/home/liv";
encryption.mode = "none";
environment.BORG_RSH = "ssh -i /home/liv/.ssh/id_ed25519";
repo = "ssh://liv@100.115.178.50:9123/spinners/rootvol/backups/hosts/violet";
compression = "auto,zstd";
startAt = "daily";
};
};
}

View file

@ -9,6 +9,7 @@
./hardware-configuration.nix ./hardware-configuration.nix
./../../modules/core/default.server.nix ./../../modules/core/default.server.nix
./../../modules/services/violet.nix ./../../modules/services/violet.nix
# ./backups.nix # disable for now, test first.
]; ];
networking.hostName = "violet"; networking.hostName = "violet";
@ -24,15 +25,16 @@
pkgs.kitty.terminfo pkgs.kitty.terminfo
]; ];
services.smartd = { services = {
enable = lib.mkForce false; smartd = {
autodetect = lib.mkForce false; enable = lib.mkForce false;
autodetect = lib.mkForce false;
};
xserver.videoDrivers = [ "nvidia" ];
}; };
liv.nvidia.enable = true; liv.nvidia.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
boot = { boot = {
loader.grub = { loader.grub = {
enable = true; enable = true;

View file

@ -12,7 +12,7 @@ in
listen-http = "127.0.0.1:${toString port}"; listen-http = "127.0.0.1:${toString port}";
behind-proxy = true; behind-proxy = true;
visitor-attachment-daily-bandwidth-limit = "10M"; visitor-attachment-daily-bandwidth-limit = "10M";
visitor-request-limit-burst = 5; visitor-request-limit-burst = 15;
visitor-request-limit-replenish = "15s"; visitor-request-limit-replenish = "15s";
}; };
}; };

View file

@ -20,6 +20,7 @@
++ [ (import ./nginx.nix) ] ++ [ (import ./nginx.nix) ]
# ++ [(import ./komga.nix)] # ++ [(import ./komga.nix)]
++ [ (import ./radicale.nix) ] ++ [ (import ./radicale.nix) ]
++ [ (import ./tailscale.nix) ]
++ [ (import ./readarr.nix) ]; ++ [ (import ./readarr.nix) ];
# ++ [(import ./smart-monitoring.nix)] # ++ [(import ./smart-monitoring.nix)]
# ++ [(import ./jitsi-meet.nix)] # ++ [(import ./jitsi-meet.nix)]