unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sarthak Shah <shahsarthakw@gmail.com>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>, guix-devel@gnu.org
Subject: Re: more package transformations: overrides
Date: Fri, 24 Mar 2023 13:51:05 +0530	[thread overview]
Message-ID: <CADBZEVmNtS--poaSM+YpD+9-gqyKac3RPfQt8N_KTXAPqF702w@mail.gmail.com> (raw)
In-Reply-To: <87cz4zijag.fsf@elephly.net>

[-- Attachment #1: Type: text/plain, Size: 2581 bytes --]

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 <rekado@elephly.net> wrote:

>
> Maxim Cournoyer <maxim.cournoyer@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
>
>

[-- Attachment #2: Type: text/html, Size: 3397 bytes --]

  reply	other threads:[~2023-03-24 15:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  9:55 more package transformations: overrides Ricardo Wurmus
2023-03-22 11:00 ` Josselin Poiret
2023-03-22 14:38 ` Ludovic Courtès
2023-03-22 18:09 ` Maxim Cournoyer
2023-03-22 20:36   ` Ricardo Wurmus
2023-03-23  2:56     ` Maxim Cournoyer
2023-03-23  9:32       ` Ricardo Wurmus
2023-03-24  8:21         ` Sarthak Shah [this message]
2023-03-24 12:30           ` Maxim Cournoyer
2023-03-24 14:05             ` Sarthak Shah
2023-03-24 16:09               ` Maxim Cournoyer
2023-03-24 12:32         ` Maxim Cournoyer
     [not found]           ` <87r0tdgqbu.fsf@elephly.net>
2023-03-26  2:26             ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADBZEVmNtS--poaSM+YpD+9-gqyKac3RPfQt8N_KTXAPqF702w@mail.gmail.com \
    --to=shahsarthakw@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    --cc=rekado@elephly.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).