From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WLIGIanGkGIQcgEAbAwnHQ (envelope-from ) for ; Fri, 27 May 2022 14:40:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id oP8SIKnGkGKfJAEAG6o9tA (envelope-from ) for ; Fri, 27 May 2022 14:40:09 +0200 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 0644411C78 for ; Fri, 27 May 2022 14:40:09 +0200 (CEST) Received: from localhost ([::1]:48034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nuZGB-0006MP-VK for larch@yhetil.org; Fri, 27 May 2022 08:40:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuZG6-0006Lr-BT for guix-patches@gnu.org; Fri, 27 May 2022 08:40:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nuZG6-0000kx-1q for guix-patches@gnu.org; Fri, 27 May 2022 08:40:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nuZG5-0001D7-UE for guix-patches@gnu.org; Fri, 27 May 2022 08:40:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55653] [PATCH] guix: Add syntactic sugar for profile generation. Resent-From: andrew@trop.in Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 27 May 2022 12:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55653 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: liliana.prikler@gmail.com, 55653@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxime Devos , zimoun X-Debbugs-Original-To: Liliana Marie Prikler , guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16536551934634 (code B ref -1); Fri, 27 May 2022 12:40:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 May 2022 12:39:53 +0000 Received: from localhost ([127.0.0.1]:33061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nuZFx-0001Cf-Bv for submit@debbugs.gnu.org; Fri, 27 May 2022 08:39:53 -0400 Received: from lists.gnu.org ([209.51.188.17]:55428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nuZFv-0001CY-OS for submit@debbugs.gnu.org; Fri, 27 May 2022 08:39:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuZFv-0006HO-Ec for guix-patches@gnu.org; Fri, 27 May 2022 08:39:51 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:46125) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuZFs-0000gQ-RH; Fri, 27 May 2022 08:39:51 -0400 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id 6C6D11BF20B; Fri, 27 May 2022 12:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1653655183; h=from:from: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; bh=hFs3yjdLLx0HROUc31uwOQFenoYVQ1vQMP3gjHFTvOM=; b=FOunFF823tKtdK4SZjEfUlK4f7tiV+B4wcKsFB97IozVLvUBIKFEAVudWdUclIs6YODa8Y 6GnkNwDhkT2xzgtNXf91m9PPhKIMbOE2jMpv/IwQ1G3b2lXbhv4JzGOEKVlJ5aoXzPkKRg LMAYhvHJWhPHg6HSS9prTy/bxLagDMcEus0duN9iCUWkLTrmg5IjSy04wtEEUUxQOxo1Wp UvHx2BMwssgyHL72BpLDS69AqccGJoXMAS99kaa4+olTCmC2b9BGg+g+WUpeH+fnrChPrr EdDxB+KHBWS1L9kuin8QoHeCo8H5yZydbzroouJR0iZTI0Xsk8b1iTX7L+D0zQ== From: andrew@trop.in In-Reply-To: <10354f31e0be9bcb88b78da2fb8a2a3c3acbde10.camel@gmail.com> References: <10354f31e0be9bcb88b78da2fb8a2a3c3acbde10.camel@gmail.com> Date: Fri, 27 May 2022 15:39:38 +0300 Message-ID: <87tu9bqhdh.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=217.70.183.201; envelope-from=andrew@trop.in; helo=relay8-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653655209; 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=hFs3yjdLLx0HROUc31uwOQFenoYVQ1vQMP3gjHFTvOM=; b=OwgQQvKFdIzYVZKasivlZh6LvLYLJfqFzli+EJUFJPxlDSAtsUOgrsbjooAbENJJKsF0HW eD2aSJ8V4Wgjh/gg8D8hxIOYyni9oG6tCA3MxwAPoAguQjyj1y0ZYZ5LNQlXRlI/eOCMZM fFx87rW+paXhoxtLyrYdS23czIOJz5HL93+uTVJHinw1yso1yem2nA8OLiB9b46l915stV xfnJoy9Pp4jh0YDqYJWVQ2hr3zCQz5U5ahhGU/a4hcNsBtGb3yZrige73qKzdnrfdCF9qf R8UzDPRm8sUwwuQ0+5S3Y7mCpOjEc2vKRuEjejoBDbpFSAL5AX977nSLc6/Gjw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653655209; a=rsa-sha256; cv=none; b=dDcsU7JyuXx9Lu6oN40RoUWsM6L7n1UBroYmDFgLeLnq27XeCGp1AYz3wgQLwD9UvD6Gh/ mU4u3jEdnw9FvAF9+pRVJ2iiUgMfv5yVIFlJu8U+ucGNgoFsU7ptBO5nSJpH2gifqBrhRF AR7Qo25voZJwZXmejjj8ogr3OuZ6hpirvfpQmwtBtTOSonM5mXRhcHKAv8/pq2fTI/ptLC hJytI8zoMZ/AKZBhN1+8gVERO5XsuyqBGAqRbwF/19qMoGtpJwDXSPmqInyUllSLEfhNJ6 Wf/Kh/dq2zFjBLZqHRznHrRC53uQE00nMN41ho5SaYcKQ3D2QqtE8Et7aiypxA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=FOunFF82; dmarc=none; 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" X-Migadu-Spam-Score: 0.05 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=FOunFF82; dmarc=none; 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" X-Migadu-Queue-Id: 0644411C78 X-Spam-Score: 0.05 X-Migadu-Scanner: scn1.migadu.com X-TUID: XKZrOmGcPqSJ --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2022-05-26 11:01, Liliana Marie Prikler wrote: > * guix/profiles.scm (%profile, package-compatibility-helper): New variabl= es. > (profile): Implement in terms of package-compatibility-helper. > --- > Hi Guix, > > this is a first step towards managing multiple profiles via Guix Home. > It makes it so that regular Guix profiles can more easily be specified, t= hough > I'm not quite sure whether the mlet of packages->profile-entry should not= also > be used here. The sugar looks reasonable to me. > > In any case, with this it should now be relatively easy for users to spec= ify > profiles such as > (profile (name "emacs") (packages emacs emacs-magit emacs-org ...)) > (profile (name "r") (packages r r-plyr emacs emacs-ess ...)) > (profile (name "python") (packages python python-beautifulsoup4 ...)) > ... > What's still missing is a way to link them up with /var/guix/profiles/per= -user Don't think that they have to be linked to /var/guix/profiles/per-user, as mentioned earlier profiles built for the home environment should be a part of home environment, link to the profile will be inside home-environment directory: /var/guix/profiles/per-user/bob/guix-home/profiles/PROFILE_NAME links in /var/guix/profiles/per-user needed for switching between profile versions, it's not possible in case profile is a part of home environment, otherwise home environment will stop being reproducible. > and $HOME =E2=80=93 for the latter, there would be a home-*-service-type. Yep, can be done by home-files-* and symlink-manager I guess. > > WDYT? > > guix/profiles.scm | 23 ++++++++++++++++++++++- > tests/profiles.scm | 16 ++++++++++++++++ > 2 files changed, 38 insertions(+), 1 deletion(-) > > diff --git a/guix/profiles.scm b/guix/profiles.scm > index bf50c00a1e..fbc343c456 100644 > --- a/guix/profiles.scm > +++ b/guix/profiles.scm > @@ -1974,7 +1974,7 @@ (define builder > (manifest-entries manifest)))= ))))) >=20=20 > ;; Declarative profile. > -(define-record-type* profile make-profile > +(define-record-type* %profile make-profile > profile? > (name profile-name (default "profile")) ;string > (content profile-content) ; > @@ -1987,6 +1987,27 @@ (define-record-type* profile make-profile > (relative-symlinks? profile-relative-symlinks? ;Boolean > (default #f))) >=20=20 > +(define-syntax package-compatibility-helper > + (syntax-rules (packages manifest) > + ((_ () (fields ...)) > + (%profile fields ...)) > + ((_ ((packages exp) rest ...) (others ...)) > + (package-compatibility-helper > + (rest ...) > + (others ... (content (packages->manifest > + (delete-duplicates exp eq?)))))) > + ((_ ((manifest exp) rest ...) (others ...)) > + (package-compatibility-helper > + (rest ...) > + (others ... (content exp)))) > + ((_ (field rest ...) (others ...)) > + (package-compatibility-helper (rest ...) (others ... field))))) > + > +(define-syntax-rule (profile fields ...) > + "Build a record, automatically converting 'packages' or 'man= ifest ' > +field specifications to 'content'." > + (package-compatibility-helper (fields ...) ())) > + > (define-gexp-compiler (profile-compiler (profile ) system targe= t) > "Compile PROFILE to a derivation." > (match profile > diff --git a/tests/profiles.scm b/tests/profiles.scm > index d59d75985f..970a34b6cc 100644 > --- a/tests/profiles.scm > +++ b/tests/profiles.scm > @@ -272,6 +272,22 @@ (define transform1 > (manifest-pattern (name name)))) > '("gcc" "binutils" "glibc" "coreutils" "grep" "sed")))) >=20=20 > +(test-assert "profile syntax sugar" > + (let ((p1 (dummy-package "p1")) > + (p2 (dummy-package "p2"))) > + (define (profile=3D? . profiles) > + (define (manifest=3D? . manifests) > + ;; Since we're using the same packages, we could also compare vi= a eq? > + (apply list=3D manifest-entry=3D? (map manifest-entries manifest= s))) > + (apply manifest=3D? (map profile-content profiles))) > + > + (profile=3D? > + (profile (content (manifest > + (map package->manifest-entry (list p1 p2))))) > + (profile (content (packages->manifest (list p1 p2)))) > + (profile (manifest (packages->manifest (list p1 p2)))) > + (profile (packages (list p1 p2)))))) > + > (test-assertm "profile-derivation" > (mlet* %store-monad > ((entry -> (package->manifest-entry %bootstrap-guile)) =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmKQxooACgkQIgjSCVjB 3rC8rw/7BTxMeH87Sx38URbnZHN1rzM3klKOZLHRAc9Kx7YVmnyFvhBYDsRqzYvh JkaxWGEiKcYV2Y3pwcOM6mndXd8nFGpQvbDE6SwZWcEaVOEYaJoNl6XFx8q9CXw0 u6PVYmL2iKZzVahPXdC4qv8woRobSyS5f74yxYVuAFtGxUIG+6OvgC7Ua3rG7aLI pX3iTMapnEgvrHvDp0mR4W2Ty4uydWs9hwkqUW4XR4YJ2p1mOMw8tk/FRHcg/Wqf QfIJ3oUUW7Vdltc709a29BMW2+vYdXvBGU7o0jUvuNEltpu4t5Sa291LN6+cVaeu E36PeeuTPH/tIS0GuO5CCKv26yu72yD1OPlGl1c6b6y/M/oHXdhNLuq+t6/JyGaU S5IUANFEoxO57fpfqdEOjj4NgStAPdOuF+xUtdYlUT8oKOxtqlKXkdxCLn3AqW0w Gw1NOUo6trrucvcrOjR6h+7gpr21RzNC6mmqTEksFwW2mdbrg5pN5Q5tCtNmgw7m mh4Pr+PH8DSD4ngoTbZbSm/gpS5kSsGfXYLijl+feVg0I6LeFlaz7e4BZHlkdh4+ ubRo+c1/o5sFxjEMimQ3Znnz0vYDnjlxjtPgOg/HlazH0Ub/795DVkpGoudybFCT +32LY2FU8mBRw1eLHRhpWrNksxbDCiJJ/RvuccConR+jpxXqt/A= =ijru -----END PGP SIGNATURE----- --=-=-=--