Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
53 lines
1.5 KiB
Nix
53 lines
1.5 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.wrtagweb;
|
|
settingsFormat = pkgs.formats.keyValue {
|
|
mkKeyValue = lib.generators.mkKeyValueDefault { } " ";
|
|
listsAsDuplicateKeys = true;
|
|
};
|
|
in
|
|
{
|
|
options = {
|
|
services.wrtagweb = {
|
|
|
|
enable = lib.mkEnableOption "wrtag web";
|
|
|
|
settings = lib.mkOption rec {
|
|
type = settingsFormat.type;
|
|
apply = lib.recursiveUpdate default;
|
|
default = {
|
|
web-listen-addr = "127.0.0.1:7373";
|
|
path-format = "/data/music/{{ artists .Release.Artists | sort | join \"; \" | safepath }}/({{ .Release.ReleaseGroup.FirstReleaseDate.Year }}) {{ .Release.Title | safepath }}{{ if not (eq .ReleaseDisambiguation \"\") }} ({{ .ReleaseDisambiguation | safepath }}){{ end }}/{{ pad0 2 .TrackNum }}.{{ len .Tracks | pad0 2 }} {{ if .IsCompilation }}{{ artistsString .Track.Artists | safepath }} - {{ end }}{{ .Track.Title | safepath }}{{ .Ext }}";
|
|
};
|
|
description = ''
|
|
Configuration for wrtagweb
|
|
'';
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
users.users.wrtagweb = {
|
|
enable = true;
|
|
isSystemUser = true;
|
|
group = "wrtagweb";
|
|
};
|
|
users.groups.wrtagweb = { };
|
|
|
|
systemd.services.wrtagweb = {
|
|
description = "wrtagweb";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
User = "wrtagweb";
|
|
ExecStart = "${pkgs.unstable.wrtag}/bin/wrtagweb -config-path ${settingsFormat.generate "wrtagweb" cfg.settings}";
|
|
};
|
|
};
|
|
};
|
|
}
|