[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Functional package interface
From: |
Nicolas Graves |
Subject: |
Re: Functional package interface |
Date: |
Tue, 16 Apr 2024 10:26:20 +0200 |
On 2024-04-16 01:17, spacecadet wrote:
> Hi Nicolas
>
>> Isn't what you're trying to do already in Guix? Have a look at
>> package-inputs-rewrite right there :
>> https://guix.gnu.org/manual/devel/en/html_node/Defining-Package-Variants.html
>
> I want to have this but more powerful, I'd like to do something like
> define an operating system with all instances of a package replaced.
> Maybe something like that is already possible, but I haven't figured
> out a way.
>
> As far as I know, with package-input-rewriting you would still have to
> manually add it to all the services in your operating-system
> definition. Or just use module-set! and manage the environment state
> some other way.
>
> You also only have access to the input fields of packages, this is
> something parameterize packages tackles too, being able to add inputs
> that go anywhere in the package definition. Build phases for example,
> to enable common compile options across multiple packages more easily.
>
>> I've also been working on general package propagation in RDE, it's still
>> a work in progress, but it's not far from it :
>> https://lists.sr.ht/~abcdw/rde-devel/patches/49956
>
> I'll take a look. I knew there had to be more people working on this idea,
> but it's not always easy to find these projects.
In the code there, the function propagate-packages will indeed try and
propagate every package through the graph node.
Four tricky points though :
- propagating some packages that are used in build-systems will trigger
massive rebuilds (e.g. go, emacs, python, ocaml, texlive), you'll
probably have to be smart about what you want to avoid to propagate, but
it's great because guix can already hide a package to
package-inputs-rewriting using (hidden-package {package-name}). There are some
examples in the series.
- some packages are present under different names (emacs has
emacs-minimal, emacs, emacs-pgtk, emacs-wide-int...) and that is not
handled by this function.
- this has a cost. I haven't timed it yet, but the slowdown is
noticeable, though still quite usable.
- you of course have to get the packages into the function from a
profile. Here's it's done in RDE's code, but that should be quite
doable in Guix too.
>
> - sc
--
Best regards,
Nicolas Graves