Commit b45bb628 authored by Benjamin Staffin's avatar Benjamin Staffin Committed by Jade Lovelace
Browse files

nixos/oauth2_proxy: Conditionally depend on keycloak.service



Co-Authored-By: default avatarJade Lovelace <software@lfcode.ca>
parent 64c94bd4
Loading
Loading
Loading
Loading
+16 −14
Original line number Diff line number Diff line
@@ -577,12 +577,15 @@ in

    users.groups.oauth2-proxy = {};

    systemd.services.oauth2-proxy = {
    systemd.services.oauth2-proxy =
      let needsKeycloak = lib.elem cfg.provider ["keycloak" "keycloak-oidc"]
                          && config.services.keycloak.enable;
      in {
        description = "OAuth2 Proxy";
        path = [ cfg.package ];
        wantedBy = [ "multi-user.target" ];
      wants = [ "network-online.target" ];
      after = [ "network-online.target" ];
        wants = [ "network-online.target" ] ++ lib.optionals needsKeycloak [ "keycloak.service" ];
        after = [ "network-online.target" ] ++ lib.optionals needsKeycloak [ "keycloak.service" ];

        serviceConfig = {
          User = "oauth2-proxy";
@@ -591,6 +594,5 @@ in
          EnvironmentFile = lib.mkIf (cfg.keyFile != null) cfg.keyFile;
        };
      };

  };
}