Subject: bug#66358: Can't import package using archive command

From: Tobias Geerinckx-Rice <[email-masked]>
Date: Mon, 09 Oct 2023 14:25:51 +0200

retitle 66358 ‘guix archive --{authorize,import,…}’ are really 
subcommands + ignore some arguments
thanks

Hi Daniel,

The error is correct, so I sure hope it's reproducible!

Later options cancel out previous ones, so your ‘--authorize’ action 
takes precedence over ‘--import’.  You're passing it a binary .nar 
archive as a private key (which is an s-expression).

Boom.

Instead:

   1.  guix archive --export hello > hello.nar
   2.  guix archive --authorize < export-host.private-key
   3.  guix archive --import < hello.nar

Note that you had an extra ‘hello’ in your --import command as well.  
Please note that it does nothing.  Option parsing in Guix is 
surprisingly lax.

I started thinking about a nice way to make ‘--action’ options mutually 
exclusive, but reconsidered.  I think it would violate POLA if not 
POSIX.

I think it would be less surprising if these ‘single, mutually exclusive 
actions’ should always be (sub)subcommands, e.g., ‘guix archive import’, 
‘guix archive authorize’, …

I don't know if that change is still worth making here.

Kind regards,

T G-R

Sent from a Web browser.  Excuse or enjoy my brevity.