From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MMaKBpaNI2DcQAAA0tVLHw (envelope-from ) for ; Wed, 10 Feb 2021 07:39:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id +ItMApaNI2BCUAAAbx9fmQ (envelope-from ) for ; Wed, 10 Feb 2021 07:39:02 +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 CAC7D9402B3 for ; Wed, 10 Feb 2021 07:39:01 +0000 (UTC) Received: from localhost ([::1]:58336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9k5U-0004vT-MT for larch@yhetil.org; Wed, 10 Feb 2021 02:39:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9k5L-0004vL-Mh for guix-devel@gnu.org; Wed, 10 Feb 2021 02:38:51 -0500 Received: from mail-40137.protonmail.ch ([185.70.40.137]:22056) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9k5I-0003oI-D6 for guix-devel@gnu.org; Wed, 10 Feb 2021 02:38:51 -0500 Date: Wed, 10 Feb 2021 07:37:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1612942724; bh=KO+4is4SI4SZcxzprVYQEPrAzERdOTKvogds2T1oe7M=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=K0xj91cZmMKw3c2JbB3zPs2aHu4RwmlWMtTs+BcJak+oWe7rvRlwhbAMxiqi5+oUG g6wBeXqnlFr9+n4g6lNa7wFsirceKSbVYruR5dNigycxi1rx43WK+IP2tZSwC7R+hc cyM2r+IHgk8mDMhpcsBpJcTy6E2dqixmL4foAOgo= To: Danny Milosavljevic From: raid5atemyhomework Cc: Carlo Zancanaro , "guix-devel@gnu.org" , "ludo@gnu.org" Subject: Re: ZFS on Guix Message-ID: <8s6nooIPFjWGbjUeq3ot7vomNW8DXsWSCXZFZcLdHg89yBk3SWXd6LC10dtTT439Uh_12IVvSImq334gpjuZbxmQ1VYD59R3W0RGA1n8Mm8=@protonmail.com> In-Reply-To: <20210208031625.079ae4f3@scratchpost.org> References: =?us-ascii?Q?<=5F1CLe9QSGsoMlu5WxBMXm4CbFLM=5FM9iRG1XQF9GDsK0GP208jpngdymfix4tAfoLP94mhMTt-Tx6OP2xN=5Fn78Jhx5KQzkiqPpIci=5F44C9OI=3D@protonmail.com>_<4nnVFhbpUhipplsq55mHX9KtoMK9s0rZDC3D8rgKQ5O0nUtnapdkHZfPcAVpECgW1mnYm1BbmvyQ4SyTgvNyUgVgzM29gh6b8OL7p3YvczM=3D@protonmail.com>_<20210103165008.6517c1bf@scratchpost.org>_____<87lfd698xq.fsf@zancanaro.id.au>__<20210208031625.079ae4f3@scratchpost.org>?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.137; envelope-from=raid5atemyhomework@protonmail.com; helo=mail-40137.protonmail.ch 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: raid5atemyhomework Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.06 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail header.b=K0xj91cZ; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: CAC7D9402B3 X-Spam-Score: -3.06 X-Migadu-Scanner: scn1.migadu.com X-TUID: tSO4Z+iXN+5P Hello Danny, > I just wanted to say that I'm not ignoring your patch, I'm just not quali= fied > to review it. I hope someone steps up to it--otherwise I can't really tel= l > whether (mbegin %state-monad...) inside a random service procedure is a g= ood > idea. > > Then again, provenance-service-type does it and there it seems to be fine= ... For ***this*** very specific case it is because of a random weirdness of `s= ystem-service-type`. Specifically, the *value* of that service-type is an association list of fi= lenames and their contained store values. However, an ***extension*** of t= hat service-type must be a monadic action that results in an association li= st of filename-contents. Here is relevant code in `gnu/services`: ```scheme (define (system-derivation entries mextensions) "Return as a monadic value the derivation of the 'system' directory containing the given entries." (mlet %store-monad ((extensions (mapm/accumulate-builds identity mextensions))) (lower-object (file-union "system" (append entries (concatenate extensions)))))) (define system-service-type ;; This is the ultimate service type, the root of the service DAG. The ;; service of this type is extended by monadic name/item pairs. These it= ems ;; end up in the "system directory" as returned by ;; 'operating-system-derivation'. (service-type (name 'system) (extensions '()) (compose identity) (extend system-derivation) (description "Build the operating system top-level directory, which in turn refers to everything the operating system needs: its kernel, initrd, system profile, boot script, and so on."))) ``` So *extensions* must be monads (due to `mapm/accumulate-builds` on the `mex= tensions`) but the raw value must be a simple non-monadic assoc list. The patch moves some generated files ("kernel" and "hurd") from the value o= f the `system-service-type` to an extension of `system-service-type`, thus = the extra `mbegin %store-monad`. It needs to be `%store-monad` since that i= s the monad used by the `system-derivation` function. See: ```scheme (define (kernel-builder-configuration->system-entry config) "Return the kernel and hurd entries of the 'system' directory." (mbegin %store-monad #;...)) #;... (define kernel-loadable-module-service-type (service-type (name 'kernel-loadable-modules) (extensions (list (service-extension system-service-type kernel-builder-configuration->sys= tem-entry))) ;; <-- OVER HERE (compose concatenate) (extend kernel-builder-configuration-add-modules) (description "Register packages containing kernel-loadable modules and = adds them+to the system."))) ``` So it is not just some "random service procedure", it is because that is th= e interface exposed by `system-service-type` for its extensions, extensions= of `system-service-type` have to yield a monadic action. `mbegin` is one = of the simpler monadic actions. It is also in the "correct place" as best = as I can tell, since only service types in `gnu/services.scm` dare to exten= d `system-service-type`. `provenance-service-type` does this as well because it *also* extends `syst= em-service-type`. This is basically done here simply because that is what = `system-service-type` expects. Thanks raid5atemyhomework