unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: elaexuotee@wilsonb.com
To: Maxime Devos <maximedevos@telenet.be>
Cc: "Ludovic Courtès" <ludovic.courtes@inria.fr>, guix-devel@gnu.org
Subject: Re: Installing a wrapper guile script in <out>/bin
Date: Thu, 04 Feb 2021 04:17:20 +0900	[thread overview]
Message-ID: <37L9FNXG6ZFRG.3DMOOF29K2VAM@wilsonb.com> (raw)
In-Reply-To: <b5b945d70316b7a01ab4c97b76ddc059e74ff08a.camel@telenet.be>

Thank you for the thoughtful input.

Maxime Devos <maximedevos@telenet.be> wrote:
> * forego representing `wrapper-script` as a gexp (using #~), instead represent
>   `wrapper-script` as something quasiquoted.  Then write this expression to
>   a file (with 'write', and include an appropriate shebang line)

> * The procedure ‘program-file’ turns a gexp into a representation of a store item.

After spending most of the day figuring out how to manually create and build
derivations. I hit a fundamental problem including that code in a package def
which made me realize that manually embedding scripts is a flawed approach.

The issue is that a script itself has dependencies, e.g. guile, bash, whatever.
Those dependencies also need to show up in the transitive closure of whatever
package embeds this script.

> * Define a wrapper package.  See wrap-python3 in packages/python.scm
>   for an example. (This option probably has to be combined with one of the
>   first two options.) 

Your suggestion here eventually set me on the right track. Say we want the
final executable to end up at <out>/bin/X. The basic idea is this:

1) Creat original package with a name like X-lib, and leave <out>/bin/X empty,
2) Write a wrapper script as a gexp argument to program-file. In this gexp we
   reference the X-lib package, and finally
3) Create an trivial-build-system package X that includes the program-file
   wrapper as an input. The build step will copy this input script to
   <out>/bin/X!

This way dependencies are correctly tracked, and there's no need for manual
derivation building hackery.

Anyway, thanks for the pointers! They motivated me to keep pushing until
something worked.


  reply	other threads:[~2021-02-03 19:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 11:28 Installing a wrapper guile script in <out>/bin elaexuotee
2021-02-01 16:04 ` Ludovic Courtès
2021-02-03  5:50   ` elaexuotee
2021-02-03 10:00     ` Maxime Devos
2021-02-03 11:04       ` elaexuotee--- via Development of GNU Guix and the GNU System distribution.
2021-02-03 12:12         ` Maxime Devos
2021-02-03 19:17           ` elaexuotee [this message]
2021-02-04  8:56             ` Maxime Devos
  -- strict thread matches above, loose matches on Subject: below --
2021-02-01 12:16 Leo Prikler

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=37L9FNXG6ZFRG.3DMOOF29K2VAM@wilsonb.com \
    --to=elaexuotee@wilsonb.com \
    --cc=guix-devel@gnu.org \
    --cc=ludovic.courtes@inria.fr \
    --cc=maximedevos@telenet.be \
    /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).