diff options
author | Profpatsch <mail@profpatsch.de> | 2021-06-07 19:30:38 +0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-06-07 19:30:38 +0200 |
commit | 548796816c763aee3c003e64b2edc31838f93fb5 (patch) | |
tree | 28eb40fe25d68eb40f8d6d3e35ddf8c1321f167e /modules/user/profpatsch/services/gonic.nix | |
parent | 1d1784e417cb415d77a63c7d6eecaa960af7d489 (diff) |
modules/profpatsch/gonic: add podcast & scan interval
On haku, scan every 10 minutes and listen on the tailscale interface.
Diffstat (limited to 'modules/user/profpatsch/services/gonic.nix')
-rw-r--r-- | modules/user/profpatsch/services/gonic.nix | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/modules/user/profpatsch/services/gonic.nix b/modules/user/profpatsch/services/gonic.nix index 73ccde7c..f05085a6 100644 --- a/modules/user/profpatsch/services/gonic.nix +++ b/modules/user/profpatsch/services/gonic.nix @@ -3,6 +3,7 @@ let cfg = config.vuizvui.services.profpatsch.gonic; gonicDataDir = "/var/lib/gonic"; + systemdDataDirSuffix = "gonic"; # implicitly scoped to /var/lib userName = "gonic"; inherit (pkgs.vuizvui.profpatsch) @@ -19,8 +20,13 @@ in { options.vuizvui.services.profpatsch.gonic = { enable = lib.mkEnableOption "gonic server"; + listenAddress = lib.mkOption { + description = "daemon listen address"; + type = lib.types.str; + }; + musicDir = lib.mkOption { - description = "path to the music directory"; + description = "path to the music directory; must exist beforehand and have the right group permissions"; type = lib.types.path; }; musicDirGroup = lib.mkOption { @@ -28,6 +34,21 @@ in { type = lib.types.str; }; + podcastDir = lib.mkOption { + description = "path to the podcast directory; must exist beforehand and have the right group permissions"; + type = lib.types.path; + }; + podcastDirGroup = lib.mkOption { + description = "user group to access podcast directory"; + type = lib.types.str; + }; + + scanIntervalMinutes = lib.mkOption { + description = "interval (in minutes) to check for new music (automatic scanning disabled if omitted)"; + type = lib.types.nullOr lib.types.ints.positive; + default = null; + example = 10; + }; }; config = lib.mkIf cfg.enable { @@ -40,16 +61,20 @@ in { systemd.services.gonic = { wantedBy = [ "default.target" ]; serviceConfig = { - ExecStart = writeExecline "start-gonic" {} [ + ExecStart = writeExecline "start-gonic" {} ([ bins.gonic - "-listen-addr" "127.0.0.1:4747" + "-listen-addr" cfg.listenAddress "-cache-path" "${gonicDataDir}/cache" "-db-path" "${gonicDataDir}/db.sqlite" "-music-path" cfg.musicDir - ]; - StateDirectory = gonicDataDir; + "-podcast-path" cfg.podcastDir + ] + ++ lib.optionals (cfg.scanIntervalMinutes != null) [ + "-scan-interval" (toString cfg.scanIntervalMinutes) + ]); + StateDirectory = systemdDataDirSuffix; User = userName; - SupplementaryGroups = cfg.musicDirGroup; + SupplementaryGroups = [ cfg.musicDirGroup cfg.podcastDirGroup ]; }; }; |