From ebd263189e8eb0d329bc773d45d36d1b3ce536eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sat, 3 Aug 2024 07:03:15 +0300 Subject: [PATCH] move minidlna to its own module --- hosts/fwminex/configuration.nix | 24 +++++-------------- modules/services/default.nix | 1 + modules/services/minidlna/default.nix | 33 +++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 modules/services/minidlna/default.nix diff --git a/hosts/fwminex/configuration.nix b/hosts/fwminex/configuration.nix index 733c433..ad51ecc 100644 --- a/hosts/fwminex/configuration.nix +++ b/hosts/fwminex/configuration.nix @@ -65,14 +65,6 @@ in systemd.tmpfiles.rules = [ "d /var/www 0755 motiejus users -" ]; - systemd.services.minidlna = { - serviceConfig = { - ProtectSystem = "strict"; - ProtectHome = "tmpfs"; - BindReadOnlyPaths = [ "/home/motiejus/video" ]; - }; - }; - services = { pcscd.enable = true; acpid.enable = true; @@ -105,16 +97,6 @@ in }; }; - minidlna = { - enable = true; - openFirewall = true; - settings = { - media_dir = [ "/home/motiejus/video" ]; - friendly_name = "vno1-oh2"; - inotify = "yes"; - }; - }; - prometheus = { enable = true; port = myData.ports.prometheus; @@ -189,12 +171,18 @@ in sshguard.enable = true; gitea.enable = true; hass.enable = true; + vaultwarden = { enable = true; port = myData.ports.vaultwarden; secretsEnvFile = config.age.secrets.vaultwarden-secrets-env.path; }; + minidlna = { + enable = true; + paths = [ "/home/motiejus/video" ]; + }; + grafana = { enable = true; port = myData.ports.grafana; diff --git a/modules/services/default.nix b/modules/services/default.nix index c70a885..d17e0cd 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -12,6 +12,7 @@ ./headscale ./jakstpub ./matrix-synapse + ./minidlna ./node_exporter ./nsd-acme ./photoprism diff --git a/modules/services/minidlna/default.nix b/modules/services/minidlna/default.nix new file mode 100644 index 0000000..e426c51 --- /dev/null +++ b/modules/services/minidlna/default.nix @@ -0,0 +1,33 @@ +{ config, lib, ... }: +let + cfg = config.mj.services.minidlna; +in +{ + options.mj.services.minidlna = with lib.types; { + enable = lib.mkEnableOption "Enable minidlna"; + paths = lib.mkOption { type = listOf path; }; + }; + + config = { + + services.minidlna = { + enable = true; + openFirewall = true; + settings = { + media_dir = cfg.paths; + friendly_name = "${config.networking.hostName}.${config.networking.domain}"; + inotify = "yes"; + }; + }; + + systemd.services.minidlna = { + serviceConfig = { + ProtectSystem = "strict"; + ProtectHome = "tmpfs"; + BindReadOnlyPaths = cfg.paths; + }; + }; + + }; + +}