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 6JMzMhG3818qIQAA0tVLHw (envelope-from ) for ; Tue, 05 Jan 2021 00:47:13 +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 gBTtLRG381/eIAAAbx9fmQ (envelope-from ) for ; Tue, 05 Jan 2021 00:47:13 +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 8BF1C940276 for ; Tue, 5 Jan 2021 00:47:13 +0000 (UTC) Received: from localhost ([::1]:35716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwaVE-0002Ml-Av for larch@yhetil.org; Mon, 04 Jan 2021 19:47:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwaUw-0002LQ-6m for guix-devel@gnu.org; Mon, 04 Jan 2021 19:46:54 -0500 Received: from mail-40132.protonmail.ch ([185.70.40.132]:37678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwaUt-0004rd-Of for guix-devel@gnu.org; Mon, 04 Jan 2021 19:46:53 -0500 Date: Tue, 05 Jan 2021 00:46:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1609807609; bh=otEu/kJoz6S3+oZmna8V7KAOpSc5pbm9fM67JY9Eoh8=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=urywEud+c8SV8MEjUeklK5CXCfgDHdATZGKItd/Et8vyyt5b2cdAQyf4hLq4E/KR6 urasu2xH3ihkr7nH5C4nH5bpwpZlD8YGiZ0JAcz82JiLNAuTLM8z69g+83YaVqcyPD I8RVi+KlHe5L6Zq8Dn0Yuu1EQXLm1NO5mtBCfqS4= To: Jan Wielkiewicz From: raid5atemyhomework Subject: Re: A new paradigm for modifying operating system declarations Message-ID: In-Reply-To: <20210105002644.383d317a@interia.pl> References: <20210105002644.383d317a@interia.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.132; envelope-from=raid5atemyhomework@protonmail.com; helo=mail-40132.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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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 Cc: "guix-devel@gnu.org" Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.03 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail header.b=urywEud+; 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: 8BF1C940276 X-Spam-Score: -3.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: sP5JlDRa/c6z Hi Jan, > > Better but still don't like it. > Can't we put the os declaration into a variable and then pass it to a > procedure? > Say: > > > (define OS > > (operating-system > > (kernel linux-libre-5.4) > > ; ... other fields ... > > )) > > > > (install-zfs OS) > > (install-foo OS) > > (install-bar OS) > > (install-something OS) > > > > No, because `` objects are not mutable (or at least their= formal interface doesn't expose any mutation). What we could do would be: ```scheme (define os (operating-system (kernel linux-libre-5.4) #;...)) (set! os (install-zfs os)) (set! os (install-foo os)) (set! os (install-bar os)) os ``` However, in many examples I've seen, the `configuration.scm` file looks lik= e this: ```scheme (use-modules (gnu)) (use-package-modules #;...) (use-service-modules #;...) (operating-system (host-name "my-system") (timezone "Europe/Paris") (locale "en_US,utf-8") (kernel linux-libre-5.4) #;...) ``` What I want to avoid would be to have to nest the existing, usually screens= -long, `operating-system` form. So compare: ```scheme (use-modules (gnu)) (use-package-modules #;...) (use-service-modules #;...) (decorate (install-zfs install-foo install-bar operating-system) (host-name "my-system") (timezone "Europe/Paris") (locale "en_US,utf-8") (kernel linux-libre-5.4) #;...) ``` versus: ```scheme (use-modules (gnu)) (use-package-modules #;...) (use-service-modules #;...) (define os (operating-system (host-name "my-system") (timezone "Europe/Paris") (locale "en_US,utf-8") (kernel linux-libre-5.4) #;...)) (set! os (install-zfs os)) (set! os (install-foo os)) (set! os (install-bar os)) os ``` I feel the former is better and requires less boilerplate. Now of course, I ***have*** seen examples as well where the `operating-syst= em` is put in a `define` form as well, but those are rare and the default s= tuff that come with Guix tend not to use this, and we should consider that = new Guix sysads might not be comfortable working with EMACS and prefer nano= , so adding even just *one* additional layer of nestedness to a long `opera= ting-system` form is not easy. Of course, such a sysad might then consider= not indenting it correctly. Thanks raid5atemyhomework