From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id sM2WCSyRb2eIOAEAe85BDQ:P1 (envelope-from ) for ; Sat, 28 Dec 2024 05:48:28 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id sM2WCSyRb2eIOAEAe85BDQ (envelope-from ) for ; Sat, 28 Dec 2024 06:48:28 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="O/nYumlO"; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=KVZ9S3rv; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735364908; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=ieS7i1szAbR7Dd6u3iltmXjTihP5tA9/4lBeKyvf9CE=; b=YkTCRACnvUTCYe5jYdezyY/jltc3hHIbkEOfQOUnNcIqfyy2e1zGdbKxV2tIxG8O/qjpgz 4tLadKok0+sd+ix6mrwmI2vLYdsnN6g5vSu5FmseNpBYfF1DmFK8d1k/iOUixrbfuSUvHo SVhHqwfG5oWHrKozBPkIV+dNP49GZCjowlGX3lyQ1TPAhmCuO1M6NGsaaqA0Ydz0aFoHrv QIDCmHZQl1KFBbqpqqdhmCcwXiMPgkTrH6BAXE5wiH0Fh3X5SytNjoUkoLuxPI3iD4cbuX coT6CPJ3J1HrGjWAopcBVjAhBuD2Tww1cAY87AAkxHS03IAEXyKv1s6K3bF/Tw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="O/nYumlO"; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=KVZ9S3rv; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735364908; a=rsa-sha256; cv=none; b=PfPUSK4Wlh5H9Kgvh+XTMxlQ0CfYnCrB4VUmhsFNxyC+J+dx9j7crP0SULrXC4u//r0dne BNrPiH16Iz95m9dr+xBRmArcaXWBBR6XxR/LreVIBLFl9dXNNi9MFHYQLqZWFu2fi+SNiO GJreH+V++wBgOp7DOCg3wtfoqf92rBWwOEuIoxVlE4uc7pQWBAi+uld6YZkONdoNOab0y5 h67lGduqGzNlOIsiW6jGNL08uLqX8+t/EUpigjgbn3auclM8c0WlhgIVsyAS4ljUFd8pf8 ZfffNJJQsxakAZaEY88ljqi1BxETcK6pwpYQu8swoPJLH3Kh9Sqd6qq/ylMksw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EFA2A472FB for ; Sat, 28 Dec 2024 06:48:27 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRPgC-0006JM-M6; Sat, 28 Dec 2024 00:48:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRPgA-0006J4-JT for guix-patches@gnu.org; Sat, 28 Dec 2024 00:48:02 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRPgA-0004DC-BD for guix-patches@gnu.org; Sat, 28 Dec 2024 00:48:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=ieS7i1szAbR7Dd6u3iltmXjTihP5tA9/4lBeKyvf9CE=; b=O/nYumlO8BTkIwUT3dzaXzDPNF8pMkJRRoOS8S4SFG9rJ7kKni8YF5+QBVCfe3xj7Pl108okhB6eaNPB1Y2mbNQlISv5l2nrOypbx7sQ1WtRtDced/xRr/MLcaYK85V9fQZZn+EXOepZ6MveYoQyYSRCCknHhoDIuyx+jkm9R0gt7VgmcfroCQ7o72OlvADucLGm+eETY1XQInxnxr+Be0TnaojrHn8sf8hXUjxErMVWOvNCluYfTyjBlKB/HJwKhDz3nfu0Q4ISg3Moc3C8CHgJ4ef9aVn43OLuiEDjuTR6h32YTZVEGZ6K431WN5EmzWVrgwsqavyxhJLYh8E9dw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRPg9-0008Pv-TF for guix-patches@gnu.org; Sat, 28 Dec 2024 00:48:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74819] [PATCH v4] services: elogind: Support Hook Directories Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 28 Dec 2024 05:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74819 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45mg <45mg.writes@gmail.com> Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 74819@debbugs.gnu.org Received: via spool by 74819-submit@debbugs.gnu.org id=B74819.173536487132332 (code B ref 74819); Sat, 28 Dec 2024 05:48:01 +0000 Received: (at 74819) by debbugs.gnu.org; 28 Dec 2024 05:47:51 +0000 Received: from localhost ([127.0.0.1]:48401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRPfy-0008PO-VJ for submit@debbugs.gnu.org; Sat, 28 Dec 2024 00:47:51 -0500 Received: from mail-pj1-f52.google.com ([209.85.216.52]:57759) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRPfx-0008PB-5Z for 74819@debbugs.gnu.org; Sat, 28 Dec 2024 00:47:49 -0500 Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ee9a780de4so7185539a91.3 for <74819@debbugs.gnu.org>; Fri, 27 Dec 2024 21:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735364803; x=1735969603; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=ieS7i1szAbR7Dd6u3iltmXjTihP5tA9/4lBeKyvf9CE=; b=KVZ9S3rvQhofWA3lAv9svDKGvRJF0HnHJsPAtiAprorsxtq5F+c2OQV2X9nRNGdHJ4 xnjqaagWiFOgOgOe1HYvG+MEVvH1Ih2raNaLkcwg+fYzZEvRo6h1sgv2kjPwbO1MwC6b 29HPSsK4AbGwHZbQ8sK5OqxtqQf9zU9fCqnPE4lPbkdmb9kskgwMfpzBbA5W+aa6+IA8 TBBA625slGNp8Lu0dbOeaAhHyr7e/2zG2vP7DjeofVpAUmogs/6P89a4mWmzGDjIv5AP +UzmxFe1OwyOUNzO8y4Q7yFn7mzAzHz9N+RbqYvutMIWLkIjksLidwn26REW373DGBKy y/Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735364803; x=1735969603; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ieS7i1szAbR7Dd6u3iltmXjTihP5tA9/4lBeKyvf9CE=; b=Gl37a9GmA99CIf2KZNx6ad7r/GCRwrf5V8Q9CFcEFVBogVTVxB6rHB/3zAPp2erxjW 9F/M/Es/idsLlitQFJG9ewtiR/hCz0105pZ4w+7BvgIi9AwOrTsvcN8XZE97JOaFDRSP 9YwlAm/PhOQ5Aj8zslAmPufic1NUxSH5fE4rJ4qLCFArpXLeYP6eSvMR3WWLHA4+Xr8g hXCuWbXuNcGG+VUeI1m99sfQobxt/1je6whvk45LT2G/cQju9D2Nhn1PDhgR/ne1WoXe g207APbKvjN7YtMioG9/16s6qv3RDn90hL4GQyiwcmFCygvaXTmFRN3E3E963VBtxDbB Ls3w== X-Gm-Message-State: AOJu0Yym/D0uxS2aphV+yKwa10njkrJNuWwPogi0UMuGitzbiGIWJCmH OzGNUFqWNDzYUQb80wqsLaWQvNqKldtOBQwsgmg9de1yNQhc4ki+ X-Gm-Gg: ASbGncszG25xpeFdZhSFJkAEZWDGCCaNov8U+jD4HfbmxJYrneyRn9plZF48xJVURC6 xsdpUdBEJ7VT95ltoL7IZ3mGxx0stVf+2LnhjlBmgbZ4+GHMq2hpSJBtPmwk74lrdPEwqs0AaqA puqIGrqCAVbeg04e4kpgKsLegzEK/dX1n7T10fzn7ZenFSkz2ylyNC9uGi3VWV9VNdQmZNmeSKj fSDHKWk2ks53ok/DjM9+rSXTeXYIprvRDBkzXjcbRAI/ZGJ1cpxEw== X-Google-Smtp-Source: AGHT+IG7iUHGVg9QtUj0vii0p4Xfp82H3uk3zE0D+M+YxQlK798KB4rovG2/n0XDrv3DKAmc0zq85w== X-Received: by 2002:a05:6a00:4486:b0:727:d55e:4bee with SMTP id d2e1a72fcca58-72abdd4f493mr36162317b3a.1.1735364803454; Fri, 27 Dec 2024 21:46:43 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbae4sm15484154b3a.96.2024.12.27.21.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 21:46:42 -0800 (PST) From: Maxim Cournoyer In-Reply-To: <276103d4ae303592ff8ce4e83438e8c3d1c020bf.1735301702.git.45mg.writes@gmail.com> (45mg.writes@gmail.com's message of "Fri, 27 Dec 2024 07:15:02 -0500") References: <7286c9dd75c4853f5811720150c027b9d9b511d7.1734003226.git.45mg.writes@gmail.com> <276103d4ae303592ff8ce4e83438e8c3d1c020bf.1735301702.git.45mg.writes@gmail.com> Date: Sat, 28 Dec 2024 14:46:33 +0900 Message-ID: <87frm8tl52.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: EFA2A472FB X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -2.29 X-Spam-Score: -2.29 X-TUID: gqhIEXDZRPf7 Hi, 45mg <45mg.writes@gmail.com> writes: > Allow the user to specify scripts to be added into Elogind's hook > directories. These scripts will be run before/after > suspend/hibernate/poweroff/reboot. > > Also allow setting the associated config options. > > * gnu/services/desktop.scm (elogind-configuration): add > `system-sleep-hook-files`, `system-shutdown-hook-files`, > and 4 new config options. > (elogind-configuration-file): Add entries for the new config options > under the `[Sleep]` section. > (/etc/elogind): New function, to generate /etc/elogind directory. > (elogind-service-type): Extend `etc-service-type` using `/etc/elogind`. > * doc/guix.texi: Document the new options. Soods good. [...] > +(define (elogind-etc-directory config) > + "Return the /etc/elogind directory for CONFIG." > + (with-imported-modules (source-module-closure '((guix build utils))) > + (computed-file > + "etc-elogind" > + > + #~(begin > + (use-modules (guix build utils)) > + > + (define sleep-directory (string-append #$output "/system-sleep/")) > + (define shutdown-directory (string-append #$output "/system-shutdown/")) > + > + (define (copy-script file directory) > + "Copy FILE into DIRECTORY, giving rx (500) permissions." > + (let ((dest (string-append directory "/" (basename file)))) > + (mkdir-p directory) > + (copy-file file dest) > + (chmod dest #o500))) > + > + (mkdir-p #$output) ; in case neither directory gets created Unimportant nitpick: please keep more than 2 spaces between the code and a comment (I use M-; in Emacs to do so); also prefer to avoid the space between ';' and the comment for in-line comment only (that's a 'may', not a 'must' according to our referenced style guide [0] though). [0] https://mumble.net/~campbell/scheme/style.txt > + (for-each > + (lambda (f) (copy-script f sleep-directory)) I've move the copy-script on its own line under the lambda, which is more conventional. > + '#$(elogind-system-sleep-hook-files config))j > + (for-each > + (lambda (f) (copy-script f shutdown-directory)) Likewise. Other than these tiny cosmetic things, it LGTM: Reviewed-by: Maxim Cournoyer -- Thanks, Maxim