about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorKim Lindberger <kim.lindberger@gmail.com>2023-12-07 12:07:49 +0100
committerGitHub <noreply@github.com>2023-12-07 12:07:49 +0100
commit9ec830423e680c6822f38258cc0c93518de45acf (patch)
tree148a85e0c84741b6f4f28e5e54f0ec35a393857d /nixos
parentd901c3c5fcae2b2bd1859537233332a78db827af (diff)
parent4b0b3413b48d303bfd5714c7161cb3a574bee38f (diff)
downloadnixlib-9ec830423e680c6822f38258cc0c93518de45acf.tar
nixlib-9ec830423e680c6822f38258cc0c93518de45acf.tar.gz
nixlib-9ec830423e680c6822f38258cc0c93518de45acf.tar.bz2
nixlib-9ec830423e680c6822f38258cc0c93518de45acf.tar.lz
nixlib-9ec830423e680c6822f38258cc0c93518de45acf.tar.xz
nixlib-9ec830423e680c6822f38258cc0c93518de45acf.tar.zst
nixlib-9ec830423e680c6822f38258cc0c93518de45acf.zip
Merge pull request #267906 from talyz/keycloak-hostname-url
nixos/keycloak: Allow setting `hostname-url`
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/web-apps/keycloak.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/nixos/modules/services/web-apps/keycloak.nix b/nixos/modules/services/web-apps/keycloak.nix
index 5d44bdee64a7..6d2948913b19 100644
--- a/nixos/modules/services/web-apps/keycloak.nix
+++ b/nixos/modules/services/web-apps/keycloak.nix
@@ -25,7 +25,6 @@ let
     maintainers
     catAttrs
     collect
-    splitString
     hasPrefix
     ;
 
@@ -329,7 +328,8 @@ in
             };
 
             hostname = mkOption {
-              type = str;
+              type = nullOr str;
+              default = null;
               example = "keycloak.example.com";
               description = lib.mdDoc ''
                 The hostname part of the public URL used as base for
@@ -451,7 +451,7 @@ in
 
       keycloakConfig = lib.generators.toKeyValue {
         mkKeyValue = lib.flip lib.generators.mkKeyValueDefault "=" {
-          mkValueString = v: with builtins;
+          mkValueString = v:
             if isInt v then toString v
             else if isString v then v
             else if true == v then "true"
@@ -480,6 +480,14 @@ in
             assertion = createLocalPostgreSQL -> config.services.postgresql.settings.standard_conforming_strings or true;
             message = "Setting up a local PostgreSQL db for Keycloak requires `standard_conforming_strings` turned on to work reliably";
           }
+          {
+            assertion = cfg.settings.hostname != null || cfg.settings.hostname-url or null != null;
+            message = "Setting the Keycloak hostname is required, see `services.keycloak.settings.hostname`";
+          }
+          {
+            assertion = !(cfg.settings.hostname != null && cfg.settings.hostname-url or null != null);
+            message = "`services.keycloak.settings.hostname` and `services.keycloak.settings.hostname-url` are mutually exclusive";
+          }
         ];
 
         environment.systemPackages = [ keycloakBuild ];