guix-devel
[Top][All Lists]
Advanced

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

Re: Guix CLI options through manifest.scm or guix.scm


From: Distopico
Subject: Re: Guix CLI options through manifest.scm or guix.scm
Date: Tue, 29 Aug 2023 15:05:28 -0500

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: signature.asc
Description: PGP signature


reply via email to

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