From unknown Wed Jun 18 23:05:27 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#27474 <27474@debbugs.gnu.org> To: bug#27474 <27474@debbugs.gnu.org> Subject: Status: [PATCH] services: Add 'sysctl-service-type'. Reply-To: bug#27474 <27474@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:05:27 +0000 retitle 27474 [PATCH] services: Add 'sysctl-service-type'. reassign 27474 guix-patches submitter 27474 =E5=AE=8B=E6=96=87=E6=AD=A6 severity 27474 normal tag 27474 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 24 10:29:37 2017 Received: (at submit) by debbugs.gnu.org; 24 Jun 2017 14:29:37 +0000 Received: from localhost ([127.0.0.1]:35800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOm49-0006MN-5O for submit@debbugs.gnu.org; Sat, 24 Jun 2017 10:29:37 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOm44-0006M8-VH for submit@debbugs.gnu.org; Sat, 24 Jun 2017 10:29:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOm3y-0001lW-Df for submit@debbugs.gnu.org; Sat, 24 Jun 2017 10:29:27 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dOm3y-0001lK-AF for submit@debbugs.gnu.org; Sat, 24 Jun 2017 10:29:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOm3w-0001oi-Qw for guix-patches@gnu.org; Sat, 24 Jun 2017 10:29:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOm3t-0001i8-2w for guix-patches@gnu.org; Sat, 24 Jun 2017 10:29:24 -0400 Received: from lb1.openmailbox.org ([5.79.108.160]:60914 helo=mail.openmailbox.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dOm3s-0001h6-MX for guix-patches@gnu.org; Sat, 24 Jun 2017 10:29:21 -0400 Received: by mail.openmailbox.org (Postfix, from userid 20002) id 24EEC507BC4; Sat, 24 Jun 2017 16:29:13 +0200 (CEST) Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id a2e01df0; Sat, 24 Jun 2017 14:17:18 +0000 (UTC) From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= To: guix-patches@gnu.org Subject: [PATCH] services: Add 'sysctl-service-type'. Date: Sat, 24 Jun 2017 22:17:17 +0800 Message-Id: <20170624141717.28010-1-iyzsong@member.fsf.org> X-Mailer: git-send-email 2.12.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) * gnu/services/sysctl.scm: New file. * doc/guix.texi (Miscellaneous Services): Document it. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- doc/guix.texi | 29 +++++++++++++++++++ gnu/local.mk | 1 + gnu/services/sysctl.scm | 77 +++++++++++++++++++++++++++++++++++++++++++= ++++++ 3 files changed, 107 insertions(+) create mode 100644 gnu/services/sysctl.scm diff --git a/doc/guix.texi b/doc/guix.texi index 729ec081b..c2652a61c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -15277,6 +15277,35 @@ Package object of thermald. @node Miscellaneous Services @subsubsection Miscellaneous Services =20 +@cindex sysctl +@subsubheading System Control Service + +The @code{(gnu services sysctl)} provides a service to configure kernel +parameters at boot. + +@defvr {Scheme Variable} sysctl-service-type +The service type for @command{sysctl}, which modifies kernel parameters +under @file{/proc/sys/}. To enable IPv4 forwarding, it can be +instantiated as: + +@example +(service sysctl-service-type + (sysctl-configuration + (settings '(("net.ipv4.ip_forward" . "1"))))) +@end example +@end defvr + +@deftp {Data Type} sysctl-configuration +The data type representing the configuration of @command{sysctl}. + +@table @asis +@item @code{sysctl} (default: @code{(file-append procps "/sbin/sysctl"}) +The @command{sysctl} executable to use. + +@item @code{settings} (default: @code{'()}) +An association list specifies kernel parameters and their values. +@end table +@end deftp =20 @cindex lirc @subsubheading Lirc Service diff --git a/gnu/local.mk b/gnu/local.mk index a4b29d5fd..ee63f0f20 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -442,6 +442,7 @@ GNU_SYSTEM_MODULES =3D \ %D%/services/sddm.scm \ %D%/services/spice.scm \ %D%/services/ssh.scm \ + %D%/services/sysctl.scm \ %D%/services/version-control.scm \ %D%/services/vpn.scm \ %D%/services/web.scm \ diff --git a/gnu/services/sysctl.scm b/gnu/services/sysctl.scm new file mode 100644 index 000000000..be5be59a0 --- /dev/null +++ b/gnu/services/sysctl.scm @@ -0,0 +1,77 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2017 Sou Bunnbu +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (a= t +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu services sysctl) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (gnu packages linux) + #:use-module (guix gexp) + #:use-module (guix records) + #:use-module (srfi srfi-1) + #:use-module (ice-9 match) + #:export (sysctl-configuration + sysctl-service-type)) + +=0C +;;; +;;; System Control Service. +;;; + +(define-record-type* + sysctl-configuration make-sysctl-configuration? + sysctl-configuration? + (sysctl sysctl-configuration-sysctl ; path of the 'sysctl' comman= d + (default (file-append procps "/sbin/sysctl"))) + (settings sysctl-configuration-settings ; alist of string pairs + (default '()))) + +(define (sysctl-configuration-settings->sysctl.conf settings) + "Return a file for @command{sysctl} to set kernel parameters as specif= ied by +@var{settings}." + (apply mixed-text-file "sysctl.conf" + (append-map (match-lambda + ((key . value) + (list key "=3D" value "\n"))) + settings))) + +(define sysctl-shepherd-service + (match-lambda + (($ sysctl settings) + (let ((sysctl.conf + (sysctl-configuration-settings->sysctl.conf settings))) + (shepherd-service + (documentation "Configure kernel parameters at boot.") + (provision '(sysctl)) + (start #~(lambda _ + (zero? (system* #$sysctl "--load" #$sysctl.conf)))) + (stop #~(const #t)) + (respawn? #f)))))) + +(define sysctl-service-type + (service-type + (name 'sysctl) + (extensions + (list (service-extension shepherd-root-service-type + (compose list sysctl-shepherd-service)))) + (compose concatenate) + (extend (lambda (config settings) + (sysctl-configuration + (inherit config) + (settings (append (sysctl-configuration-settings config) + settings))))) + (default-value (sysctl-configuration)))) --=20 2.12.2 From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 04 09:16:13 2017 Received: (at 27474-done) by debbugs.gnu.org; 4 Jul 2017 13:16:13 +0000 Received: from localhost ([127.0.0.1]:51263 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSNgb-0002OT-8p for submit@debbugs.gnu.org; Tue, 04 Jul 2017 09:16:13 -0400 Received: from lb1.openmailbox.org ([5.79.108.160]:44397 helo=mail.openmailbox.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSNgZ-0002OL-7m for 27474-done@debbugs.gnu.org; Tue, 04 Jul 2017 09:16:11 -0400 Received: by mail.openmailbox.org (Postfix, from userid 20002) id C7709523E77; Tue, 4 Jul 2017 14:52:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ZDZR003 X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED, TVD_SPACE_RATIO, T_HEADER_FROM_DIFFERENT_DOMAINS autolearn=disabled version=3.4.0 Received: from gift (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 20af95b2 for <27474-done@debbugs.gnu.org>; Tue, 4 Jul 2017 12:45:39 +0000 (UTC) From: iyzsong@member.fsf.org (=?utf-8?B?5a6L5paH5q2m?=) To: 27474-done@debbugs.gnu.org Subject: pushed Date: Tue, 04 Jul 2017 20:45:39 +0800 In-Reply-To: bug's message of "Tue\, 04 Jul 2017 12\:43\:51 +0000" Message-ID: <878tk44bgs.fsf@member.fsf.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 27474-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Pushed as 296bf4d5ab1cf7822956205b6d266c2c67ce056c. From unknown Wed Jun 18 23:05:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 02 Aug 2017 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator