Subject: [bug#50873] [PATCH 0/5] Fixes to ‘guix home import’

From: Xinglu Chen <[email-masked]>
Date: Fri, 29 Oct 2021 15:37:03 +0200

Hi, (sorry for taking so long to get to this!)

On Wed, Oct 13 2021, Ludovic Courtès wrote:

> Hello,
>
> Xinglu Chen <[email-masked]> skribis:
>
>> Copy the appropriate the relevant configuration files to the destination
>> directory, and call ‘local-file’ on them.
>>
>> Without this, ‘guix home import’ will generate a service declaration like this
>>
>>   (service
>>    home-bash-service-type
>>    (home-bash-configuration
>>     (bashrc
>>      (list (slurp-file-gexp
>>             (local-file "/home/yoctocell/.bashrc"))))))
>>
>> but when running ‘guix home reconfigure’, the ~/.bashrc file would be moved, so
>> when running ‘guix home reconfigure’ for the second time, it would read the
>> ~/.bashrc which is itself a symlink to a file the store.
>
> Ooh, good catch!
>
>> * guix/scripts/home/import.scm (%destination-directory): New parameter.
>> (generate-bash-module+configuration): Adjust accordingly.
>> (modules+configurations): Copy the user’s configuration file to
>> ‘%destination-directory’.
>> * guix/scripts/home.scm (process-command): Adjust accordingly; create
>> ‘%destination-directory’ if it doesn’t exist.
>
> [...]
>
>> +(define %destination-directory
>> +  (make-parameter (string-append (getenv "HOME") "/src/guix-config")))
>
> Instead of making it a parameter, with a default value that looks fishy
> but is never actually used :-), can we make it an explicit parameter of
> ‘generate-bash-module+configuration’?

Ah, that would be a good idea.  :-)