From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 GI1rOk2K22No4wAAbAwnHQ (envelope-from ) for ; Thu, 02 Feb 2023 11:02:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id wO9WOk2K22PCCgEAauVa8A (envelope-from ) for ; Thu, 02 Feb 2023 11:02:53 +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 B9FD43007 for ; Thu, 2 Feb 2023 11:02:53 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNWQF-0004jO-C3; Thu, 02 Feb 2023 05:02:27 -0500 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 1pNWQD-0004iY-5m for guix-devel@gnu.org; Thu, 02 Feb 2023 05:02:25 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNWQA-0007Bw-Q1 for guix-devel@gnu.org; Thu, 02 Feb 2023 05:02:24 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 4B88A24068E for ; Thu, 2 Feb 2023 11:02:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1675332137; bh=/+8dk32Re6AqMbayu7Db15xyqa+KxyuM2c8lSFLBw9M=; h=From:To:Cc:Subject:Date:From; b=cx5GY/YM3ppCV7FfWPhJzQvUOhlFajpuoyK72ZcHQ1Gp+7khCqN9PsM2SYPFo7Mxi Lg2m9sSMfFA/aIEXQjNy5hqDz6rzA92yOq8Z12a9W20rOASMkgQieZW8Zgyl6A0UJQ CSDD5hxTzxXcDXaGZgmQX/dB+cDVT5JgERQxCzfdZ+pRMMVCu0An1lMRFwOftkaEK/ tW7vKIt8zE6PialalwH1JVYV6+CkWmzz5oa3cTPF9enzqLJch0egu7jaXIb3rUASCN ps80CmDYljx0Mh1NRxw4re6jPxLROnlKE83UOGzxY8vi2DworgDqvpHNUql2aMGZyI EktoVTKMS7vGg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4P6vTg3YHRz9rxN; Thu, 2 Feb 2023 11:02:15 +0100 (CET) References: <87r0wxbhm5.fsf@posteo.de> <87h6xgwdt8.fsf@librem.one> From: Mekeor Melire To: Mitchell Schmeisser Cc: guix-devel@gnu.org Subject: Re: Proof of Concept: Import Emacs' use-packaged packages into Guix' manifest.scm Date: Thu, 02 Feb 2023 09:44:49 +0000 In-reply-to: <87h6xgwdt8.fsf@librem.one> Message-ID: <87wn50xu5i.fsf@posteo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=mekeor@posteo.de; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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: 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675332173; a=rsa-sha256; cv=none; b=hqLTnsZJAU1+h74xH1+PKSu2vU1AEXOL43gxYFp2A4S2MzDIwBZZ/cyc8byLJ3/GuMNhUO Ce4A8O67uhcuSEBD9/lCQELRTv7AxLvM94h8UwYsdbbHlKkD85bR0/vizbpu/e/AHG+uij 9DugEzJSv0TMV5/rF9cNXZ+BvalQXuCc+5kM9zoKXy1PV7QqeNPz9TCJgRup50PHW1fads GmiOYjYPIlFpP9lctYk59fgCWhLs4l2wbB1ohVWqAXpNgCqjHW/9Qpn83D0iGmYY/b+19c zrRcTriMQIkp+FzfnWRnUockEVIANpnZkwluSXKaO8NxzpNE6xXJs1FHyWBm5g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.de header.s=2017 header.b="cx5GY/YM"; dmarc=pass (policy=none) header.from=posteo.de; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675332173; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=GJ2Ue32V/jMpIwuAAZ+wEv0Aj0Q2a/HEEt/ZxBHuDdI=; b=rixuDDVr9mMBvYx+QCnNNNTpRs3SSssQV3GKFBCtWPfAu8MpUfZ0xa6i7wqBR5FlGZlpfi diiCa6ivGmkoHNeyyEByud4wQadGbD/poH0D2QLkx9VH1SBabU41R0GJw4TrNKFTpnjRU4 mhk6w3cbAX20s9w3dF0eq8cR7CC/f2UcoC2Pl7caju+2JdBFVOIGzcnMJC3Heci4yM6/Si t2J79gdQOEYcltVE96aVOGrSQJfjHw4VhpYMcYtR3zXnYpBDyFpw9wW37QJCYsz3NX4Ltl vn/sAv1wLHmnmIO9fVEZoFnWw+x5X4zpABkfSlWDznSvDZWZtim3Hh5uO4SxoA== X-Migadu-Spam-Score: -8.64 X-Spam-Score: -8.64 X-Migadu-Queue-Id: B9FD43007 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.de header.s=2017 header.b="cx5GY/YM"; dmarc=pass (policy=none) header.from=posteo.de; 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" X-TUID: gZ0/m8Sfw04Z 2022-12-27 19:51 mitchellschmeisser@librem.one: > Mekeor Melire writes: > > Here is a naive implementation which extends use-package to use=20 > guix to ensure packages. Thank you very much for this great snippet of code. I just=20 successfully set it up locally and I'm very happy. Would you like to create a public Git repository for this=20 elisp-package so that we can collaborate on it? If you don't have=20 time to do it, I can create a public Git repository (with your=20 copyright note; under GPLv3+?; formally owned by an=20 "organization"). Personally, I'm also very much of a noob in things elisp. But=20 intuitively, I'd suggest these changes: > It is a bit annoying at first because it prompts for y/n=20 > verification for every package but I think this behavior is=20 > desirable. Personally, I found that behaviour a little tidyous. I'd suggest=20 to make it at least configurable. > #+BEGIN_SRC emacs-lisp > (require 'guix) > (require 'guix-profiles) > (require 'guix-read) > (require 'guix-ui-package) > > > (defgroup use-package-guix nil What do you think about naming this package/feature=20 "use-package-ensure-guix" and using that as a prefix for all other=20 functions and variables -- except for use-package-ensure-guix? I=20 think "use-package-ensure-guix" would be a good package name=20 because it's pretty much the only (important) function which this=20 packages aims to offer. So, =E2=80=A6 > "use-package support for guix" :group 'use-package-ensure) > > (defcustom use-package-profile (concat (getenv "HOME")=20 > "/.emacs.d/guix-profile") =E2=80=A6 this variable would then perhaps be renamed into=20 "use-package-ensure-guix-profile" or so. > "Location of use-package guix profile" :type 'string :group > 'use-package-guix) > > (defun guix-package-installed-p (package) > (bui-assoc-value package 'installed)) > > (defun canonicalize-name (package-name) > "Make sure package name has \"emacs-\" prefix" > (if (string-match "^emacs-.+" package-name) > package-name > (concat "emacs-" package-name))) > > (defun emacs-package->guix-package (package) > "Return guix package from package name" > (car (guix-output-list-get-entries use-package-profile 'name > (canonicalize-name=20 > package)))) > > (defun guix-package-id (package) > (bui-entry-non-void-value package 'id)) (This function could be removed, I think.) > (defun guix-install-package (package) > (if (guix-package-installed-p package) > t > (guix-process-package-actions > use-package-profile > `((install (,(string-to-number (car (split-string=20 > (bui-entry-id package) ":"))) "out")))) > (current-buffer))) > > (defun guix-installed-packages () > (guix-output-list-get-entries use-package-profile 'installed)) > > > (defun use-package-ensure-guix (name args _state &optional=20 > _no-refresh) > (dolist (ensure args) > (let ((package > (or (and (eq ensure t) > (use-package-as-symbol name)) > ensure))) > (when package > (when (consp package) > (use-package-pin-package (car package) (cdr package)) > (setq package (car package))) > > (let ((package (emacs-package->guix-package=20 > (use-package-as-string package)))) > (unless (guix-package-installed-p package) > (condition-case-unless-debug err > (progn > (when (assoc package (bound-and-true-p > package-pinned-packages)) > (package-read-all-archive-contents)) > (if (assoc package package-archive-contents) > (package-install package) > (package-refresh-contents) > (when (assoc package (bound-and-true-p > package-pinned-packages)) > (package-read-all-archive-contents)) > (guix-install-package package)) > t) What is the purpose of this long (progn =E2=80=A6)? Could we instead=20 simply write (guix-install-package package)? > > (error (display-warning 'use-package (format=20 > "Failed to > install %s: %s" name (error-message-string err)) > :error))))))))) I'd suggest to miss the "error" label on this message, and rather=20 label it as "warning" (which is the default). We could also=20 suggest to add ":ensure nil" if it's a built-in feature. (E.g. in=20 case of (use-package recentf).) > ;;;###autoload > (add-to-list 'load-path (concat use-package-profile=20 > "/share/emacs/site-lisp")) > > (provide 'use-package-guix) > #+END_SRC Finally, I'm not sure if installing packages from my custom local=20 guix-channel succeeded. I need to retry and investigate more.