From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id kK0tNYbbG2aPKAEAe85BDQ:P1 (envelope-from ) for ; Sun, 14 Apr 2024 15:35:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id kK0tNYbbG2aPKAEAe85BDQ (envelope-from ) for ; Sun, 14 Apr 2024 15:35:02 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; 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=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713101702; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=bwM6IW5pk01Xrm5LWqlsnuZniDlMVzvEZkjhChxgiQA=; b=bqxSG53ZopPl+4q4BCKM70JRcPBgMmyKeo4XJW7c2VoMtjVWTddRD2t5+xfNiDFRA8Wbn9 rOqk9TimDG+7BZyBWA8wibMnPBZvSnLThe7iDvY3H3D8KG4D1QwP9SVM7GsvHXvMBpJ06r TvqgHaSR5TLawR5bQAvh7s1wwcKLPQfbHmArjKFETBnhJELN3hpDQAeAh24PZm4NzbN4/7 r1fObOrDqPIpHjFN2gxR2/ivaa5p905UaTK5TnSbVJyqNHEJsrl9G1frEtcCFYk9VGhof0 ut3aDcPP05s41rPcEwH2GjDaKPIBk2ucZuhDFWMfAFLgtB5O3XBd7xU/jSpkrg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713101702; a=rsa-sha256; cv=none; b=uHWNeosOL7RPRGbc8BwMOwhPSzDP1BRgI8C9S/570+1w2MFa4PFdj74yI4MtTvQG6C6Qvv ecIIdztzxG/xxw4r5XYuC6l9GoKujpCNfAmqmq5+ugT5uCOCTGJ5NN5o9U6A694x9eiwn6 zm4lAz1OCMv64mGvrSpqsMYUemfr0ALvlr9T+Y/dwPQ0/g7oSG+UZX25NXztSDJIVoOxU7 9ODna5vuDkx4Xnnh/vRvujMSxVHUt5+GHZK+HQ4Op5Ng+7pMezZ5XIq4vvWG9GoLZfg+Ye Sc4NEWY6+HS7VBnIYXECewX+krFIn78hO4W884iDRF4VsJnaHVTIDHTJP5khBg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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 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 A8C92233D6 for ; Sun, 14 Apr 2024 15:35:02 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rvzKC-0003YD-Rq; Sun, 14 Apr 2024 08:51:12 -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 1rvtsr-0001KT-QV for guix-devel@gnu.org; Sun, 14 Apr 2024 03:02:39 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rvtsp-0001hG-3g for guix-devel@gnu.org; Sun, 14 Apr 2024 03:02:37 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 1F8A2240003 for ; Sun, 14 Apr 2024 07:02:27 +0000 (UTC) Message-ID: <0076d418-547a-1de2-6977-afe10d1a4222@purge.sh> Date: Sun, 14 Apr 2024 07:02:25 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Content-Language: en-US To: guix-devel@gnu.org From: spacecadet Subject: Functional package interface Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: spacecadet@purge.sh Received-SPF: pass client-ip=217.70.183.193; envelope-from=spacecadet@purge.sh; helo=relay1-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, 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-Mailman-Approved-At: Sun, 14 Apr 2024 08:51:11 -0400 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.48 X-Spam-Score: -6.48 X-Migadu-Queue-Id: A8C92233D6 X-Migadu-Scanner: mx12.migadu.com X-TUID: b8qoMtWSWbnA Hi guix I started working on a "functional interface" to guix packages, as an approach to globally modifying packages in an environment, similar to nix overlays or the parameterization project. Right now it's just a syntax rule that you can wrap a bunch of package definitions in with some inputs in the style of a let. (define-syntax define-public-package-set (syntax-rules () ((define-public-package-set pkgset ((input ...) ...) (package-name package-def) ...) (begin (define-public pkgset (lambda* (#:optional packages #:key (input ...) ... #:allow-other-keys) (define package-name package-def) ... (cond ((and packages (list? packages)) (map (lambda (package) (cond ((eq? package 'package-name) `(package-name . ,package-name)) ...)) packages)) (packages (cond ((eq? packages 'package-name) package-name) ...)) (else `((package-name . ,package-name) ...))))) (set-procedure-property! pkgset 'package-set? #t) (define-public package-name (pkgset 'package-name)) ...)))) Tried rewriting the guile packages module with it, link to the full code further down but here's a snip: ;; existing module (define-module (gnu packages guile) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) ... ;; package-set definition (define-public-package-set gnu-packages-guile ((bash-minimal bash-minimal) ;; inputs (gawk gawk) (gmp gmp) ... (url-fetch url-fetch)) ;; packages (guile-1.8 (package (name "guile") ... You end up with a public "gnu-packages-guile" function that takes keyword-argument inputs like: (gnu-packages-guile #:gawk (@ (gnu packages bioinformatics) bioawk)) ;; => all the packages in gnu/packages/guile.scm, but every instance ;; of awk is replaced with bioawk Then returns an alist of all the packages in the set with the inputs appropriately "modified". For the keys in the alist I'm using the variable names as symbols instead of the package names like in inputs, because I feel that's more generally appropriate in the case where a package-set might contain something that's not a package record. Will probably write a helper function that spits out input pairs. It can also take a single symbol or list of symbols as an optional argument to produce either a single package or list of requested packages: (gnu-packages-guile 'guile-3.0) ;; => # (#) 619:8 3 (_ #(#(#) # 632:34 2 (_ #(#(#) # 223:20 1 (proc #(#(# In unknown file: 0 (%resolve-variable (5 (gnu packages bash) bash-minimal . ERROR: In procedure %resolve-variable: error: bash-minimal: unbound variable So I'm probably doing something bad. Seems like the first variable in the "inputs" fails to resolve somewhere? I don't even have a guess what's going wrong. My code is available at https://gitlab.vulnix.sh/spacecadet/guix Open to comments or ideas, and if anyone can give me a hand figuring out the pull issue I'd be grateful. - sc