unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Bruno Victal <mirai@makinata.eu>
To: 61744@debbugs.gnu.org
Cc: Bruno Victal <mirai@makinata.eu>
Subject: [bug#61744] [PATCH v2 1/2] services: base: Deprecate 'pam-limits-service' procedure.
Date: Sat,  4 Mar 2023 21:17:38 +0000	[thread overview]
Message-ID: <47849c839cb8acb6909eccd1f050b0316373b377.1677964609.git.mirai@makinata.eu> (raw)
In-Reply-To: <d319522cc9ff3ca759a5d1ebd8d57d7165e4bdc5.1677197399.git.mirai@makinata.eu>

* doc/guix.texi (Base Services): Replace pam-limits-service with pam-limits-service-type.
* gnu/packages/benchmark.scm (python-locust)[description]: Update index anchor to manual.
* gnu/services/base.scm (pam-limits-service-type): Set default value.
(pam-limits-service): Deprecate procedure.
---
 doc/guix.texi              | 37 ++++++++++++++++++++++---------------
 gnu/packages/benchmark.scm |  2 +-
 gnu/services/base.scm      |  8 +++++---
 3 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 74658dbc86..3aa9c0cdf4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18938,7 +18938,6 @@ Base Services
 @end table
 @end deftp
 
-@anchor{pam-limits-service}
 @cindex session limits
 @cindex ulimit
 @cindex priority
@@ -18946,22 +18945,28 @@ Base Services
 @cindex jackd
 @cindex nofile
 @cindex open file descriptors
-@deffn {Scheme Procedure} pam-limits-service [#:limits @code{'()}]
-
-Return a service that installs a configuration file for the
+@anchor{pam-limits-service-type}
+@defvar pam-limits-service-type
+Type of the service that installs a configuration file for the
 @uref{http://linux-pam.org/Linux-PAM-html/sag-pam_limits.html,
-@code{pam_limits} module}.  The procedure optionally takes a list of
-@code{pam-limits-entry} values, which can be used to specify
-@code{ulimit} limits and @code{nice} priority limits to user sessions.
+@code{pam_limits} module}.  The value for this service type is
+a file-like object containing a list of @code{pam-limits-entry} values
+which can be used to specify @code{ulimit} limits and @code{nice}
+priority limits to user sessions.
 
 The following limits definition sets two hard and soft limits for all
 login sessions of users in the @code{realtime} group:
 
 @lisp
-(pam-limits-service
- (list
-  (pam-limits-entry "@@realtime" 'both 'rtprio 99)
-  (pam-limits-entry "@@realtime" 'both 'memlock 'unlimited)))
+(service
+  pam-limits-service-type
+  (plain-file
+    "limits.conf"
+    (string-join
+      (map pam-limits-entry->string
+        (list (pam-limits-entry "@@realtime" 'both 'rtprio 99)
+              (pam-limits-entry "@@realtime" 'both 'memlock 'unlimited)))
+      "\n")))
 @end lisp
 
 The first entry increases the maximum realtime priority for
@@ -18973,9 +18978,11 @@ Base Services
 descriptors that can be used:
 
 @lisp
-(pam-limits-service
- (list
-  (pam-limits-entry "*" 'both 'nofile 100000)))
+(service
+  pam-limits-service-type
+  (plain-file
+    "limits.conf"
+    (pam-limits-entry->string (pam-limits-entry "*" 'both 'nofile 100000))))
 @end lisp
 
 In the above example, the asterisk means the limit should apply to any
@@ -18984,7 +18991,7 @@ Base Services
 else the users would be prevented from login in.  For more information
 about the Pluggable Authentication Module (PAM) limits, refer to the
 @samp{pam_limits} man page from the @code{linux-pam} package.
-@end deffn
+@end defvar
 
 @defvar greetd-service-type
 @uref{https://git.sr.ht/~kennylevinsen/greetd, @code{greetd}} is a minimal and
diff --git a/gnu/packages/benchmark.scm b/gnu/packages/benchmark.scm
index 33e2466da9..fd8513f41d 100644
--- a/gnu/packages/benchmark.scm
+++ b/gnu/packages/benchmark.scm
@@ -458,7 +458,7 @@ (define-public python-locust
 
 Note: Locust will complain if the available open file descriptors limit for
 the user is too low.  To raise such limit on a Guix System, refer to
-@samp{info guix --index-search=pam-limits-service}.")
+@samp{info guix --index-search=pam-limits-service-type}.")
     (license license:expat)))
 
 (define-public interbench
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 1423ab6767..e5023b8175 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -246,7 +246,7 @@ (define-module (gnu services base)
             kmscon-service-type
 
             pam-limits-service-type
-            pam-limits-service
+            pam-limits-service  ; deprecated
 
             greetd-service-type
             greetd-configuration
@@ -1612,9 +1612,11 @@ (define pam-limits-service-type
      (description
       "Install the specified resource usage limits by populating
 @file{/etc/security/limits.conf} and using the @code{pam_limits}
-authentication module."))))
+authentication module.")
+     (default-value (plain-file "limits.conf" "")))))
 
-(define* (pam-limits-service #:optional (limits '()))
+(define-deprecated (pam-limits-service #:optional (limits '()))
+  pam-limits-service-type
   "Return a service that makes selected programs respect the list of
 pam-limits-entry specified in LIMITS via pam_limits.so."
   (service pam-limits-service-type
-- 
2.39.1





  reply	other threads:[~2023-03-04 21:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  0:12 [bug#61744] [PATCH] services: base: Deprecate 'pam-limits-service' procedure Bruno Victal
2023-03-04 21:17 ` Bruno Victal [this message]
2023-03-04 21:17   ` [bug#61744] [PATCH v2 2/2] services: pam-limits-service-type: Deprecate file-like object support in favour for lists as service value Bruno Victal
2023-03-10 17:52 ` [bug#61744] [PATCH v2 1/2] services: base: Deprecate 'pam-limits-service' procedure Ricardo Wurmus
2023-03-11 11:25   ` Bruno Victal
2023-03-30 21:08     ` bug#61744: [PATCH] " Ludovic Courtès
2023-03-20 17:49 ` [bug#61744] " Felix Lechner via Guix-patches via
2023-03-30 20:53   ` Ludovic Courtès
2023-03-30 21:19     ` Felix Lechner via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47849c839cb8acb6909eccd1f050b0316373b377.1677964609.git.mirai@makinata.eu \
    --to=mirai@makinata.eu \
    --cc=61744@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).