* Guix CLI options through manifest.scm or guix.scm
@ 2023-08-27 18:25 Distopico
2023-08-27 19:59 ` Liliana Marie Prikler
2023-09-14 9:38 ` Ludovic Courtès
0 siblings, 2 replies; 6+ messages in thread
From: Distopico @ 2023-08-27 18:25 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 867 bytes --]
Is it possible to define/express CLI options from manifest.scm or
guix.scm? For example, I have
```
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?
Best regards!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Guix CLI options through manifest.scm or guix.scm
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
2023-09-14 9:38 ` Ludovic Courtès
1 sibling, 2 replies; 6+ messages in thread
From: Liliana Marie Prikler @ 2023-08-27 19:59 UTC (permalink / raw)
To: Distopico, guix-devel
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!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Guix CLI options through manifest.scm or guix.scm
2023-08-27 19:59 ` Liliana Marie Prikler
@ 2023-08-29 18:43 ` Distopico
2023-08-29 20:05 ` Distopico
1 sibling, 0 replies; 6+ messages in thread
From: Distopico @ 2023-08-29 18:43 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1892 bytes --]
On 2023-08-27, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:
> 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!
Thank you Liliana, I'll tests that option
Best
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Guix CLI options through manifest.scm or guix.scm
2023-08-27 19:59 ` Liliana Marie Prikler
2023-08-29 18:43 ` Distopico
@ 2023-08-29 20:05 ` Distopico
1 sibling, 0 replies; 6+ messages in thread
From: Distopico @ 2023-08-29 20:05 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: guix-devel
[-- 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 --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Guix CLI options through manifest.scm or guix.scm
2023-08-27 18:25 Guix CLI options through manifest.scm or guix.scm Distopico
2023-08-27 19:59 ` Liliana Marie Prikler
@ 2023-09-14 9:38 ` Ludovic Courtès
2023-09-19 0:12 ` Distopico
1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2023-09-14 9:38 UTC (permalink / raw)
To: Distopico; +Cc: guix-devel
Hi,
Distopico <distopico@riseup.net> skribis:
> Is it possible to define/express CLI options from manifest.scm or
> guix.scm? For example, I have
>
> ```
> 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
> ```
There are two things relevant to ‘guix shell’: (1) what packages go
inside the environment, and (2) how the environment is built (container
vs. pure, networking or not, etc.).
The manifest only takes care of #1.
We need a non-CLI way to express #2. I don’t think manifests are a good
fit for that; perhaps we need a new <environment> abstraction, which
might mean we need a new ‘environment.scm’ file or similar.
Anyhow, I agree that something’s missing here.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Guix CLI options through manifest.scm or guix.scm
2023-09-14 9:38 ` Ludovic Courtès
@ 2023-09-19 0:12 ` Distopico
0 siblings, 0 replies; 6+ messages in thread
From: Distopico @ 2023-09-19 0:12 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]
On 2023-09-14, Ludovic Courtès <ludo@gnu.org> wrote:
> Hi,
>
> Distopico <distopico@riseup.net> skribis:
>
>> Is it possible to define/express CLI options from manifest.scm or
>> guix.scm? For example, I have
>>
>> ```
>> 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
>> ```
>
> There are two things relevant to ‘guix shell’: (1) what packages go
> inside the environment, and (2) how the environment is built (container
> vs. pure, networking or not, etc.).
>
> The manifest only takes care of #1.
>
> We need a non-CLI way to express #2. I don’t think manifests are a good
> fit for that; perhaps we need a new <environment> abstraction, which
> might mean we need a new ‘environment.scm’ file or similar.
>
> Anyhow, I agree that something’s missing here.
>
> Thanks,
> Ludo’.
Aren't there many variations/types of files? But still, it would be
ideal to configure it. Perhaps 'envrc.scm' could be another option.
Best!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-19 0:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2023-09-14 9:38 ` Ludovic Courtès
2023-09-19 0:12 ` Distopico
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).