Subject: system init doesn't work with -e

From: rendaw <[email-masked]>
Date: Sun, 14 Apr 2019 17:46:56 +0900

Package: guix
Version: 0.16.0

I discussed this on irc and was recommended to ask about it on the
mailing list - I decided to send it to the bug tracker because if it's
decided to be a bug there's one less step.

Loosely copying irc logs:

<rendaw> Hello!  I'm getting "wrong number of arguments for action
'init'" when I do "guix system init -e '(my-func arg1 arg2)' /mnt" - is
there something obvious I'm doing wrong?  I googled around but the only
result I found was logs from 2 years ago that are gone now
<rendaw> Also, the docs aren't specific in this regard - will the
filesystem created by "guix system init" be a bootable system?  Like
disk-image but on a mounted empty filesystem?  The other way I could
interpret the docs for that command are that "init" copies all the files
required to build the system (source files, guix binaries, etc) into a
directory for backup purposes
<kmicu> Hi rendaw. why do you pass -e flag to system init?
<rendaw> To pass arguments into the build
<rendaw> (drive uuids, secrets I don't want to commit to the system
config, etc)
<rendaw> I suppose I image it's the same reason one would want to pass
-e to system disk-image or system-vm or whatever

<samplet> Near the bottom of “guix/scripts/system.scm” it has a “case”
form that checks if the action is “init” and then makes sure the
argument count is exactly two.
<samplet> It would be pretty easy to fix, but I recommend contacting the
mailing list before doing anything, in case there is a good reason for it.

<kmicu> rendaw: ‘-e’ contributor didn’t handle init case, intention was
‘(guix-system): Allow commands taking a file as an argument to use an
expression instead.’ but there is a check for init that doesn’t allow
that currently.
<kmicu> rendaw: more at 5a72ddf176d53a7f4df922985d9d7fd4cfa160f5
<rendaw> kmicu: So I guess it sounds unintentional?
<samplet> rendaw: The main issue seems to be that the “process-action”
procedure assumes the target to be the second argument.  If there were
no configuration file, it would have to be the first.
<samplet> I’m not certain, but I bet with a little tweak to
“process-action”, you could remove the check and everything would work fine.
<rendaw> I suppose none of the other actions have a target parameter
<kmicu> rendaw: yep, you are basically the first user using init with
-e. Congrats xD
<rendaw> :D