guix-devel
[Top][All Lists]
Advanced

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

Re: more package transformations: overrides


From: Maxim Cournoyer
Subject: Re: more package transformations: overrides
Date: Fri, 24 Mar 2023 08:30:29 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi!

Sarthak Shah <shahsarthakw@gmail.com> writes:

> 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

By separate file or stdin your really mean stdin, correct?  As in:

--8<---------------cut here---------------start------------->8---
guix something < args.txt or
echo "$args" | guix something
--8<---------------cut here---------------end--------------->8---

One note: since this mechanism could be generally useful, it should be
globally available (like 'guix build' options), for any 'guix'
invocation.

> ----------------------------------------
> 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?

At this point, we have a real Scheme API we can use :-).  If there's a
problem with using that, we should work toward improving it.

-- 
Thanks,
Maxim



reply via email to

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