[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 <https://issues.guix.info/issue/35671> 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:
(package
(name "glibc-utf8-locales")
;; …
(arguments
`(#:phases … ,(assoc-ref (package-properties this-package)
'locales)
…)))
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:
(package
(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?
Thanks,
Ludo’.
- Parameterized packages,
Ludovic Courtès <=