Hi Sergio,

Sergio Pastor Pérez <sergio.pastorpe...@outlook.es> skribis:

> I'm writing this mail from a system that grafts `mesa` for the
> `nvidia-driver` available in [1]. Although I'm aware that this is not
> the place to discuss proprietary stuff, this is not about running an
> NVIDIA system. This enables any Guix user to arbitrarily replace
> packages system-wide. One could replace `glibc` for `glibc-custom`. I'm
> using the NVIDIA graft as an example because it's what I have at hand
> that would test that the graft applies system-wide effectively.
>
> The procedure allows the user to apply a function to all elements of a
> collection that match a certain type. With this new procedure one could
> write something like this:
>
> (map-type
>   (lambda (_)
>     (@ (gnu packages games) cowsay))
>   (@ (guix packages) <package>)
>   my-operating-system)

That sounds useful!

> The complete implementation can be found in my personal channel [2].

[...]

> [2] 
> https://codeberg.org/shepherd/omega/src/commit/0d45b10f709cfbc70c3ec756933f09a296a9d6e3/pastor/utils/gpu-specification.scm#L51

My main concern with this approach is that it breaks abstractions.
Ideally, records would only be accessed through their public accessors
(which might perform additional processing, such as unpacking ‘thunked’
fields) and created by their public contructors (which might do things
like run field “sanitizers”).  We always (almost) keep record type
descriptors (the <angle-bracket> things) private also for this reason.

So while I think the feature is much welcome, I believe we should strive
for an implementation that doesn’t break abstractions.

As I mentioned earlier, one option would be to apply transformations at
the derivation-level: take the OS derivation and use ‘map-derivation’ to
map, say, the derivation of one package to another one.  The advantage
is that we’re guaranteed to not miss a single package; the downside is
that it’s low-level and might not perform well.

Food for thought!

Ludo’.

Reply via email to