Subject: [PATCH core-updates 15/15] system: pam: Only add linux-pam reference if on Linux.

From: Josselin Poiret <[email-masked]>
Date: Mon, 20 Mar 2023 23:10:51 +0100

* gnu/system/pam.scm (pam-root-service-type): Do it.
---
 gnu/system/pam.scm | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/gnu/system/pam.scm b/gnu/system/pam.scm
index b635681642..8408e33c3f 100644
--- a/gnu/system/pam.scm
+++ b/gnu/system/pam.scm
@@ -20,6 +20,7 @@ (define-module (gnu system pam)
   #:use-module (guix records)
   #:use-module (guix derivations)
   #:use-module (guix gexp)
+  #:use-module (guix utils)
   #:use-module (gnu services)
   #:use-module (gnu system setuid)
   #:use-module (ice-9 match)
@@ -377,12 +378,15 @@ (define (extend-configuration initial extensions)
 (define pam-root-service-type
   (service-type (name 'pam)
                 (extensions
-                 (list (service-extension
-                        setuid-program-service-type
-                        (lambda (_)
-                          (list (file-like->setuid-program
-                                 (file-append linux-pam "/sbin/unix_chkpwd")))))
-                       (service-extension etc-service-type /etc-entry)))
+                 (cons (service-extension etc-service-type /etc-entry)
+                       (if (target-linux? (or (%current-target-system)
+                                              (%current-system)))
+                           (list (service-extension
+                                  setuid-program-service-type
+                                  (lambda (_)
+                                    (list (file-like->setuid-program
+                                           (file-append linux-pam "/sbin/unix_chkpwd"))))))
+                           '())))
 
                 ;; Arguments include <pam-service> as well as procedures.
                 (compose concatenate)
-- 
2.39.2