unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Replacing a package system-wide
@ 2022-03-15  4:29 Dominic Martinez
  2022-03-15  9:00 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Dominic Martinez @ 2022-03-15  4:29 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 1899 bytes --]

One of the things I love about Guix is how easy it is to modify 
dependencies, a feature I use fairly often on individual packages 
or manifests. However, I'm struggling to get a similar effect 
system-wide.

Grafts do exactly what I want, but since they are defined in the 
upstream package definition I can't set them for my personal 
system. Package rewriting lets me do this on a plain list of 
packages, but it's really difficult to do the same for services 
and not possible for guix shell/other command line usage.
#+begin_src scheme
(operating-system
 ;; Package rewriting makes this fairly straight-forward
 (packages (fix-pkg %my-packages))

 ;; But for packages deep in the dependency tree, you have to
 ;; track down every service that has this package as a transient
 ;; dependency and fix it.
 (services
  (service some-pkg-service-type
           (some-pkg-service-configuration
            (some-pkg-service (fix-pkg pkg))))

  ;; Repeat ad-nauseum
  ))
#+end_src

If you're attempting to customize, say, Xorg, this results in a 
very-not-fun-time.

My ideal solution is something like the following:
#+begin_src scheme
;; When installed in a profile, replaces pkg for everything in the
;; profile
(fixed-pkg
 (replaces pkg)
 ...)
#+end_src

Or if that's infeasible, at least something like this:
#+begin_src scheme
(list (channel
        (name 'guix)
        (url "https://git.savannah.gnu.org/git/guix.git")
        (replacements `((,pkg . ,fixed-pkg)))
        ...))
#+end_src

I'm thinking this falls into one of the following:
1. I'm dumb and there's an obvious solution
2. I should be using a local checkout for this type of work and 
not the upstream Guix channel
3. There's no good mechanism for this, and a patch would be 
welcomed

I'd appreciate any advice here, as this feels so much like 
something Guix should do surely others have stumbled on this 
before. Thank you!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Replacing a package system-wide
  2022-03-15  4:29 Replacing a package system-wide Dominic Martinez
@ 2022-03-15  9:00 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2022-03-15  9:00 UTC (permalink / raw)
  To: Dominic Martinez; +Cc: help-guix

Hello,

Dominic Martinez <dom@dominicm.dev> skribis:

> One of the things I love about Guix is how easy it is to modify 
> dependencies, a feature I use fairly often on individual packages 
> or manifests. However, I'm struggling to get a similar effect 
> system-wide.
>
> Grafts do exactly what I want, but since they are defined in the 
> upstream package definition I can't set them for my personal 
> system. Package rewriting lets me do this on a plain list of 
> packages, but it's really difficult to do the same for services 
> and not possible for guix shell/other command line usage.
>
> #+begin_src scheme
> (operating-system
>  ;; Package rewriting makes this fairly straight-forward
>  (packages (fix-pkg %my-packages))
>
>  ;; But for packages deep in the dependency tree, you have to
>  ;; track down every service that has this package as a transient
>  ;; dependency and fix it.
>  (services
>   (service some-pkg-service-type
>            (some-pkg-service-configuration
>             (some-pkg-service (fix-pkg pkg))))
>
>   ;; Repeat ad-nauseum
>   ))
> #+end_src

This is correct: there’s currently no general package-rewriting
mechanism for ‘operating-system’ as a whole.  As a result, you have to
customize individual services like you show above.

I agree it would be nice to offer a programatic way to replace packages,
though I’m not sure what it should look like.

Right now it’s tricky to peek at all the packages that services refer
to, because in the end, these references are embedded in gexps that are
“lowered” to files such as Shepherd service definitions.  We would need
a hook (at the gexp level? at a higher level?) to interpose on all
package references that get lowered.

Food for thought…

Ludo’.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-15  9:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15  4:29 Replacing a package system-wide Dominic Martinez
2022-03-15  9:00 ` Ludovic Courtès

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).