about summary refs log tree commit diff
path: root/modules/services
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-06 07:31:56 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-06 07:31:56 -0700
commitc41d9b7d8a6f8452f9dfb2650acb0926fef0d212 (patch)
treec9bd1e0f6e1236a29bab44ae79e574290be4b2a2 /modules/services
parentenable AMD module correctly (diff)
downloadworld-c41d9b7d8a6f8452f9dfb2650acb0926fef0d212.tar.gz
refactor navidrome to a module
Diffstat (limited to '')
-rw-r--r--modules/services/navidrome/default.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/modules/services/navidrome/default.nix b/modules/services/navidrome/default.nix
new file mode 100644
index 0000000..1c3725b
--- /dev/null
+++ b/modules/services/navidrome/default.nix
@@ -0,0 +1,37 @@
+{ config, pkgs, lib, ... }:
+let cfg = config.my.services.navidrome;
+in {
+  options.my.services.navidrome = with lib; {
+    enable = mkEnableOption "Navidrome Music Server";
+    musicFolder = mkOption {
+      type = types.str;
+      example = "/data/fast/music";
+      description = "Music folder";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.navidrome = {
+      enable = true;
+      settings = {
+        MusicFolder = cfg.musicFolder;
+        Address = "0.0.0.0";
+        httpPort = "4533";
+      };
+    };
+
+    services.restic.backups = {
+      navidrome = {
+        paths = [ "/var/lib/navidrome/" ];
+        repository = "/data/slow/backups/systems";
+        passwordFile = config.age.secrets.restic-repo-systems.path;
+        timerConfig = { OnCalendar = "00:35"; };
+        initialize = true;
+        extraBackupArgs = [ "--tag navidrome" ];
+        pruneOpts = [ "--keep-daily 7" "--keep-weekly 4" ];
+      };
+    };
+
+    networking.firewall.allowedTCPPorts = [ 4533 ];
+  };
+}