From 1bd88ce3dfda0bdbc0bec3ad6692ecd553e9a3e7 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 5 Dec 2023 09:20:13 +0100 Subject: [PATCH] services: nginx: use enable option conditional enabling caused circular dependencies somehow --- services/nginx.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/nginx.nix b/services/nginx.nix index d84425c..6781549 100644 --- a/services/nginx.nix +++ b/services/nginx.nix @@ -9,12 +9,19 @@ }: let inherit (lib) + mkEnableOption mkIf ; + + cfg = config.my.services.nginx; in { + options.my.services.nginx = { + enable = mkEnableOption "Nginx reverse proxy"; + }; + # Whenever something defines an nginx vhost, ensure that nginx defaults are # properly set. - config = mkIf ((builtins.attrNames config.services.nginx.virtualHosts) != ["localhost"]) { + config = mkIf (cfg.enable) { services.nginx = { enable = true; statusPage = true; # For monitoring scraping.