From 8266f2c22a1eaa1e1433998d43d0d373f83778de Mon Sep 17 00:00:00 2001 From: chaos Date: Sun, 1 Oct 2023 18:42:26 +0100 Subject: [PATCH] allow specifying backend domain for frontend and remove check for cfg.enable as default for component.enable is cfg.enable --- flake.nix | 3 +++ module/backend.nix | 2 +- module/default.nix | 6 +++++- module/frontend.nix | 5 ++--- module/proxy.nix | 2 +- packages/proxy/default.nix | 2 +- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index 04ef44a..4ba518a 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,8 @@ jdk = final.openjdk19; }; 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-minimal = piped-proxy.override { withAVIF = false; @@ -51,6 +53,7 @@ inherit (pkgs) piped-frontend; inherit (pkgs) piped-backend; 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; }; }); diff --git a/module/backend.nix b/module/backend.nix index 3bae479..b897a11 100644 --- a/module/backend.nix +++ b/module/backend.nix @@ -89,7 +89,7 @@ writeText "config.properties" (cfgToString backendConfigAttrs); in { - config = mkIf (cfg.enable && backendConfig.enable) { + config = mkIf (backendConfig.enable) { systemd.tmpfiles.rules = [ "d /run/piped-backend - piped piped" "f /run/piped-backend/config.properties 660 piped piped" diff --git a/module/default.nix b/module/default.nix index bff22e4..8be5f28 100644 --- a/module/default.nix +++ b/module/default.nix @@ -24,7 +24,11 @@ in { type = types.str; description = "Domain where the frontend will be displayed"; }; - + backendDomain = mkOption { + type = types.str; + default = cfg.backend.domain; + description = "Domain of the backend"; + }; nginx = { forceSSL = mkOption { type = types.bool; diff --git a/module/frontend.nix b/module/frontend.nix index 5715743..fd84bc6 100644 --- a/module/frontend.nix +++ b/module/frontend.nix @@ -7,15 +7,14 @@ cfg = config.services.piped; - backendConfig = cfg.backend; frontendConfig = cfg.frontend; nginxConfig = frontendConfig.nginx; frontendPackage = frontendConfig.package.override { - backendDomain = backendConfig.domain; + backendDomain = cfg.backendDomain; }; in { - config = mkIf (cfg.enable && frontendConfig.enable) { + config = mkIf (frontendConfig.enable) { # https://github.com/TeamPiped/Piped/blob/master/docker/nginx.conf services.nginx = { enable = true; diff --git a/module/proxy.nix b/module/proxy.nix index 3bb08bc..00a7a05 100644 --- a/module/proxy.nix +++ b/module/proxy.nix @@ -30,7 +30,7 @@ access_log off; ''; in { - config = mkIf (cfg.enable && proxyConfig.enable) { + config = mkIf (proxyConfig.enable) { systemd.services.piped-proxy = { wantedBy = ["multi-user.target"]; environment.BIND = "0.0.0.0:${toString proxyConfig.internalPort}"; diff --git a/packages/proxy/default.nix b/packages/proxy/default.nix index 89b4788..3a73501 100644 --- a/packages/proxy/default.nix +++ b/packages/proxy/default.nix @@ -8,7 +8,7 @@ withOpenSSL ? false, withMimalloc ? true, withWebP ? true, - withAVIF ? true, + withAVIF ? false, }: let meta = builtins.fromJSON (builtins.readFile ../../meta.json); rev = meta.proxy.rev;