all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
@ 2023-03-19 15:45 Sergey Trofimov
  2023-03-20  6:52 ` bug#62274: " Andrew Tropin
  2023-03-20 17:33 ` [bug#62274] " Ludovic Courtès
  0 siblings, 2 replies; 9+ messages in thread
From: Sergey Trofimov @ 2023-03-19 15:45 UTC (permalink / raw)
  To: 62274; +Cc: Sergey Trofimov, paren, andrew, ludo

* gnu/home.scm (home-environment-with-provenance): Make `config-file`
optional, with the default taken from the HE location info.
---
 gnu/home.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/home.scm b/gnu/home.scm
index 6d3f705758..2fefe7ba53 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -103,7 +103,21 @@ (define* (home-environment-derivation he)
                               #:target-type home-service-type)))
     (service-value home)))
 
-(define* (home-environment-with-provenance he config-file)
+
+(define (home-environment-configuration-file he)
+  "Return the configuration file of HE, based on its 'location' field, or #f
+if it could not be determined."
+  (let ((file (and=> (home-environment-location he)
+                     location-file)))
+    (and file
+         (or (and (string-prefix? "/" file) file)
+             (search-path %load-path file)))))
+
+(define* (home-environment-with-provenance he
+                                           #:optional
+                                           (config-file
+                                            (home-environment-configuration-file
+                                             he)))
   "Return a variant of HE that stores its own provenance information,
 including CONFIG-FILE, if available.  This is achieved by adding an instance
 of HOME-PROVENANCE-SERVICE-TYPE to its services."
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#62274: [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
  2023-03-19 15:45 [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info Sergey Trofimov
@ 2023-03-20  6:52 ` Andrew Tropin
  2023-03-20 17:33 ` [bug#62274] " Ludovic Courtès
  1 sibling, 0 replies; 9+ messages in thread
From: Andrew Tropin @ 2023-03-20  6:52 UTC (permalink / raw)
  To: Sergey Trofimov, 62274-done; +Cc: paren, ludo, Sergey Trofimov

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

On 2023-03-19 16:45, Sergey Trofimov wrote:

> * gnu/home.scm (home-environment-with-provenance): Make `config-file`
> optional, with the default taken from the HE location info.
> ---
>  gnu/home.scm | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/home.scm b/gnu/home.scm
> index 6d3f705758..2fefe7ba53 100644
> --- a/gnu/home.scm
> +++ b/gnu/home.scm
> @@ -103,7 +103,21 @@ (define* (home-environment-derivation he)
>                                #:target-type home-service-type)))
>      (service-value home)))
>  
> -(define* (home-environment-with-provenance he config-file)
> +
> +(define (home-environment-configuration-file he)
> +  "Return the configuration file of HE, based on its 'location' field, or #f
> +if it could not be determined."
> +  (let ((file (and=> (home-environment-location he)
> +                     location-file)))
> +    (and file
> +         (or (and (string-prefix? "/" file) file)
> +             (search-path %load-path file)))))
> +
> +(define* (home-environment-with-provenance he
> +                                           #:optional
> +                                           (config-file
> +                                            (home-environment-configuration-file
> +                                             he)))
>    "Return a variant of HE that stores its own provenance information,
>  including CONFIG-FILE, if available.  This is achieved by adding an instance
>  of HOME-PROVENANCE-SERVICE-TYPE to its services."

Thank you for the patch, applied and pushed as
1f36534c7e8f2325bff4df5d37ecc811dc63fc38.

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
  2023-03-19 15:45 [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info Sergey Trofimov
  2023-03-20  6:52 ` bug#62274: " Andrew Tropin
@ 2023-03-20 17:33 ` Ludovic Courtès
  2023-03-20 19:03   ` Sergey Trofimov
  1 sibling, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2023-03-20 17:33 UTC (permalink / raw)
  To: Sergey Trofimov; +Cc: 62274, paren, andrew

Hi Sergey and all,

Sergey Trofimov <sarg@sarg.org.ru> skribis:

> * gnu/home.scm (home-environment-with-provenance): Make `config-file`
> optional, with the default taken from the HE location info.

[...]

> +(define* (home-environment-with-provenance he
> +                                           #:optional
> +                                           (config-file
> +                                            (home-environment-configuration-file
> +                                             he)))

AFAICS, there’s only one call site for
‘home-environment-with-provenance’, and it passes two arguments.  Thus,
the default value added by this patch will never be used.

Am I missing something?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
  2023-03-20 17:33 ` [bug#62274] " Ludovic Courtès
@ 2023-03-20 19:03   ` Sergey Trofimov
  2023-03-21  9:44     ` Ludovic Courtès
  2023-03-21 10:56     ` Andrew Tropin
  0 siblings, 2 replies; 9+ messages in thread
From: Sergey Trofimov @ 2023-03-20 19:03 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 62274, paren, andrew


Hi Ludovic,

> Hi Sergey and all,
>
> Sergey Trofimov <sarg@sarg.org.ru> skribis:
>
>> * gnu/home.scm (home-environment-with-provenance): Make 
>> `config-file`
>> optional, with the default taken from the HE location info.
>
> [...]
>
>> +(define* (home-environment-with-provenance he
>> +                                           #:optional
>> +                                           (config-file
>> + 
>> (home-environment-configuration-file
>> +                                             he)))
>
> AFAICS, there’s only one call site for
> ‘home-environment-with-provenance’, and it passes two arguments. 
> Thus,
> the default value added by this patch will never be used.
>
> Am I missing something?

You're right, the new signature is not used anywhere yet. Though 
I'm working on a patch to embed home profiles in disk images 
produced with `guix system image`. That's where this method comes 
handy, see example usage:

(image
 (inherit efi-disk-image)
 (operating-system (operating-system-with-provenance (load 
 "./system.scm")))
 (inputs
  `(("guix-home"
     ,(home-environment-with-provenance (load "./home.scm")))))
 (partition-table-type 'gpt)
 (volatile-root? #false))




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
  2023-03-20 19:03   ` Sergey Trofimov
@ 2023-03-21  9:44     ` Ludovic Courtès
  2023-03-21 10:56     ` Andrew Tropin
  1 sibling, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2023-03-21  9:44 UTC (permalink / raw)
  To: Sergey Trofimov; +Cc: 62274, paren, andrew

Hi,

Sergey Trofimov <sarg@sarg.org.ru> skribis:

> You're right, the new signature is not used anywhere yet. Though I'm
> working on a patch to embed home profiles in disk images produced with
> `guix system image`. That's where this method comes handy, see example
> usage:

OK, interesting!

(In general I think it’s best to submit the new interface and its user
together, so reviewers get an overview of where this is going.)

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
  2023-03-20 19:03   ` Sergey Trofimov
  2023-03-21  9:44     ` Ludovic Courtès
@ 2023-03-21 10:56     ` Andrew Tropin
  2023-03-21 12:22       ` Sergey Trofimov
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Tropin @ 2023-03-21 10:56 UTC (permalink / raw)
  To: Sergey Trofimov, Ludovic Courtès; +Cc: 62274, paren

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

On 2023-03-20 20:03, Sergey Trofimov wrote:

> Hi Ludovic,
>
>> Hi Sergey and all,
>>
>> Sergey Trofimov <sarg@sarg.org.ru> skribis:
>>
>>> * gnu/home.scm (home-environment-with-provenance): Make 
>>> `config-file`
>>> optional, with the default taken from the HE location info.
>>
>> [...]
>>
>>> +(define* (home-environment-with-provenance he
>>> +                                           #:optional
>>> +                                           (config-file
>>> + 
>>> (home-environment-configuration-file
>>> +                                             he)))
>>
>> AFAICS, there’s only one call site for
>> ‘home-environment-with-provenance’, and it passes two arguments. 
>> Thus,
>> the default value added by this patch will never be used.
>>
>> Am I missing something?
>
> You're right, the new signature is not used anywhere yet. Though 
> I'm working on a patch to embed home profiles in disk images 
> produced with `guix system image`. That's where this method comes 
> handy, see example usage:
>
> (image
>  (inherit efi-disk-image)
>  (operating-system (operating-system-with-provenance (load 
>  "./system.scm")))
>  (inputs
>   `(("guix-home"
>      ,(home-environment-with-provenance (load "./home.scm")))))
>  (partition-table-type 'gpt)
>  (volatile-root? #false))

Also, take a look at this thread:
https://yhetil.org/63960cf762aec1ed2c4182f49cac66bc37fce2aa.camel@rdmp.org

and this prototype:
https://git.sr.ht/~abcdw/rde/tree/044de83e980b7038b87d27a090aef24229df85eb/src/gnu/services/home.scm#L1

It can be related to what you want to achieve, whithout modifying
image-related code.

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
  2023-03-21 10:56     ` Andrew Tropin
@ 2023-03-21 12:22       ` Sergey Trofimov
  2023-03-21 13:38         ` Andrew Tropin
  0 siblings, 1 reply; 9+ messages in thread
From: Sergey Trofimov @ 2023-03-21 12:22 UTC (permalink / raw)
  To: Andrew Tropin; +Cc: 62274, paren, Ludovic Courtès


Hi Andrew,

Andrew Tropin <andrew@trop.in> writes:

> [[PGP Signed Part:Undecided]]
> On 2023-03-20 20:03, Sergey Trofimov wrote:
>
>>
>> You're right, the new signature is not used anywhere yet. 
>> Though
>> I'm working on a patch to embed home profiles in disk images
>> produced with `guix system image`. That's where this method 
>> comes
>> handy, see example usage:
>>
>
> Also, take a look at this thread:
> https://yhetil.org/63960cf762aec1ed2c4182f49cac66bc37fce2aa.camel@rdmp.org
>
> and this prototype:
> https://git.sr.ht/~abcdw/rde/tree/044de83e980b7038b87d27a090aef24229df85eb/src/gnu/services/home.scm#L1
>
> It can be related to what you want to achieve, whithout 
> modifying
> image-related code.

Brilliant! That's it. It didn't come to me that `home-environment` 
could be a dependency of `operating-system` and not of the image 
itself. And you also made the service to activate it, so no manual 
step is required. That's exactly what I have envisioned. What 
prevents you to mainline it? It seems you have already 
battle-tested it.

The only concern is that I'd rather include 
`guix-home-service-type` only in the first generation of the 
system. I think that this tie between user envs and the operating 
system makes sense only on the first boot. Later on the users 
should be responsible (and able to) to maintain their environments 
independently.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
  2023-03-21 12:22       ` Sergey Trofimov
@ 2023-03-21 13:38         ` Andrew Tropin
  2023-03-21 18:18           ` Sergey Trofimov
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Tropin @ 2023-03-21 13:38 UTC (permalink / raw)
  To: Sergey Trofimov; +Cc: 62274, paren, Ludovic Courtès

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

On 2023-03-21 13:22, Sergey Trofimov wrote:

> Hi Andrew,
>
> Andrew Tropin <andrew@trop.in> writes:
>
>> [[PGP Signed Part:Undecided]]
>> On 2023-03-20 20:03, Sergey Trofimov wrote:
>>
>>>
>>> You're right, the new signature is not used anywhere yet. 
>>> Though
>>> I'm working on a patch to embed home profiles in disk images
>>> produced with `guix system image`. That's where this method 
>>> comes
>>> handy, see example usage:
>>>
>>
>> Also, take a look at this thread:
>> https://yhetil.org/63960cf762aec1ed2c4182f49cac66bc37fce2aa.camel@rdmp.org
>>
>> and this prototype:
>> https://git.sr.ht/~abcdw/rde/tree/044de83e980b7038b87d27a090aef24229df85eb/src/gnu/services/home.scm#L1
>>
>> It can be related to what you want to achieve, whithout 
>> modifying
>> image-related code.
>
> Brilliant! That's it. It didn't come to me that `home-environment` 
> could be a dependency of `operating-system` and not of the image 
> itself. And you also made the service to activate it, so no manual 
> step is required. That's exactly what I have envisioned. What 
> prevents you to mainline it? It seems you have already 
> battle-tested it.
>
> The only concern is that I'd rather include 
> `guix-home-service-type` only in the first generation of the 
> system. I think that this tie between user envs and the operating 
> system makes sense only on the first boot. Later on the users 
> should be responsible (and able to) to maintain their environments 
> independently.

There are a few issues I've not addressed yet:

1. User can login before activation finished. (Discussed in the
mentioned thread above).

2. Do we need to activate it on every system reconfigure? (Actually, I
used it mostly for creating rde live cd and vm images, so didn't test
much with system reconfigure or guix deploy. Also, I guess it would be
cool to add a one-shot? flag to the service for skeleton like
functionality/initial provisioning).

3. Probably something else I already forgot.

I still don't have enough spare time to clean it up, test and upstream,
but if you would like to finish this thing up, I would be very happy to
help!

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info.
  2023-03-21 13:38         ` Andrew Tropin
@ 2023-03-21 18:18           ` Sergey Trofimov
  0 siblings, 0 replies; 9+ messages in thread
From: Sergey Trofimov @ 2023-03-21 18:18 UTC (permalink / raw)
  To: Andrew Tropin; +Cc: 62274


Andrew Tropin <andrew@trop.in> writes:

> [[PGP Signed Part:Undecided]]
> On 2023-03-21 13:22, Sergey Trofimov wrote:
>>
>> The only concern is that I'd rather include
>> `guix-home-service-type` only in the first generation of the
>> system. I think that this tie between user envs and the 
>> operating
>> system makes sense only on the first boot. Later on the users
>> should be responsible (and able to) to maintain their 
>> environments
>> independently.
>
> There are a few issues I've not addressed yet:
>
> 1. User can login before activation finished. (Discussed in the
> mentioned thread above).

Yeah, I've just tried to bake a disk-image and also was able to 
log in faster than the activation service finishes. Not a big deal 
though, I can live with that.

>
> 2. Do we need to activate it on every system reconfigure? 
> (Actually, I
> used it mostly for creating rde live cd and vm images, so didn't 
> test
> much with system reconfigure or guix deploy. Also, I guess it 
> would be
> cool to add a one-shot? flag to the service for skeleton like
> functionality/initial provisioning).
>

I think this activation should run only once.

>
> 3. Probably something else I already forgot.

It seems that ~/.config/guix/current is not created and 
/var/guix/profiles/per-user/<user> as well.

>
> I still don't have enough spare time to clean it up, test and 
> upstream,
> but if you would like to finish this thing up, I would be very 
> happy to
> help!

Actually, my use case is already solved by your code and I can 
build backup images of my OS.
Now I just have to figure out how to restore from backups offline.




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-21 19:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-19 15:45 [bug#62274] [PATCH] home: 'home-environment-with-provenance' uses the HE location info Sergey Trofimov
2023-03-20  6:52 ` bug#62274: " Andrew Tropin
2023-03-20 17:33 ` [bug#62274] " Ludovic Courtès
2023-03-20 19:03   ` Sergey Trofimov
2023-03-21  9:44     ` Ludovic Courtès
2023-03-21 10:56     ` Andrew Tropin
2023-03-21 12:22       ` Sergey Trofimov
2023-03-21 13:38         ` Andrew Tropin
2023-03-21 18:18           ` Sergey Trofimov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.