From bf62802ffddda7392a949d8fbd24c03e22294328 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Thu, 26 Dec 2024 15:45:22 -0500 Subject: [PATCH] cleaning stuff up --- hosts/hl-bigbox1.nix | 32 ++++++++-------------- hosts/hl-minipc1.nix | 5 ---- hosts/hl-minipc2.nix | 5 ++++ modules/nixos/server/services/jellyfin.nix | 4 +-- modules/nixos/server/services/scrypted.nix | 3 ++ modules/nixos/server/timers.nix | 9 +++++- 6 files changed, 30 insertions(+), 28 deletions(-) diff --git a/hosts/hl-bigbox1.nix b/hosts/hl-bigbox1.nix index acd556d..224212d 100644 --- a/hosts/hl-bigbox1.nix +++ b/hosts/hl-bigbox1.nix @@ -6,6 +6,18 @@ user.enable = true; server.admin.enable = true; server.exporters.enable = true; + server.timers = { + jellyfin-backups = { + OnCalendar = "daily"; + wantedBy = [ + "mnt-terra1-Data-apps.mount" + ]; + script = '' + set -eu + ${pkgs.rsync}/bin/rsync -avpzP --delete /opt/jellyfin /mnt/terra1/Data/apps/ + ''; + }; + }; nixos = { common.ssh-server.enable = true; common.containers.openMetricsPort = true; @@ -45,24 +57,4 @@ jellyfin-web jellyfin-ffmpeg ]; - - systemd.timers."backup-jellyfin" = { - wantedBy = [ "timers.target" ]; - timerConfig = { - OnCalendar = "daily"; - Persistent = true; - Unit = "backup-jellyfin.service"; - }; - }; - - systemd.services."backup-jellyfin" = { - script = '' - set -eu - ${pkgs.rsync}/bin/rsync -avpzP --delete /opt/jellyfin /mnt/terra1/Data/apps/ - ''; - serviceConfig = { - Type = "oneshot"; - User = "root"; - }; - }; } diff --git a/hosts/hl-minipc1.nix b/hosts/hl-minipc1.nix index fa772df..d513a6b 100644 --- a/hosts/hl-minipc1.nix +++ b/hosts/hl-minipc1.nix @@ -47,11 +47,6 @@ in configDir = "/mnt/Data/audiobookshelf/config"; metadtaDir = "/mnt/Data/audiobookshelf/metadata"; }; - dockge = { - enable = true; - openFirewall = true; - port = 5002; - }; }; services.dockerRegistry = { enable = true; diff --git a/hosts/hl-minipc2.nix b/hosts/hl-minipc2.nix index 9bca2a4..eae4553 100644 --- a/hosts/hl-minipc2.nix +++ b/hosts/hl-minipc2.nix @@ -25,6 +25,11 @@ # Services skyg.nixos.server.services = { scrypted.enable = true; + dockge = { + enable = true; + openFirewall = true; + port = 5002; + }; }; } diff --git a/modules/nixos/server/services/jellyfin.nix b/modules/nixos/server/services/jellyfin.nix index 296a9ba..6856d6f 100644 --- a/modules/nixos/server/services/jellyfin.nix +++ b/modules/nixos/server/services/jellyfin.nix @@ -39,12 +39,12 @@ in fileSystems."/mnt/apps/jellyfin" = { device = "terra1.lab.internal:/mnt/Data/apps/jellyfin"; fsType = "nfs"; - options = [ "x-systemd.automount" "noauto" ]; + options = [ "x-systemd.automount" "auto" ]; }; fileSystems."/family-videos" = { device = "tnas1.lab.internal:/mnt/EightTerra/FamilyStorage/Video"; fsType = "nfs"; - options = [ "x-systemd.automount" "noauto" ]; + options = [ "x-systemd.automount" "auto" ]; }; }; } diff --git a/modules/nixos/server/services/scrypted.nix b/modules/nixos/server/services/scrypted.nix index 477df17..94fd6f7 100644 --- a/modules/nixos/server/services/scrypted.nix +++ b/modules/nixos/server/services/scrypted.nix @@ -28,6 +28,9 @@ in skyg.server.timers = { scrypted-backups = { OnCalendar = "daily"; + wantedBy = [ + "mnt-terra1-Data-apps.mount" + ]; script = '' set -eu ${pkgs.rsync}/bin/rsync -avpzP --delete /opt/homelab/scrypted /mnt/terra1/Data/apps/ diff --git a/modules/nixos/server/timers.nix b/modules/nixos/server/timers.nix index 38f2d4b..e96a716 100644 --- a/modules/nixos/server/timers.nix +++ b/modules/nixos/server/timers.nix @@ -12,6 +12,10 @@ in { type = lib.types.str; default = "daily"; }; + wantedBy = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + }; }; }); default = { }; @@ -21,7 +25,10 @@ in { systemd.timers = builtins.mapAttrs ( name: value: { - wantedBy = [ "timers.target" ]; + wantedBy = builtins.concatLists [ + [ "timers.target" ] + value.wantedBy + ]; timerConfig = { OnCalendar = value.OnCalendar; Persistent = true;