lol

nixos/outline: add discord auth

authored by

MiaFoxcat and committed by
Cabia Rangris
ab475572 130291bc

+48
+48
nixos/modules/services/web-apps/outline.nix
··· 294 294 ); 295 295 }; 296 296 297 + discordAuthentication = lib.mkOption { 298 + description = '' 299 + To configure Discord auth, you'll need to create an application at 300 + https://discord.com/developers/applications/ 301 + 302 + See https://docs.getoutline.com/s/hosting/doc/discord-g4JdWFFub6 303 + for details on setting up your Discord app. 304 + ''; 305 + default = null; 306 + type = lib.types.nullOr ( 307 + lib.types.submodule { 308 + options = { 309 + clientId = lib.mkOption { 310 + type = lib.types.str; 311 + description = "Authentication client identifier."; 312 + }; 313 + clientSecretFile = lib.mkOption { 314 + type = lib.types.str; 315 + description = "File path containing the authentication secret."; 316 + }; 317 + serverId = lib.mkOption { 318 + type = lib.types.str; 319 + default = ""; 320 + description = '' 321 + Restrict logins to a specific server (optional, but recommended). 322 + You can find a Discord server's ID by right-clicking the server icon, 323 + and select “Copy Server ID”. 324 + ''; 325 + }; 326 + serverRoles = lib.mkOption { 327 + type = lib.types.commas; 328 + default = ""; 329 + description = "Optionally restrict logins to a comma-separated list of role IDs"; 330 + }; 331 + }; 332 + } 333 + ); 334 + }; 335 + 297 336 oidcAuthentication = lib.mkOption { 298 337 description = '' 299 338 To configure generic OIDC auth, you'll need some kind of identity ··· 721 760 SLACK_MESSAGE_ACTIONS = builtins.toString cfg.slackIntegration.messageActions; 722 761 }) 723 762 763 + (lib.mkIf (cfg.discordAuthentication != null) { 764 + DISCORD_CLIENT_ID = cfg.discordAuthentication.clientId; 765 + DISCORD_SERVER_ID = cfg.discordAuthentication.serverId; 766 + DISCORD_SERVER_ROLES = cfg.discordAuthentication.serverRoles; 767 + }) 768 + 724 769 (lib.mkIf (cfg.smtp != null) { 725 770 SMTP_HOST = cfg.smtp.host; 726 771 SMTP_PORT = builtins.toString cfg.smtp.port; ··· 759 804 ''} 760 805 ${lib.optionalString (cfg.oidcAuthentication != null) '' 761 806 export OIDC_CLIENT_SECRET="$(head -n1 ${lib.escapeShellArg cfg.oidcAuthentication.clientSecretFile})" 807 + ''} 808 + ${lib.optionalString (cfg.discordAuthentication != null) '' 809 + export DISCORD_CLIENT_SECRET="$(head -n1 ${lib.escapeShellArg cfg.discordAuthentication.clientSecretFile})" 762 810 ''} 763 811 ${lib.optionalString (cfg.sslKeyFile != null) '' 764 812 export SSL_KEY="$(head -n1 ${lib.escapeShellArg cfg.sslKeyFile})"