refactor
This commit is contained in:
41
modules/services/invidious.nix
Normal file
41
modules/services/invidious.nix
Normal file
@@ -0,0 +1,41 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.modules.services.invidious;
|
||||
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
||||
in
|
||||
{
|
||||
options.modules.services.invidious = {
|
||||
enable = lib.mkEnableOption "Enable Invidious";
|
||||
subdomain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 3000;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.invidious = {
|
||||
enable = true;
|
||||
domain = fqdn;
|
||||
address = "127.0.0.1";
|
||||
inherit (cfg) port;
|
||||
|
||||
settings = {
|
||||
external_port = 443;
|
||||
db = {
|
||||
dbname = "invidious";
|
||||
user = "invidious";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.postgresql.enable = lib.mkDefault true;
|
||||
|
||||
modules.services.webserver = {
|
||||
enable = lib.mkDefault true;
|
||||
vHosts.${fqdn}.locations."/".proxyPort = cfg.port;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user