Subject: bug#64858: ~guix shell -C -f guix.scm …~ should not always need ~--rebuild-cache~ option to build the expected environment.

From: Ludovic Courtès <[email-masked]>
Date: Wed, 22 Nov 2023 23:59:08 +0100

Hi Felix,

Felix Lechner <[email-masked]> skribis:

> --- a/guix/scripts/shell.scm
> +++ b/guix/scripts/shell.scm
> @@ -398,7 +398,7 @@ (define (key->file key)
>             (values #f #f)))
>        ((('nesting? . #t) . rest)
>         (loop rest system file (append specs '("nested guix"))))
> -      ((('load . ('package candidate)) . rest)
> +      ((('load . ('ad-hoc-package candidate)) . rest)
>         (if (and (not file) (null? specs))
>             (loop rest system candidate specs)
>             (values #f #f)))

Oooh.  So there were really two bugs:

  1. The one you describe Felix, where ‘guix shell -f guix.scm’ would
     cache things in a nonsensical way (as if you had just run ‘guix
     shell’ with no arguments and no ‘guix.scm’ or ‘manifest.scm’ files
     in $PWD).

  2. The use case issue that I understood from Pierre-Henry’s report,
     which is that ‘guix shell -f guix.scm’ shouldn’t have any caching
     in the first place.

I fixed it with these two commits (the first one is almost what you
proposed, Felix):

  5283d24062 shell: Disable caching for ‘guix shell -f guix.scm’.
  762be40098 shell: Correct cache key for ‘guix shell -f guix.scm’.

It seems to do the right thing now.  Let me know what you think!

Thanks,
Ludo’.