help-guix
[Top][All Lists]
Advanced

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

Re: Sourcing a script in phases


From: Edouard Klein
Subject: Re: Sourcing a script in phases
Date: Mon, 26 Dec 2022 22:37:52 +0100
User-agent: mu4e 1.8.9; emacs 28.2

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



reply via email to

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