1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-08 19:45:42 +03:00

nixos/oauth2_proxy: Conditionally depend on keycloak.service

Co-Authored-By: Jade Lovelace <software@lfcode.ca>
This commit is contained in:
Benjamin Staffin 2023-08-21 20:04:48 -04:00 committed by Jade Lovelace
parent 64c94bd40a
commit b45bb628ea

View file

@ -577,20 +577,22 @@ in
users.groups.oauth2-proxy = {};
systemd.services.oauth2-proxy = {
description = "OAuth2 Proxy";
path = [ cfg.package ];
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
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" ] ++ lib.optionals needsKeycloak [ "keycloak.service" ];
after = [ "network-online.target" ] ++ lib.optionals needsKeycloak [ "keycloak.service" ];
serviceConfig = {
User = "oauth2-proxy";
Restart = "always";
ExecStart = "${cfg.package}/bin/oauth2-proxy ${configString}";
EnvironmentFile = lib.mkIf (cfg.keyFile != null) cfg.keyFile;
serviceConfig = {
User = "oauth2-proxy";
Restart = "always";
ExecStart = "${cfg.package}/bin/oauth2-proxy ${configString}";
EnvironmentFile = lib.mkIf (cfg.keyFile != null) cfg.keyFile;
};
};
};
};
}