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: Liliana Marie Prikler
Subject: Re: Guix CLI options through manifest.scm or guix.scm
Date: Sun, 27 Aug 2023 21:59:57 +0200
User-agent: Evolution 3.46.4

Hi Distopico

Am Sonntag, dem 27.08.2023 um 13:25 -0500 schrieb Distopico:
> 
> Is it possible to define/express CLI options from manifest.scm or
> guix.scm? For example, I have
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…

> ```
> guix shell \
>      -m manifest.scm \
>      --container -F -N -P \
>      --share=/opt/android-sdk \
>      --share=$HOME/.android/avd \
>      --share=$HOME/.gradle/ \
>      --preserve='^DISPLAY$' \
>      --preserve='^XAUTHORITY$' \
>      --preserve='^DBUS_' \
>      --expose=$XAUTHORITY \
>      --expose=/var/run/dbus
> ```
> 
> Manually invoking this command is not practical, so I have
> `scripts/container.sh`, a script to invoke it, but I think it would
> be much more practical if it's possible to define it in a
> configuration file similar to docker-compose, which allows almost all
> CLI options to be set in the configuration file to avoid having an
> additional configuration file.
> 
> Or perhaps a Guile script instead of a shell script? How do others
> handle this here?
… 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!



reply via email to

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