Hello!
Thanks for the CC, Josselin!
I like Maxim's idea of providing all kinds of arguments through a separate
file or stdin.
Here's a tiny proof-of-concept script implementing that:
-----guix-shell-with-args.sh----
#!/usr/bin/env bash
argstr=""
while read line
do
  argstr="$argstr $line"
done < "${1:-/dev/stdin}"

guix shell $argstr
----------------------------------------
This takes arguments from either a file or stdin.
It is also possible to provide an arg file and supply additional arguments
from stdin (i.e. echo "arguments" | ./guix-shell-with-args.sh
/some/file-containing-args will take arguments from both)
This functionality could be baked into guix shell itself, wherein if you
pass an argument (say "-a") it will read arguments from either a supplied
file or stdin.
(of course, some error handling needs to be added)
I would like to have a more lisp-y way of doing this, however, if I'm being
honest.
Perhaps we could add some code that goes over a list from stdin/files?
Input could potentially look like this:
'(C N (with-source pkgname src) (with-input a b))
which would give
guix shell -C -N --with-source=pkgname=src --with-input=a=b
Wdyt?

---
Happy hacking!
Sarthak

On Thu, Mar 23, 2023 at 8:53 PM Ricardo Wurmus <rek...@elephly.net> wrote:

>
> Maxim Cournoyer <maxim.courno...@gmail.com> writes:
>
> >> Considering that the transformations API assumes that you understand
> >> that higher order functions exist and what to do with them, I think it
> >> would be good to offer a slightly less advanced method of overriding
> >> packages.
> >>
> >> Manifests can do anything, but this also makes them rather intimidating
> >> for many of my colleagues.
> >
> > OK; then my question would be: why stop at transformations?  Perhaps we
> > could simply have a way to feed arbitrary guix command line arguments
> > from a file, e.g.
> >
> > guix shell --args-file=my-arguments.txt
>
> The transformations command line options are rather verbose:
>
>   --with-input=python-pytorch=python-pytorch-with-extra-features
>
> I think it would improve usability to be able to use the *same* names in
> an override file.  Got a package with name “python-pytorch” in that
> file?  It replaces “python-pytorch” in the graph.
>
> ~~
>
> On the separate topic of reading arguments from elsewhere, though, I
> think being able to read arguments from stdin could be useful.  Without
> having to add a new option one could then do
>
>     guix shell < my-arguments.txt
>
> --
> Ricardo
>
>

Reply via email to