From: "Théo Tyburn" <theo.tyburn@posteo.net>
To: Felix Lechner <felix.lechner@lease-up.com>
Cc: Tomas Volf <wolf@wolfsden.cz>, help-guix@gnu.org
Subject: Re: Make a simple guile script to a package - source local file
Date: Sat, 20 Jan 2024 17:19:05 +0000 [thread overview]
Message-ID: <875xznj4n7.fsf@posteo.net> (raw)
In-Reply-To: <87a5p1yp24.fsf@lease-up.com>
Hi Felix,
Felix Lechner <felix.lechner@lease-up.com> writes:
> Hi Théo,
>
> On Fri, Jan 19 2024, Théo Tyburn wrote:
>
>> How do I go about packaging it to make the script available from the command line
>> without polluting the environment with the dependencies ?
>
> The best way is wrap-program, or my forthcoming wrap-executable.
>
> Kind regards
> Felix
This is what I was looking for, thanks !
If someone is interested, here is my function to wrap a python script in a package:
#+BEGIN_SRC scheme
(define*-public (python-script-package name source-dir source-file #:key (inputs '()))
(package
(name name)
(version "")
(source (local-file (string-append source-dir "/" source-file) #:recursive? #t))
(build-system copy-build-system)
(inputs (cons python inputs))
(arguments (list #:install-plan #~'((#$source-file #$(string-append "bin/" name)))
#:phases
`(modify-phases %standard-phases
(add-after 'strip 'wrap-python-scripts
(lambda* (#:key outputs #:allow-other-keys)
;; Make sure program runs with the correct PYTHONPATH.
(wrap-program (search-input-file outputs (string-append "bin/" ,name))
`("GUIX_PYTHONPATH" ":"
prefix (,(getenv "GUIX_PYTHONPATH")))))))))
(home-page "")
(synopsis "")
(description "")
(license license:lgpl3+)))
#+END_SRC
It works like a charm with my guix home declaration :)
Happy hacking !
next prev parent reply other threads:[~2024-01-20 17:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 18:01 Make a simple guile script to a package - source local file Théo Tyburn
2023-10-26 14:18 ` Tomas Volf
2023-10-29 8:44 ` Théo Tyburn
2024-01-19 21:28 ` Théo Tyburn
2024-01-19 21:46 ` Felix Lechner via
2024-01-20 17:19 ` Théo Tyburn [this message]
2024-01-19 22:44 ` Richard Sent
2024-01-20 12:32 ` Théo Tyburn
2024-01-20 13:29 ` Tomas Volf
2024-01-20 18:05 ` Théo Tyburn
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=875xznj4n7.fsf@posteo.net \
--to=theo.tyburn@posteo.net \
--cc=felix.lechner@lease-up.com \
--cc=help-guix@gnu.org \
--cc=wolf@wolfsden.cz \
/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.
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).