From: Distopico <distopico@riseup.net>
To: Liliana Marie Prikler <liliana.prikler@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: Guix CLI options through manifest.scm or guix.scm
Date: Tue, 29 Aug 2023 15:05:28 -0500 [thread overview]
Message-ID: <87a5u98v8j.fsf@riseup.net> (raw)
In-Reply-To: <99708f26f2d09bbb930371a773732f9c89bb56f2.camel@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1793 bytes --]
On 2023-08-27, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:
> CLI options are very broadly scoped. For instance, with
> transformations, we have a dedicated procedure to turn them into a
> transformation that can more easily be used inside a manifest. On the
> general side…
>
> … every command is available also as a Scheme procedure that takes its
> arguments as a list directly. Thus, you can quite easily transform the
> above to
>
> (use-modules (guix script shell))
> (guix-shell "-m" "manifest.scm" "--container" "-F" "-N" …)
>
> Of course, if you want to dig deeper, you can also call the functions
> guix-shell ends up calling, but whether doing so makes sense is up for
> you to decide.
>
> Happy hacking!
It works, here the code as a reference for someone else that maybe will
need something similar
;;; coniatner.scm
```
#!/usr/bin/env -S guile -s
!#
(use-modules (guix scripts shell))
(let ((args (list "-m"
"manifest.scm"
"--container"
"-F"
"-N"
"-P"
(string-append "--share=" (getenv "ANDROID_SDK_ROOT"))
"--preserve='^DISPLAY$'"
"--preserve='^XAUTHORITY$'"
"--preserve='^DBUS_'"
(string-append "--expose=" (getenv "XAUTHORITY"))
"--expose=/var/run/dbus"
"--expose=/sys/dev"
"--expose=/sys/devices"
"--expose=/dev/dri"
"--expose=/dev/kvm")))
(apply guix-shell (append args (cdr (command-line)))))
```
and then in `.envrc`
```
eval $(./container.scm --search-paths)
```
or from terminal
```
./container.scm
```
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]
next prev parent reply other threads:[~2023-08-29 20:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-27 18:25 Guix CLI options through manifest.scm or guix.scm Distopico
2023-08-27 19:59 ` Liliana Marie Prikler
2023-08-29 18:43 ` Distopico
2023-08-29 20:05 ` Distopico [this message]
2023-09-14 9:38 ` Ludovic Courtès
2023-09-19 0:12 ` Distopico
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=87a5u98v8j.fsf@riseup.net \
--to=distopico@riseup.net \
--cc=guix-devel@gnu.org \
--cc=liliana.prikler@gmail.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 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).