Fix warnings: trace: evaluation warning: The option `services.forgejo.mailerPasswordFile' defined in `/nix/store/13vqhb5askjgi07wqwxawq4bdm7h0wc7-source/flake.nix, via option flake.nixosModules.forgejo' has been renamed to `services.forgejo.secrets.mailer.PASSWD'. trace: evaluation warning: Using `services.nextcloud.config.dbtableprefix` is deprecated. Fresh installations with this option set are not allowed anymore since v20. If you have an existing installation with a custom table prefix, make sure it is set correctly in `config.php` and remove the option from your NixOS config. Fix errors: - The option definition `services.matrix-sliding-sync' in `/nix/store/wgxgv8rjbd2nhf7y28kfzm4n6kz85dnq-source/flake.nix, via option flake.nixosModules.matrix' no longer has any effect; please remove it. The matrix-sliding-sync package has been removed, since matrix-synapse incorporated its functionality - The option `services.keycloak.settings.proxy' has been removed. Set `services.keycloak.settings.proxy-headers` in combination with other hostname options as needed instead. See [Proxy option removed](https://www.keycloak.org/docs/latest/upgrading/index.html#proxy-option-removed) for more information. error: The option `services.matrix-appservice-irc.settings.ircService.mediaProxy.publicUrl' was accessed but has no value defined. Try setting the option.
81 lines
2 KiB
Nix
81 lines
2 KiB
Nix
{
|
|
flake,
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
options.pub-solar-os.auth = with lib; {
|
|
enable = mkEnableOption "Enable keycloak to run on the node";
|
|
|
|
realm = mkOption {
|
|
description = "Name of the realm";
|
|
type = types.str;
|
|
default = config.pub-solar-os.networking.domain;
|
|
};
|
|
|
|
database-password-file = mkOption {
|
|
description = "Database password file path";
|
|
type = types.str;
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf config.pub-solar-os.auth.enable {
|
|
services.nginx.virtualHosts."auth.${config.pub-solar-os.networking.domain}" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
|
|
locations = {
|
|
"= /" = {
|
|
extraConfig = ''
|
|
return 302 /realms/${config.pub-solar-os.auth.realm}/account;
|
|
'';
|
|
};
|
|
|
|
"/" = {
|
|
extraConfig = ''
|
|
proxy_pass http://127.0.0.1:8080;
|
|
proxy_buffer_size 8k;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
# keycloak
|
|
services.keycloak = {
|
|
enable = true;
|
|
database.passwordFile = config.pub-solar-os.auth.database-password-file;
|
|
settings = {
|
|
hostname = "auth.${config.pub-solar-os.networking.domain}";
|
|
http-host = "127.0.0.1";
|
|
http-port = 8080;
|
|
proxy-headers = "xforwarded";
|
|
http-enabled = true;
|
|
};
|
|
themes = {
|
|
"pub.solar" =
|
|
flake.inputs.keycloak-theme-pub-solar.legacyPackages.${pkgs.system}.keycloak-theme-pub-solar;
|
|
};
|
|
};
|
|
|
|
pub-solar-os.backups.restic.keycloak = {
|
|
paths = [ "/tmp/keycloak-backup.sql" ];
|
|
timerConfig = {
|
|
OnCalendar = "*-*-* 03:00:00 Etc/UTC";
|
|
};
|
|
initialize = true;
|
|
backupPrepareCommand = ''
|
|
${pkgs.sudo}/bin/sudo -u postgres ${pkgs.postgresql}/bin/pg_dump -d keycloak > /tmp/keycloak-backup.sql
|
|
'';
|
|
backupCleanupCommand = ''
|
|
rm /tmp/keycloak-backup.sql
|
|
'';
|
|
pruneOpts = [
|
|
"--keep-daily 7"
|
|
"--keep-weekly 4"
|
|
"--keep-monthly 3"
|
|
];
|
|
};
|
|
};
|
|
}
|