From c3e09c0b7c52c98d45053b63f9c0e7ab15302c15 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Thu, 16 Nov 2023 15:54:54 +0100 Subject: [PATCH] voyager: add time machine, cleanup --- flake.nix | 1 - hosts/voyager/configuration.nix | 17 ++++++----- hosts/voyager/services/timemachine.nix | 42 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 hosts/voyager/services/timemachine.nix diff --git a/flake.nix b/flake.nix index 597a0bf..f3e8eb3 100644 --- a/flake.nix +++ b/flake.nix @@ -48,7 +48,6 @@ ./hosts/voyager/configuration.nix voyager-addons.nixosModules.default sops-nix.nixosModules.sops - matrix-synapse-next.nixosModules.synapse ]; }; edison = nixpkgs.lib.nixosSystem { diff --git a/hosts/voyager/configuration.nix b/hosts/voyager/configuration.nix index 9f2d40f..e81e7f8 100644 --- a/hosts/voyager/configuration.nix +++ b/hosts/voyager/configuration.nix @@ -13,17 +13,18 @@ ./services/snappymail.nix #./vms.nix - ./services/nginx - ./services/postgres.nix - ./services/kanidm.nix - ./services/jellyfin.nix - ./services/transmission.nix - ./services/metrics - ./services/gitea.nix - ./services/vaultwarden.nix ./services/calibre.nix ./services/fancontrol.nix + ./services/gitea.nix + ./services/jellyfin.nix ./services/jupyter.nix + ./services/kanidm.nix + ./services/metrics + ./services/nginx + ./services/postgres.nix + ./services/timemachine.nix + ./services/transmission.nix + ./services/vaultwarden.nix # ./services/searx.nix # ./services/code-server.nix diff --git a/hosts/voyager/services/timemachine.nix b/hosts/voyager/services/timemachine.nix new file mode 100644 index 0000000..7661269 --- /dev/null +++ b/hosts/voyager/services/timemachine.nix @@ -0,0 +1,42 @@ +{ config, pkgs, ... }: + let + timeMachineDir = "/tank/backup/worf"; + user = "worf-backup"; + sizeLimit = "800000"; # MiB + allowedIPs = "192.168.10.2 192.168.10.5"; #TODO + in { + services.avahi = { + enable = true; + publish = { + enable = true; + userServices = true; + }; + }; + + services.netatalk = { + enable = true; + + settings = { + Global = { + "mimic model" = "TimeCapsule6,106"; # show the icon for the first gen TC + "hosts allow" = allowedIPs; + }; + + "worf-time-machine" = { + "time machine" = "yes"; + "path" = timeMachineDir; + "valid users" = user; + "vol size limit" = sizeLimit; + }; + }; + }; + + users.extraUsers.worf-backup = { + isSystemUser = true; + name = user; + group = user; + }; + users.groups."${user}" = {}; + + networking.firewall.allowedTCPPorts = [ 548 636 ]; +}