From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id SA/eOG+uc2TsCgEASxT56A (envelope-from ) for ; Sun, 28 May 2023 21:41:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id cPoQOW+uc2TwNAAAauVa8A (envelope-from ) for ; Sun, 28 May 2023 21:41:35 +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 7F3233877A for ; Sun, 28 May 2023 21:41:35 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3MGE-0000cz-55; Sun, 28 May 2023 15:41:02 -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 1q3MG7-0000cc-NT for help-guix@gnu.org; Sun, 28 May 2023 15:40:59 -0400 Received: from mail-40133.protonmail.ch ([185.70.40.133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3MG4-0002TE-4W for help-guix@gnu.org; Sun, 28 May 2023 15:40:54 -0400 Date: Sun, 28 May 2023 19:40:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1685302847; x=1685562047; bh=Re/eIo+khmNmfCj3Gejm/rCvgzXHRFKr+cNGMH6vW9k=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=sOxJNMv3EzUbf/1j7O+P0fj0A2NcLPBMC8xaOPvbMKWWmV+6Xvm7Ap9Ir0bAXMJwr Hox6M9OLJIqvmEkp4yWjrQtHLhp5E2AKLi0jJZvd6N891h1IanEIu3oKTripXAIJeS Esf/K+tDfuEWqPlJ4jbNTYNgV4MV8kwPox3ZOb1xALjrFpbihmtItZStCpGpyRnMYO 60Y1tVmW7onI/i8pzsagoZWbjpTb2koy477qNDX+Lg6daLKNHtDsNKRaw7g17R3HJX iP6q8gW4mcRLmWm6EAhYhyYaZAeclEcQy/w9Rf99BGfAaJpla/cxG7A/SyY41kIEhW 47JKHF0m6vVhQ== To: Rodrigo Morales , help-guix@gnu.org From: Skyler Ferris Subject: Re: Let's share examples of simplistic and useless package definitions Message-ID: <82625bf4-3fe0-d56d-e8ed-ec9d2e1fb82b@protonmail.com> In-Reply-To: References: Feedback-ID: 40635331:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.133; envelope-from=skyvine@protonmail.com; helo=mail-40133.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, SPF_HELO_PASS=-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: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-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=1685302895; a=rsa-sha256; cv=none; b=K2aLv00rp9WWgBR53kXvzfKlWEiQ0NFEkqUhjwboX04EmPBhRJiCNVUwwN9whoaiNYKdq/ 7KFvFmKAXTZkjdchaSYFK2r7kkJ72UwVoSzyNzM0pK4XIyG7OQPiJHnhWND+nPElzibKhV soUZhtqs1ZARByhhvo7d/GJ4PN3rX/h+m1/Itrttz2epWgTbHHWTyjdzZWB9APfvsMjReo hOw1wzcEm9DebiIvrww37wYFwBJx2RgQKxzxZtUcv0SUSCfF5thnhtkEgHVehWk5bD154/ A+RVqgKEd7gFaCzTZIlmNNQzno2t2vpAW03Lk/kaeRVHypQ51ao6Yp40/YX5QQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail3 header.b=sOxJNMv3; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1685302895; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=Re/eIo+khmNmfCj3Gejm/rCvgzXHRFKr+cNGMH6vW9k=; b=s+BHlM4wSH7w2yscLfCEDLHIeHpIWkYf+XIx+sfvWTJEJOnAi6uhc3Psh8C7RnY0aBK0mP RgPrL19bu4y8Z0VBmRQTd674daB36P/pcwNjBcd6nTrbaWe+6vkWJ2SpCeMmPXfurGJ65R swe5OKETWnP2b50v1yJy/s8BH467DnBAHh3kGSj5S03UjTZZerozZ79DbzTwKxr23CPeTQ 12xuER0uoHD7zE0UXrUx4BOWLi61j67dkjK/REFD7SyDy+lTbP0qQ5q4djcryYoH3jkwjn jTUZ67H8OE1BDusO8swe7MV7Y+8krb/BE07VyyI0VYa3nKEwPcsyos6J3+tCYw== X-Migadu-Spam-Score: -4.76 X-Spam-Score: -4.76 X-Migadu-Queue-Id: 7F3233877A X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail3 header.b=sOxJNMv3; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-TUID: bvhZXVErCQtD Hi Rodrigo! In a topic adjacent to your second question, I wanted to share something that I recently learned about using local-file in package=20 definitions. I ran through a similar exercise when building a package that largely=20 consisted of local file, and came upon a similar solution of adding local-file=20 forms to the source field. However, I ran into an issue when including multiple local=20 files, because the name that the build code looks up is just an underscore by=20 default (I do not remember for sure how it handles multiple local files, I think=20 it was just adding an extra underscore for each new file). This is fine with just=20 one file as in your example, but is not particularly readable when you're working with=20 multiple files. The names can be set explicitly, but this syntax is deprecated (see https://guix.gnu.org/blog/2021/the-big-change/ for a detailed discussion=20 of this, if you aren't already familiar). And unfortunately, you can't mix the=20 two syntaxes; that is, if you are writing a more complex package with both local files an= d normal package inputs, you would have to write the normal package inputs using the deprecated syntax as well, or accept the underscore names. However, after digging through some upstream package definitions, I learned that there is an idiom to solve this: there is actually no need to=20 include the local files in the source field, you can include them directly in the build=20 definition using g-expressions!=C2=A0 Written with this idiom, a simple package that just=20 copies a file would look like this: ,--- | (use-modules | =C2=A0=C2=A0=C2=A0 (guix build-system trivial) | =C2=A0=C2=A0=C2=A0 (guix gexp) | =C2=A0=C2=A0=C2=A0 (guix packages) | =C2=A0=C2=A0=C2=A0 ) | | (package | =C2=A0=C2=A0=C2=A0 (name=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "copy-= file-using-gexp") | =C2=A0=C2=A0=C2=A0 (version=C2=A0=C2=A0=C2=A0=C2=A0 "0.1") | =C2=A0=C2=A0=C2=A0 (home-page=C2=A0=C2=A0 #f) | =C2=A0=C2=A0=C2=A0 (synopsis=C2=A0=C2=A0=C2=A0 #f) | =C2=A0=C2=A0=C2=A0 (description #f) | =C2=A0=C2=A0=C2=A0 (license=C2=A0=C2=A0=C2=A0=C2=A0 #f) | =C2=A0=C2=A0=C2=A0 (source=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #f) | | =C2=A0=C2=A0=C2=A0 (build-system trivial-build-system) |=C2=A0=C2=A0=C2=A0=C2=A0 ; NOTE: arguments is now a plain list instead of = a quoted list | =C2=A0=C2=A0=C2=A0 (arguments (list | =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 #:modules '((guix build utils)) |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ; NOTE: builder is now de= fined inside of a gexp, indicated by=20 the #~ | =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 #:builder #~(begin | =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (use-modules (gu= ix build utils)) | | =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (let* ((dir= =C2=A0 (string-append %output "/share")) | =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (file (string-append dir "/foo.txt"))) | =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 (mkdir-p dir) |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 ; NOTE: the local file is now included inline a= s an=20 ungexp'd |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 ;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 form, ind= icated by the #$ | =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 (copy-file #$(local-file "/tmp/foo.txt") file)))))) `--- I hope this was helpful and/or interesting! - Skyler