From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id kPmZEzS8HGQwUAAASxT56A (envelope-from ) for ; Thu, 23 Mar 2023 21:53:08 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id iMPEEjS8HGT9KQAAG6o9tA (envelope-from ) for ; Thu, 23 Mar 2023 21:53:08 +0100 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 F099327A31 for ; Thu, 23 Mar 2023 21:53:07 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=rdklein.fr header.s=zoho header.b="GVuw4/a4"; arc=pass ("zohomail.eu:s=zohoarc:i=1"); spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679604788; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xPQGpsoGMMNog/V77bTp2I/HREp2P/jxoxjGP9M+uOE=; b=UeAuiEKsgMYLLG5p9tVLk6w27vmTQcZW1xBUuIyYodKbUt5QdoUSUXOgNlKi9aODFyM/Og mva+0t3CHb5N+xvixN3DUk5eqoZkatnI4SLTMmkC239Fqo5K105XWcnMWVonkXExthu4BM GD06feD02GMhiGcJ4eYO2MOUziI+KE9vaxQlpQBxXxduNYh8R+V/MpCCELWAog15Qz5r7o nt0xhXp4KBvRDfHv/aezzIgEfk+DAi3JekZmYfJ7rg8RU9jixfzqFbjEHVo0bUmdZFjnmL RAf0Ve6fkCV3WtCqJsVujiWsRTCTQrfG7ZeRDUL7rcH7XLqoOx1zxgvaRffLog== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1679604788; a=rsa-sha256; cv=pass; b=Oqt6SWZPe5usvu4HNDXb6twDh8CCSfkXm7xIpx5/b8OxSc5m9DxlgdGYj3dN87FkVZYhnG rQHzXCrTgmzv2b8+onN1F7qrZgKguv4Bx64b1WfMymzKAo1x9tOjq097ZgTDLEsQl06zyM YAKVBrYTzYymaNbpvKIK1DKTLL/8DmBNW1tQ/9YEAJ+c6NfK071wVWeJv0FM4oVaXZhwX2 zJ/Bj2RNnIbQnfzzaRMhPrKApxKbiwdi5w8rK43NhHO/GTvhfr6YvDlGq75K7e0G7v9MeY Y+YMB5PuXsdDG/++IBKaAqIf055M/Gy/jmKQMVdaJm2KxObJYUXwvwDfEAtLnQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=rdklein.fr header.s=zoho header.b="GVuw4/a4"; arc=pass ("zohomail.eu:s=zohoarc:i=1"); spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=none Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfRvU-0007NR-76; Thu, 23 Mar 2023 16:52:48 -0400 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 1pfRvR-0007N7-Km for guix-devel@gnu.org; Thu, 23 Mar 2023 16:52:46 -0400 Received: from sender11-op-o12.zoho.eu ([31.186.226.226]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfRvO-0000Qw-Ie for guix-devel@gnu.org; Thu, 23 Mar 2023 16:52:45 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1679604752; cv=none; d=zohomail.eu; s=zohoarc; b=jN7Zhqf0ckECNsj9qSKN2710zH7vQCTl9L0l6q5JPAerhU2yLHOMki+nosMefx5oXgLD9uRlZ3NqGQzNCl9ObshjSfZxza5gpg26yfOePrYQJWmwBpoCDzi4cp0rhub3x8gEtjkxtEv0tUPUVFW3HXOEfEDkebRDLOFRXvDvrdg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1679604752; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=xPQGpsoGMMNog/V77bTp2I/HREp2P/jxoxjGP9M+uOE=; b=ifTE/F7gfn87mIT+s8G+N+mqRO7rSMEX271dCybsdmuw+jPCinlCuE2TvcmZ3x/0EhdndVY1d6zkdnuIpULkwENncTRtCnBoeSsg/I5RXaXhaJLezeBBXzFU4p+DGhkRyVx0hHp2bc40ZPxygJKlFtv+hat8Wb9GT4DCOLrpal0= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=rdklein.fr; spf=pass smtp.mailfrom=edou@rdklein.fr; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1679604752; s=zoho; d=rdklein.fr; i=edou@rdklein.fr; h=References:From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:In-reply-to:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To; bh=xPQGpsoGMMNog/V77bTp2I/HREp2P/jxoxjGP9M+uOE=; b=GVuw4/a4Fx+fblPdBpIuU9+SnnXNER5HTRIRPz7X4TsyS7Isubh554V6wQqyISUB iKjjRxGTUl6y94psKFjjXjQ3z0qyuA0NX9eQoKOMAXm9WoQjY7VDXryCWfgRGbzRiyN k6mfMFmPl0h790LsYoLMQ44rYY97PypXucexTLlcdMQqOzOUnSyoT4JbhmdP6n8PHCS oY6txSzEyTpe2/hsfugnetSpPAf6KtKIuEW2Rdljjp77EUj5WpUIqOdRczKqF1t4PJl tJ7IYdkuAXXuQ7qSAKBiIZF0oWdOKFOQtfv9DlIHQeHd7M3u/HEqARvbWHgBswoxCTn 4gjtFrbybA== Received: from schwarzy (lfbn-idf3-1-667-244.w86-252.abo.wanadoo.fr [86.252.237.244]) by mx.zoho.eu with SMTPS id 1679604750417569.1355955312911; Thu, 23 Mar 2023 21:52:30 +0100 (CET) References: <87wn377rst.fsf@rdklein.fr> <87iler1ezd.fsf@jpoiret.xyz> User-agent: mu4e 1.8.13; emacs 28.2 From: Edouard Klein To: Josselin Poiret Cc: guix-devel@gnu.org Subject: Re: A friendlier API for operating-system declarations Date: Thu, 23 Mar 2023 21:23:51 +0100 In-reply-to: <87iler1ezd.fsf@jpoiret.xyz> Message-ID: <874jqb6vih.fsf@rdklein.fr> MIME-Version: 1.0 Content-Type: text/plain X-ZohoMailClient: External Received-SPF: pass client-ip=31.186.226.226; envelope-from=edou@rdklein.fr; helo=sender11-op-o12.zoho.eu 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=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.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: X-Migadu-Queue-Id: F099327A31 X-Spam-Score: -9.55 X-Migadu-Spam-Score: -9.55 X-Migadu-Scanner: scn0.migadu.com List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-TUID: BSG6ZumERHj7 Hi Josselin, Josselin Poiret writes: > [[PGP Signed Part:Undecided]] > Hi Edouard, > > Edouard Klein writes: > >> #+begin_src scheme >> (-> >> (minimal-ovh "ssh-rsa AAASomethingSomething== root@minimal-ovh") >> (http-static-content "sub2.example.com" #:to-dir "/srv/sub2") >> (http-static-content "sub1.example.com" #:to-dir "/srv/sub1/") >> (add-services my-db)) >> #+end_src >> >> The code of the function is on my channel: >> https://gitlab.com/edouardklein/guix/-/blob/beaverlabs/beaver/system.scm >> >> After a few months of experience, and positive feedback from my clients, >> my question to you guys is: would you be interested in mainlining this, >> or should I keep my development efforts separate in my channel ? > > I am quite in favor of using operating-system transformations rather > than inheritance, because they're composable! This could be leveraged > to get a nice CLI API as well. > I hadn't thought of that but now that you mention it, starting a basic web server or database, isolated in a container, directly from the command line may come in handy sometimes. This is a good idea ! I'll think about how to achieve this :) In the meantime something like: #+begin_src bash guix system container -e "(begin (use-modules (beaver system)) (http-static-content minimal-container))" --share=somedir=/var/www #+end_src Will spin up such a server. Kind of like python3 -m http.server, but without the security flaws (you get a full blown nginx), and isolated in a way that even if your process gets owned, it's only an unpriviledged user in a container. >> I do think this API is easier than manipulating services, and although >> extendable services are awesome and a very nifty piece of engineering, >> they require quite a good knowledge of scheme and take a while to be >> used to, while this new API, while way less powerful, lowers the barrier >> to entry for newcomers. > > By this, do you mean that there's no way with your syntax to modify a > given service? Is there a reason for this? It does seem to me that it > could probably be done. > I'm not sure I understand your question. What I meant is that my proposal is only syntactic sugar over the existing system, and not meant to replace it. The existing system is actually very good and the way you can define how to collate the instances of a given service type, even if they are instanciated far away from one another, likely by different authors is really clever and well made. I'm talking here about things like how you can easily request that a new user be made for your service, and account-service-type will collate all the users that need to exist, and actually get the job done. Basically what fold-services does. I just want to hide all of this complexity for people who just want to activate one or more instances of a service coded up by somebody else. If by modifying a service you mean the parameters like the port ones listen to, or the directory the data should be put in etc. the functions just take keyword parameters and pass them to the underlying *-configuration scheme record. They are quite easy to edit and compose. Maybe we could even devise a semi-automated way of generating one function for every *-configuration structure that exists. See https://gitlab.com/edouardklein/guix/-/blob/beaverlabs/beaver/system.scm#L236 how http-static-content is basically just a wrapper over nginx-server-configuration. If you meant editing the service after the function has run, you then need to inspect the operating-system record and fall back to the original API, by finding the service in the record and editing its members, but that seems complex to me. I'm probably misunderstanding the use case. >> They are an easy way to maintain a declarative whole operating system >> configuration, with a syntax similar enough to docker and ansible that >> sysadmins familiar with it can quickly get up and running, thus exposing >> more people to Guix. >> >> What do you think ? > > You've got me interested :) especially since you already have customer > feedback! > Thanks :) Cheers, Edouard. > Best,