unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: "Sergio Pastor Pérez" <sergio.pastorperez@outlook.es>
Cc: guix-devel@gnu.org,  michal_atlas+gnu@posteo.net,
	 "juli@incana.org" <juli@incana.org>
Subject: Re: New procedure to modify operating-system records
Date: Thu, 27 Jun 2024 15:17:24 +0200	[thread overview]
Message-ID: <87y16q5xuj.fsf@gnu.org> (raw)
In-Reply-To: <PAXP251MB03482988E9DEC2DF663EEC4EF3CB2@PAXP251MB0348.EURP251.PROD.OUTLOOK.COM> ("Sergio Pastor Pérez"'s message of "Sun, 23 Jun 2024 18:13:48 +0200")

Hi Sergio,

Sergio Pastor Pérez <sergio.pastorperez@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	other threads:[~2024-06-27 13:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-23 16:13 New procedure to modify operating-system records Sergio Pastor Pérez
2024-06-27 13:17 ` Ludovic Courtès [this message]
2024-06-30 15:23   ` Sergio Pastor Pérez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y16q5xuj.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=juli@incana.org \
    --cc=michal_atlas+gnu@posteo.net \
    --cc=sergio.pastorperez@outlook.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).