nix: simplify and fix module, hopefully

This commit is contained in:
Gabriel Fontes
2023-06-12 09:23:12 -03:00
parent 46b6ce6ce6
commit fb19a77534

View File

@@ -20,26 +20,12 @@ in {
description = "Service user that will run the daemon.";
};
subsonicUrl = mkOption {
type = types.str;
description = "Subsonic library base API URL";
};
subsonicUser = mkOption {
type = types.str;
description = "Subsonic user login";
};
subsonicPasswordFile = mkOption {
environmentFile = mkOption {
type = types.path;
description = "File path containing subsonic user password";
};
discordTokenFile = mkOption {
type = types.path;
description = "File path containing discord token";
};
discordGuild = mkOption {
type = types.str;
description = "Your server's guild ID, to auto-register commands";
default = null;
description = "File path containing environment variables.";
};
extraArgs = mkOption {
type = types.listOf types.str;
default = [ ];
@@ -54,15 +40,9 @@ in {
serviceConfig = {
Restart = "always";
User = cfg.user;
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile;
};
script = lib.escapeShellArgs ([
(lib.getExe cfg.package)
"--subsonic-url=${cfg.subsonicUrl}"
"--subsonic-user=${cfg.subsonicUser}"
"--subsonic-password=$(cat ${cfg.subsonicPasswordFile})"
"--discord-token=$(cat ${cfg.discordTokenFile})"
"--discord-guild=${cfg.discordGuild}"
] ++ cfg.extraArgs);
script = (lib.getExe cfg.package) + (lib.escapeShellArg cfg.extraArgs);
};
users = {