From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 8J+eMJBMvV7pXwAA0tVLHw (envelope-from ) for ; Thu, 14 May 2020 13:50:08 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id kO/hKpBMvV7uHgAA1q6Kng (envelope-from ) for ; Thu, 14 May 2020 13:50:08 +0000 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 C7FF0940607 for ; Thu, 14 May 2020 13:50:05 +0000 (UTC) Received: from localhost ([::1]:60224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZEFR-0007Ni-UM for larch@yhetil.org; Thu, 14 May 2020 09:50:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEFO-0007MK-Bw for guix-patches@gnu.org; Thu, 14 May 2020 09:50:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49153) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZEFO-0006UR-2G for guix-patches@gnu.org; Thu, 14 May 2020 09:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZEFN-0003ln-UL for guix-patches@gnu.org; Thu, 14 May 2020 09:50:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41259] [PATCH] etc: Add a systemd unit to bind-mount @storedir@ read-only. Resent-From: Tobias Geerinckx-Rice Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 May 2020 13:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41259 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41259@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158946415514416 (code B ref -1); Thu, 14 May 2020 13:50:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 May 2020 13:49:15 +0000 Received: from localhost ([127.0.0.1]:60699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZEEX-0003kJ-P4 for submit@debbugs.gnu.org; Thu, 14 May 2020 09:49:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:59236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZEES-0003k8-C5 for submit@debbugs.gnu.org; Thu, 14 May 2020 09:49:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEES-0007JR-4p for guix-patches@gnu.org; Thu, 14 May 2020 09:49:04 -0400 Received: from tobias.gr ([2a02:c205:2020:6054::1]:41504) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZEEN-0006GS-7I for guix-patches@gnu.org; Thu, 14 May 2020 09:49:03 -0400 Received: by tobias.gr (OpenSMTPD) with ESMTP id 9ce5d4d9 for ; Thu, 14 May 2020 13:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=tobias.gr; h=from:to :subject:date:message-id:mime-version:content-transfer-encoding; s=2018; i=me@tobias.gr; bh=xgc+nzsdeOC1rDBHOHqeTlft0tjSAcIlEwnc CAyVFBM=; b=RL9m0Thipb+SQ9KWvxxgTolkGGA0x1UOOrz4wC2JliM8HboxwG1k GFj2hfCh/WITEO4ohaoiYaJjlt0aJDr5vhq/JOMJrxkJWMqlxtvMkNIgjwUHHMLM yErmd2lChO00UG0VbOgNRtPyLqofvob7aeIlZ7HdcH0H+gE0VM+dz2pkW//np59J jGsA2FIXvdIXjKkRPfMyWoBwm8QQUU9qvKHeFPpRlCpmMrgsgLDnzjSnqXcK1POw mpfRcGz9gaiOf2KIF9P13FyC8kPMSuGe1+wcg0Okwijm+s+obc9P7dFfVvfxRMg6 p8LilHCehaK+LG/Pa/e2xZbesVq4Uwjq3g== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id ea89ff14 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Thu, 14 May 2020 13:48:55 +0000 (UTC) Date: Thu, 14 May 2020 15:48:46 +0200 Message-Id: <20200514134846.29037-1-me@tobias.gr> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a02:c205:2020:6054::1; envelope-from=me@tobias.gr; helo=tobias.gr X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -0.1 (/) 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" Reply-to: Tobias Geerinckx-Rice , Tobias Geerinckx-Rice via Guix-patches From: Tobias Geerinckx-Rice via Guix-patches via X-Scanner: scn0 X-Spam-Score: 5.49 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=tobias.gr header.s=2018 header.b=RL9m0Thi; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Scan-Result: default: False [5.49 / 13.00]; HAS_REPLYTO(0.00)[me@tobias.gr]; GENERIC_REPUTATION(0.00)[-0.53844611383715]; MX_INVALID(1.00)[cached]; DWL_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; R_DKIM_REJECT(1.00)[tobias.gr:s=2018]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; TO_DN_NONE(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.05), country: US(-0.00), ip: 209.51.188.17(-0.54)]; DKIM_TRACE(0.00)[tobias.gr:-]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[guix-patches@gnu.org,guix-patches-bounces@gnu.org]; ARC_NA(0.00)[]; URIBL_BLOCKED(0.00)[gnu.org:url]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; DMARC_NA(0.00)[gnu.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; DNSWL_BLOCKED(0.00)[209.51.188.17:from]; RCVD_COUNT_SEVEN(0.00)[9]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: 2AUf+8h3wvVi * etc/gnu-store.mount.in: New file. * nix/local.mk (nodist_systemdservice_DATA): Add it. (etc/%.mount): New rule. * etc/guix-install.sh (sys_enable_guix_daemon): Install it. * doc/guix.texi (Binary Installation): Document it. --- For . doc/guix.texi | 5 +++-- etc/gnu-store.mount.in | 14 ++++++++++++++ etc/guix-install.sh | 12 +++++++++--- nix/local.mk | 12 +++++++++++- 4 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 etc/gnu-store.mount.in diff --git a/doc/guix.texi b/doc/guix.texi index d6fbd85fde..5d80a7e405 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -659,9 +659,10 @@ with these commands: @c https://lists.gnu.org/archive/html/guix-devel/2017-01/msg01199.html @example -# cp ~root/.config/guix/current/lib/systemd/system/guix-daemon.service \ +# cp ~root/.config/guix/current/lib/systemd/system/gnu-store.mount \ + ~root/.config/guix/current/lib/systemd/system/guix-daemon.service \ /etc/systemd/system/ -# systemctl enable --now guix-daemon +# systemctl enable --now gnu-store.mount guix-daemon @end example If your host distro uses the Upstart init system: diff --git a/etc/gnu-store.mount.in b/etc/gnu-store.mount.in new file mode 100644 index 0000000000..c94f2db72b --- /dev/null +++ b/etc/gnu-store.mount.in @@ -0,0 +1,14 @@ +[Unit] +Description=Read-only @storedir@ for GNU Guix +DefaultDependencies=no +ConditionPathExists=@storedir@ +Before=guix-daemon.service + +[Install] +WantedBy=guix-daemon.service + +[Mount] +What=@storedir@ +Where=@storedir@ +Type=none +Options=bind,ro diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 4909d3f162..d252c132fb 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -342,7 +342,13 @@ sys_enable_guix_daemon() _msg "${PAS}enabled Guix daemon via upstart" ;; systemd) - { cp "${ROOT_HOME}/.config/guix/current/lib/systemd/system/guix-daemon.service" \ + { # systemd .mount units must be named after the target directory. + # Here we assume a hard-coded name of /gnu/store. + cp "${ROOT_HOME}/.config/guix/current/lib/systemd/system/gnu-store.mount" \ + /etc/systemd/system/; + chmod 664 /etc/systemd/system/gnu-store.mount; + + cp "${ROOT_HOME}/.config/guix/current/lib/systemd/system/guix-daemon.service" \ /etc/systemd/system/; chmod 664 /etc/systemd/system/guix-daemon.service; @@ -357,8 +363,8 @@ sys_enable_guix_daemon() fi; systemctl daemon-reload && - systemctl start guix-daemon && - systemctl enable guix-daemon; } && + systemctl start gnu-store.mount guix-daemon && + systemctl enable gnu-store.mount guix-daemon; } && _msg "${PAS}enabled Guix daemon via systemd" ;; sysv-init) diff --git a/nix/local.mk b/nix/local.mk index a64bdd2137..435fdd389a 100644 --- a/nix/local.mk +++ b/nix/local.mk @@ -155,7 +155,17 @@ noinst_HEADERS = \ # The '.service' files for systemd. systemdservicedir = $(libdir)/systemd/system -nodist_systemdservice_DATA = etc/guix-daemon.service etc/guix-publish.service +nodist_systemdservice_DATA = \ + etc/gnu-store.mount \ + etc/guix-daemon.service \ + etc/guix-publish.service + +etc/%.mount: etc/%.mount.in \ + $(top_builddir)/config.status + $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ + $(SED) -e 's|@''storedir''@|$(storedir)|' < \ + "$<" > "$@.tmp"; \ + mv "$@.tmp" "$@" etc/guix-%.service: etc/guix-%.service.in \ $(top_builddir)/config.status -- 2.26.2