new service! amdl
This commit is contained in:
parent
5c7720f462
commit
e22d3ca314
11 changed files with 131 additions and 14 deletions
39
modules/services/amdl.nix
Normal file
39
modules/services/amdl.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ config, lib, pkgs, options, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.services.amdl;
|
||||
in {
|
||||
options.modules.services.amdl = {
|
||||
enable = mkEnableOption "enable amdl, an apple music download server";
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 3001;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = types.str;
|
||||
default = "amdl.reidlab.pink";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.amdl = {
|
||||
enable = true;
|
||||
|
||||
stateDir = "/var/lib/${cfg.domain}";
|
||||
env = {
|
||||
MEDIA_USER_TOKEN = builtins.readFile /etc/secrets/amdl/media_user_token;
|
||||
WIDEVINE_CLIENT_ID = builtins.readFile /etc/secrets/amdl/widevine_client_id;
|
||||
WIDEVINE_PRIVATE_KEY = builtins.readFile /etc/secrets/amdl/widevine_private_key;
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."${cfg.domain}" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:${toString cfg.port}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue