From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Parameterized packages Date: Tue, 14 May 2019 13:54:18 +0200 Message-ID: <87woitz1xx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:59572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWEg-0001FV-L5 for Guix-devel@gnu.org; Tue, 14 May 2019 08:08:50 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34243) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQW0l-0002j4-42 for Guix-devel@gnu.org; Tue, 14 May 2019 07:54:23 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=47576 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hQW0k-0003R2-JU for Guix-devel@gnu.org; Tue, 14 May 2019 07:54:22 -0400 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+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Guix-devel Hello Guix! While thinking about and looking for ways to allow users to install just the locales they need right from =E2=80=98guix package=E2=80=99, I realized that =E2=80=9Cparameterized pack= ages=E2=80=9D are a low-hanging fruit (by =E2=80=9Cparameterized packages=E2=80=9D I mean somet= hing kinda like Gentoo USE flags, or like a procedure if you will, but with a command-line interface.) Namely, one could write: (package (name "glibc-utf8-locales") ;; =E2=80=A6 (arguments `(#:phases =E2=80=A6 ,(assoc-ref (package-properties this-package) 'locales) =E2=80=A6))) and then we=E2=80=99d have a package transformation option like, say, =E2=80=98--with-argument=3Dglibc-utf8-locales:locales=3Dzh_CN.utf8=E2=80=99= , which would add the right property, like so: (package (inherit glibc-utf8-locales) (properties `((locales . ("zh_CN.utf8"))))) and tadaam! we have a parameterized package. There=E2=80=99s a couple of gotchas: =E2=80=A2 We=E2=80=99d need to store more info in manifest entries so that transformation options are preserved upon =E2=80=98guix upgrade=E2=80= =99. =E2=80=A2 We might need to expose the package parameters somehow, so that= if one types =E2=80=98--with-argument=3Dfoobar=3Dbaz=E2=80=99, they get a = correct error message saying that =E2=80=9Cfoobar=E2=80=9D is not a known parameter. =E2=80=A2 We might want to make the CLI option less verbose too, but how? Thoughts, comrades? Thanks, Ludo=E2=80=99.