Re: Replacing a package system-wide

2022-03-15 Thread Ludovic Courtès
Hello,

Dominic Martinez  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’.



Replacing a package system-wide

2022-03-14 Thread Dominic Martinez
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!


signature.asc
Description: PGP signature