guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parameterized packages


From: zimoun
Subject: Re: Parameterized packages
Date: Tue, 21 Jan 2020 20:04:00 +0100

On Tue, 21 Jan 2020 at 14:13, Pierre Neidhardt <address@hidden> wrote:
>
> zimoun <address@hidden> writes:
>
> >> > --8<---------------cut here---------------start------------->8---
> >> > (define (make-me-a-package option1 option2)
> >> >     (package
> >> >       …))
> >> > --8<---------------cut here---------------end--------------->8---
> >>
> >> The ellipsis is a bit vague here.  What is this trying to do?
> >
> > What you wrote below. :-)
>
> ?

--8<---------------cut here---------------start------------->8---
(define (make-me-a-package VIDEO-PLAYER PYTHON-VERSION WITH-FFMPEG)
   (package
        [all your "messy" code using stuff]
      ))

(define-public you-get-vlc
    (make-me-a-package 'vlc 'python #t))
--8<---------------cut here---------------start------------->8---



> > And my opinion is that you described is already possible (more or
> > less) using 'inherit'. Except the modification of the compiling
> > options (build-system).
>
> The crucial difference is the current approach with inherit /does not
> compose/.  This is where USE flags stand strong because you can tell
> what happens when both flags X and Y are set, e.g.

I do not understand what you do mean by "does not compose".


To me, a package is:
"./configure && make && make check && make install"
so I understand why tweak the flags used by "./configure", for example
change "--with-vlc=" from the default 0 to the tuned 1. Or use another
compiling toolchain.
I understand also these flags could require different inputs.

And again from my understanding, this is more or less cover by
'inherit'. Or some macrology should be improved in 'package/inherit'
or in 'records.scm', i.e., something more fine grained when
inheriting.


--8<---------------cut here---------------start------------->8---
(define (make-you-get VIDEO-PLAYER PYTHON-VERSION WITH-FFMPEG)
  (package
     (inherit you-get
        #:add-inputs
         `(("PLAYER" ,VIDEO-PLAYER))
           ,@(IF WITH-FFMPEG)
             ;; FOR MULTI-PART AND >=1080P VIDEOS
             `("FFMPEG" ,FFMPEG)
        #:replace-arguments ...
       #:add-phase ...
             '())))

(define-public you-get-vlc (make-you-get 'vlc))
--8<---------------cut here---------------end--------------->8---


Something like that. And everything is more controlled, i.e., no mess
with global parameters.

What you want to do is: add/remove/replace inputs/arguments so
#:add-inputs, #:remove-native-inputs, etc.

And this composes in the same way function composes. And yes, it
composes explicitly which can be annoying, But implicit composition
will end up to the Gentoo USE flag mess, IMHO.



> >> - To let the user choose which video player to use.  This is a popular
> >>   USE flag on Gentoo (maybe with a different name).
> >
> > What I do not understand is: people who used Gentoo and especially USE
> > flag are saying that it ends with a big mess with broken packages.
> > Therefore, why does Guix want to reproduce the mess?
>
> Because it is extremely powerful: in a simple declaration like "no-X +
> pulseaudio + python3 + gtk2" you can build /your entire system/,
> according to the flags you've set, in just one command.

Hum? but months later your system is broken... so I am not convinced
it is powerful. :-)

It is broken because composing complex system is an hard task. Typing
helps a bit to detect error at compile time (in this case at building
package time) but run-time errors will still remain and it will be
hard time to find them.

Cheers,
simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]