all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Edouard Klein <edou@rdklein.fr>
To: phodina <phodina@protonmail.com>
Cc: help-guix@gnu.org
Subject: Re: Sourcing a script in phases
Date: Mon, 26 Dec 2022 22:37:52 +0100	[thread overview]
Message-ID: <878ritvo75.fsf@rdklein.fr> (raw)
In-Reply-To: <V1D7gLvYrPmz1r0ZQVqylr7eNd9E_kc4E6Cfx-9G2dBbGgrVa3A2yEKsG63z7E-asJKriFdmcWJzqJYI6j_DeuEne082dKHVNc5OVMHgDd4=@protonmail.com>

Hi,

It's probably not the right answer, but for lack of time to find the
actual solution when I faced the same problem as you, here is what I
did:

https://gitlab.com/edouardklein/guix/-/blob/beaverlabs/beaver/packages/python-xyz.scm#L191

#+begin_src scheme
#:builder
      (begin
        (use-modules (guix build utils))
        (let* ((bash (assoc-ref %build-inputs "bash"))
               (requisomatic (assoc-ref %build-inputs "requisomatic"))
               (dir (string-append (assoc-ref %outputs "out") "/bin"))
               (fname (string-append dir "/requisomatic-server")))
          (mkdir-p  dir)
          (with-output-to-file fname
            (lambda _
              (display (string-append "#!" bash "/bin/bash\n"))
              (display "source /run/current-system/profile/etc/profile\n")
              (display "REQUISOMATIC_DB_FILE=$1 gunicorn --bind=$2 --pid=$3 requisomatic:app\n")))
          (chmod fname #o755)
          #t))))
#+end_src

Basically this creates a shell script that sources whatever you want to
source, and then call the executable you want to call.

This is not exactly what you want to do, but you can use this technique
to create a script that will run the build commands you want to run, and
then call it during the build phase.

Again, this is probably not the right answer.

Cheers,

Edouard.
phodina via <help-guix@gnu.org> writes:

> Hi,
>
> is there a way to source a script in the phases?
> I tried to do:
>
> (invoke "source" "env.sh")
> or
> (invoke "." "env.sh")
>
> But it didn't work since they are builtin in the shell.
>
> ----
> Petr


  parent reply	other threads:[~2022-12-26 21:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-25 22:43 Sourcing a script in phases phodina via
2022-12-26 12:52 ` Reza Housseini
2022-12-26 21:37 ` Edouard Klein [this message]
2022-12-27 23:25   ` phodina

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878ritvo75.fsf@rdklein.fr \
    --to=edou@rdklein.fr \
    --cc=help-guix@gnu.org \
    --cc=phodina@protonmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.