refactor: put all wrtag config in config file
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
parent
99cf1e7cc5
commit
6e6e3d9757
3 changed files with 8 additions and 29 deletions
|
|
@ -6,10 +6,6 @@
|
|||
}:
|
||||
let
|
||||
cfg = config.services.wrtagweb;
|
||||
settingsFormat = pkgs.formats.keyValue {
|
||||
mkKeyValue = lib.generators.mkKeyValueDefault { } " ";
|
||||
listsAsDuplicateKeys = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
|
@ -17,25 +13,12 @@ in
|
|||
|
||||
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
|
||||
'';
|
||||
};
|
||||
|
||||
envFile = lib.mkOption {
|
||||
settingsFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
File with environment variables for wrtagweb
|
||||
Configuration file for wrtagweb
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -53,8 +36,7 @@ in
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
User = "wrtagweb";
|
||||
ExecStart = "${pkgs.unstable.wrtag}/bin/wrtagweb -config-path ${settingsFormat.generate "wrtagweb" cfg.settings}";
|
||||
EnvironmentFile = cfg.envFile;
|
||||
ExecStart = "${pkgs.unstable.wrtag}/bin/wrtagweb -config-path ${cfg.settingsFile}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue