[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Parameterized packages

From: Ludovic Courtès
Subject: Parameterized packages
Date: Tue, 14 May 2019 13:54:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Hello Guix!

While thinking about <> and looking
for ways to allow users to install just the locales they need right from
‘guix package’, I realized that “parameterized packages” are a
low-hanging fruit (by “parameterized packages” I mean something kinda
like Gentoo USE flags, or like a procedure if you will, but with a
command-line interface.)

Namely, one could write:

    (name "glibc-utf8-locales")
    ;; …
      `(#:phases … ,(assoc-ref (package-properties this-package)

and then we’d have a package transformation option like, say,
‘--with-argument=glibc-utf8-locales:locales=zh_CN.utf8’, which would
add the right property, like so:

    (inherit glibc-utf8-locales)
    (properties `((locales . ("zh_CN.utf8")))))

and tadaam! we have a parameterized package.

There’s a couple of gotchas:

  • We’d need to store more info in manifest entries so that
    transformation options are preserved upon ‘guix upgrade’.

  • We might need to expose the package parameters somehow, so that if
    one types ‘--with-argument=foobar=baz’, they get a correct error
    message saying that “foobar” is not a known parameter.

  • We might want to make the CLI option less verbose too, but how?

Thoughts, comrades?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]