1
0
Fork 0

allow specifying backend domain for frontend and remove check for cfg.enable as default for component.enable is cfg.enable

This commit is contained in:
chaos 2023-10-01 18:42:26 +01:00
parent 17ca4470ee
commit 8266f2c22a
No known key found for this signature in database
6 changed files with 13 additions and 7 deletions

View file

@ -27,6 +27,8 @@
jdk = final.openjdk19; jdk = final.openjdk19;
}; };
piped-proxy = final.callPackage ./packages/proxy {}; piped-proxy = final.callPackage ./packages/proxy {};
piped-proxy-full = piped-proxy.override {withAVIF = true;};
piped-proxy-full-openssl = piped-proxy-full.override {withOpenSSL = true;};
piped-proxy-openssl = piped-proxy.override {withOpenSSL = true;}; piped-proxy-openssl = piped-proxy.override {withOpenSSL = true;};
piped-proxy-minimal = piped-proxy.override { piped-proxy-minimal = piped-proxy.override {
withAVIF = false; withAVIF = false;
@ -51,6 +53,7 @@
inherit (pkgs) piped-frontend; inherit (pkgs) piped-frontend;
inherit (pkgs) piped-backend; inherit (pkgs) piped-backend;
inherit (pkgs) piped-proxy piped-proxy-openssl; inherit (pkgs) piped-proxy piped-proxy-openssl;
inherit (pkgs) piped-proxy-full piped-proxy-full-openssl;
inherit (pkgs) piped-proxy-minimal piped-proxy-minimal-openssl; inherit (pkgs) piped-proxy-minimal piped-proxy-minimal-openssl;
}; };
}); });

View file

@ -89,7 +89,7 @@
writeText "config.properties" writeText "config.properties"
(cfgToString backendConfigAttrs); (cfgToString backendConfigAttrs);
in { in {
config = mkIf (cfg.enable && backendConfig.enable) { config = mkIf (backendConfig.enable) {
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /run/piped-backend - piped piped" "d /run/piped-backend - piped piped"
"f /run/piped-backend/config.properties 660 piped piped" "f /run/piped-backend/config.properties 660 piped piped"

View file

@ -24,7 +24,11 @@ in {
type = types.str; type = types.str;
description = "Domain where the frontend will be displayed"; description = "Domain where the frontend will be displayed";
}; };
backendDomain = mkOption {
type = types.str;
default = cfg.backend.domain;
description = "Domain of the backend";
};
nginx = { nginx = {
forceSSL = mkOption { forceSSL = mkOption {
type = types.bool; type = types.bool;

View file

@ -7,15 +7,14 @@
cfg = config.services.piped; cfg = config.services.piped;
backendConfig = cfg.backend;
frontendConfig = cfg.frontend; frontendConfig = cfg.frontend;
nginxConfig = frontendConfig.nginx; nginxConfig = frontendConfig.nginx;
frontendPackage = frontendConfig.package.override { frontendPackage = frontendConfig.package.override {
backendDomain = backendConfig.domain; backendDomain = cfg.backendDomain;
}; };
in { in {
config = mkIf (cfg.enable && frontendConfig.enable) { config = mkIf (frontendConfig.enable) {
# https://github.com/TeamPiped/Piped/blob/master/docker/nginx.conf # https://github.com/TeamPiped/Piped/blob/master/docker/nginx.conf
services.nginx = { services.nginx = {
enable = true; enable = true;

View file

@ -30,7 +30,7 @@
access_log off; access_log off;
''; '';
in { in {
config = mkIf (cfg.enable && proxyConfig.enable) { config = mkIf (proxyConfig.enable) {
systemd.services.piped-proxy = { systemd.services.piped-proxy = {
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
environment.BIND = "0.0.0.0:${toString proxyConfig.internalPort}"; environment.BIND = "0.0.0.0:${toString proxyConfig.internalPort}";

View file

@ -8,7 +8,7 @@
withOpenSSL ? false, withOpenSSL ? false,
withMimalloc ? true, withMimalloc ? true,
withWebP ? true, withWebP ? true,
withAVIF ? true, withAVIF ? false,
}: let }: let
meta = builtins.fromJSON (builtins.readFile ../../meta.json); meta = builtins.fromJSON (builtins.readFile ../../meta.json);
rev = meta.proxy.rev; rev = meta.proxy.rev;