Subject: [bug#77001] [PATCH 7/8] services: kerberos: Fix order of definitions.

From: Tomas Volf <[email-masked]>
Date: Thu, 13 Mar 2025 23:19:50 +0100

Generating the configuration file would error out with error stating:

    Wrong type to apply: #<syntax-transformer krb5-realm?>

Moving the procedures below the respective define-configuration fixes that.

* gnu/services/kerberos.scm (realm-list?, serialize-realm-list): Move below
define-configuration for krb5-realm.

Change-Id: I6a520a92cdc3c42d3916cdf33d427dadc531e7d1
---
 gnu/services/kerberos.scm | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index b423534ec2..1e826a1455 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -169,23 +169,6 @@ (define (serialize-free-form-fields field-name val)
 
 (define non-negative-integer/unset? (predicate/unset non-negative-integer?))
 
-(define (realm-list? val)
-  (and (list? val)
-       (and-map (lambda (x) (krb5-realm? x)) val)))
-
-(define (serialize-realm-list field-name val)
-  (format #t "\n[~a]\n" field-name)
-  (for-each (lambda (realm)
-              (format #t "\n~a = {\n" (krb5-realm-name realm))
-              (for-each (lambda (field)
-                          (unless (eq? 'name (configuration-field-name field))
-                            ((configuration-field-serializer field)
-                             (configuration-field-name field)
-                             ((configuration-field-getter field)
-                              realm)))) krb5-realm-fields)
-
-              (format #t "}\n")) val))
-
 
 
 ;; For a more detailed explanation of these fields see man 5 krb5.conf
@@ -245,6 +228,23 @@ (define-configuration krb5-realm
    "Used when the V4 realm name and the V5 realm name are not the same, but
 still share the same principal names and passwords."))
 
+(define (realm-list? val)
+  (and (list? val)
+       (and-map (lambda (x) (krb5-realm? x)) val)))
+
+(define (serialize-realm-list field-name val)
+  (format #t "\n[~a]\n" field-name)
+  (for-each (lambda (realm)
+              (format #t "\n~a = {\n" (krb5-realm-name realm))
+              (for-each (lambda (field)
+                          (unless (eq? 'name (configuration-field-name field))
+                            ((configuration-field-serializer field)
+                             (configuration-field-name field)
+                             ((configuration-field-getter field)
+                              realm)))) krb5-realm-fields)
+
+              (format #t "}\n")) val))
+

 ;; For a more detailed explanation of these fields see man 5 krb5.conf
-- 
2.48.1