unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Wojtek Kosior via "Development of GNU Guix and the GNU System distribution." <guix-devel@gnu.org>
To: Zhu Zihao <all_but_last@163.com>
Cc: jgart <jgart@dismail.de>, guix-devel@gnu.org
Subject: Re: foreign-distro?
Date: Wed, 23 Nov 2022 13:34:33 +0100	[thread overview]
Message-ID: <20221123133433.46c5d9ea@koszkonutek-tmp.pl.eu.org> (raw)
In-Reply-To: <86k03mvtu3.fsf@163.com>

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

Hi all,

Sorry to tell this - I don't think something like this would be even
possible to implement :/

AFAIK package definition fields like `(inputs)` don't just describe how
the package gets installed. They affect the actual build. So if we
really wanted this feature, we'd need to build 2 separate variants of a
package - one for Guix system and one for foreign distros.

In addition to looking like an overkill, such separate build variants
could also require changes to existing utilities like `guix copy`.

Besides all this, It it not that easy to determine whether Guix is
running under a foreign distro. One idea would be to check whether the
currently-running init system is Shepherd. But what if the user is
running Guix commands inside a Guix system chroot? The Shepherd process
is not going to be visible in such case

Wojtek

-- (sig_start)
website: https://koszko.org/koszko.html
PGP: https://koszko.org/key.gpg
fingerprint: E972 7060 E3C5 637C 8A4F  4B42 4BC5 221C 5A79 FD1A

Meet Kraków saints!           #18: blessed Józef Kowalski
Poznaj świętych krakowskich!  #18: błogosławiony Józef Kowalski
https://pl.wikipedia.org/wiki/Józef_Kowalski_(duchowny)
-- (sig_end)


On Wed, 23 Nov 2022 18:36:49 +0800
Zhu Zihao <all_but_last@163.com> wrote:

> If you want to left the choice to user. You can just don't patch it. Or
> you can always patch it because user can still use package transformer
> to specify a custom ffmpeg.
> 
> 
> jgart <jgart@dismail.de> writes:
> 
> > Does Guix have a declarative Guix API way of knowing if it is installing
> > a package into foreign distro versus Guix System?
> >
> > I'm thinking of a function like `foreign-distro?`:
> >
> > ```
> > (define-public peek
> >   (package
> >    (name "peek")
> >    ...
> > (inputs 
> >   `(,@(if (foreign-distro?) `(("ffmpeg" ,ffmpeg)) '())))
> > ```
> >
> > The above includes ffmpeg in the inputs only if installing peek on a
> > foreign distro. It could additionally patch the ffmpeg executable in
> > a peek package phases if foreign-distro? returns #t.
> >
> > WDYT  
> 
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2022-11-23 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 20:54 foreign-distro? jgart
2022-11-20 22:08 ` foreign-distro? Julien Lepiller
2022-11-21  1:57   ` foreign-distro? Jake Shilling
2022-11-23 10:36 ` foreign-distro? Zhu Zihao
2022-11-23 12:34   ` Wojtek Kosior via Development of GNU Guix and the GNU System distribution. [this message]

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=20221123133433.46c5d9ea@koszkonutek-tmp.pl.eu.org \
    --to=guix-devel@gnu.org \
    --cc=all_but_last@163.com \
    --cc=jgart@dismail.de \
    --cc=koszko@koszko.org \
    /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).