unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Customizing /etc
  2015-11-24 20:03                                     ` Alex Kost
@ 2015-11-27 14:58                                       ` Ludovic Courtès
  2015-11-30  9:11                                         ` Alex Kost
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2015-11-27 14:58 UTC (permalink / raw)
  To: Alex Kost; +Cc: 宋文武, guix-devel

Alex Kost <alezost@gmail.com> skribis:

> 宋文武 (2015-11-24 18:22 +0300) wrote:

[...]

>> So, the plan is add /etc/environment and only use /etc/profile for 2.
>> then, a sh-profile file-like configuration can be added.  WDYT?
>
> I like the idea of separating /etc/environment and /etc/profile, but my
> main concern is to have a possibility to change /etc files the way I
> want, as I explained in the reply to Ludovic.

I agree that specifying what goes into /etc is something we want to
allow (though not directly related to the /etc/profile issue.)

What about exposing the name/file-like pairs that are passed to
‘etc-service’?  That way, one could write:

  (define os
    (operating-system
      ;; …
      (etc-files `(("hosts" ,(local-file "my-hosts-file"))
                   ("issue" ,(plain-file "Hello!\n"))
                   ("sudoers" ,(local-file "sudoers"))
                   ("profile" ,(local-file "myprofile"))
                   ,@(fold alist-delete
                           (default-etc-files os)
                           '("hosts" "issue" "sudoers" "profile"))))))

We may remove the ‘hosts-file’ and ‘sudoers-file’ fields, but keep
higher-level things like ‘name-service-switch’ because they’re more
convenient.

The difficulty is that some of the default files, such as /etc/hosts,
are generated as a function of the ‘operating-system’ declaration.  Thus
I think we need ‘default-etc-files’ to be a procedure as shown above,
and the ‘etc-files’ field must be thunked or delayed.  Hmm not fully
sure this is the right interface.

WDYT?

The bottom line is that /etc is not a great configuration interface
because it’s all flat and GuixSD has no idea of the meaning of those
files and their relationship.  So the preferred approach remains
configuration via services and high-level configuration objects.

Thanks,
Ludo’.

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

* Re: Customizing /etc
  2015-11-27 14:58                                       ` Customizing /etc Ludovic Courtès
@ 2015-11-30  9:11                                         ` Alex Kost
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Kost @ 2015-11-30  9:11 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-11-27 17:58 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
[...]
>> I like the idea of separating /etc/environment and /etc/profile, but my
>> main concern is to have a possibility to change /etc files the way I
>> want, as I explained in the reply to Ludovic.
>
> I agree that specifying what goes into /etc is something we want to
> allow (though not directly related to the /etc/profile issue.)

Oof, that's a relief for me!  I had an impression that you are against
giving a user a full control over /etc files.

> What about exposing the name/file-like pairs that are passed to
> ‘etc-service’?  That way, one could write:
>
>   (define os
>     (operating-system
>       ;; …
>       (etc-files `(("hosts" ,(local-file "my-hosts-file"))
>                    ("issue" ,(plain-file "Hello!\n"))
>                    ("sudoers" ,(local-file "sudoers"))
>                    ("profile" ,(local-file "myprofile"))
>                    ,@(fold alist-delete
>                            (default-etc-files os)
>                            '("hosts" "issue" "sudoers" "profile"))))))

Yes, changing /etc files is exactly what I want!

> We may remove the ‘hosts-file’ and ‘sudoers-file’ fields, but keep
> higher-level things like ‘name-service-switch’ because they’re more
> convenient.

Yes, I agree; if this will be accepted, keeping '<foo>-file' fields (for
hosts, sudoers and future files) is probably not needed.

> The difficulty is that some of the default files, such as /etc/hosts,
> are generated as a function of the ‘operating-system’ declaration.  Thus
> I think we need ‘default-etc-files’ to be a procedure as shown above,
> and the ‘etc-files’ field must be thunked or delayed.  Hmm not fully
> sure this is the right interface.
>
> WDYT?

Yes, this will probably not be an easy-to-use interface, but to have it
is better than to have nothing.  So I am totally for it!

> The bottom line is that /etc is not a great configuration interface
> because it’s all flat and GuixSD has no idea of the meaning of those
> files and their relationship.  So the preferred approach remains
> configuration via services and high-level configuration objects.

Yes, I agree; but if a user is not satisfied by the result of these
high-level services, I think (s)he should have a fallback way to
change/override the resulting /etc file.

-- 
Alex

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

* Customizing /etc
  2016-09-15  7:38   ` Alex Kost
@ 2016-09-19 14:08     ` Ludovic Courtès
  2016-09-20 14:14       ` Alex Kost
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2016-09-19 14:08 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

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

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2016-09-14 16:58 +0200) wrote:
>
>> Hello,
>>
>> csanchezdll@gmail.com (Carlos Sánchez de La Lama) skribis:
>>
>>> I have an interesting case here. I have guile installed in my system
>>> profile, so that
>>>
>>> /var/guix/profiles/system/profile/share/aclocal/guile.m4
>>>
>>> is there. However, autoconf is installed in my *user* profile, so
>>> ACLOCAL_PATH is augmented in ~/.guix-profile/etc/profile to include
>>>
>>> ~/.guix-profile/share/aclocal
>>>
>>> But not the system-profile aclocal directory, which would be put into
>>> ACLOCAL_PATH by /var/guix/profiles/system/profile/etc/profile if
>>> autoconf was installed in the systme profile as well.
>>>
>>> Is this the intended behaviour? I am wondering whether packages with
>>> search paths should include both the user-profile directories and the
>>> system-profile ones.
>>
>> I think you’re right.  This was discussed at
>> <http://bugs.gnu.org/20255>, leading to a patch (for GuixSD).
>>
>> However, we failed to build consensus around the approach of this patch,
>> so we did not apply it.  If you have ideas, please email
>> 20255@debbugs.gnu.org.  :-)
>
> I think I was the one who prevents the consensus.  To make it clear, I'm
> for the suggested solution, but only *after* giving a user a freedom to
> avoid loading such a heavy command as "guix package --search-paths".  On
> a "usual" GNU/Linux distro a user can edit /etc/profile, but on GuixSD
> it is not possible currently.  That's why I think there should be
> provided a possibility to override /etc/profile at first.

Indeed, thanks for the reminder!

In fact, we have this through ‘etc-service-type’, except that currently
/etc/profile is systematically added.

So an idea that comes to mind is to allow ‘etc-service-type’ to be
extended with procedures that would be able to filter or otherwise
change the /etc entries (similar to what we do for PAM):


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1144 bytes --]

diff --git a/gnu/services.scm b/gnu/services.scm
index 7e322c5..9397232 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -426,9 +426,13 @@ directory."
                 (extensions
                  (list
                   (service-extension activation-service-type
-                                     (lambda (files)
-                                       (let ((etc
-                                              (files->etc-directory files)))
+                                     (lambda (files+procs)
+                                       (let* ((proc (apply compose
+                                                           (filter procedure?
+                                                                   files+procs)))
+                                              (files (filter pair? files+procs))
+                                              (etc
+                                               (files->etc-directory (proc files))))
                                          #~(activate-etc #$etc))))
                   (service-extension system-service-type etc-entry)))
                 (compose concatenate)

[-- Attachment #3: Type: text/plain, Size: 460 bytes --]


In your config, you could have something like:

  (services (cons (simple-service 'rm-/etc/profile etc-service-type
                                  (const (lambda (files)
                                           (assoc-delete "profile" files))))
                  %base-services))

WDYT?

In fact I think we would need to have a more generic mechanism to hook
into ‘fold-services’, but I’m not sure what it should look like.

Ludo’.

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

* Re: Customizing /etc
  2016-09-19 14:08     ` Customizing /etc Ludovic Courtès
@ 2016-09-20 14:14       ` Alex Kost
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Kost @ 2016-09-20 14:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-09-19 23:08 +0900) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> Ludovic Courtès (2016-09-14 16:58 +0200) wrote:
[...]
>>> However, we failed to build consensus around the approach of this patch,
>>> so we did not apply it.  If you have ideas, please email
>>> 20255@debbugs.gnu.org.  :-)
>>
>> I think I was the one who prevents the consensus.  To make it clear, I'm
>> for the suggested solution, but only *after* giving a user a freedom to
>> avoid loading such a heavy command as "guix package --search-paths".  On
>> a "usual" GNU/Linux distro a user can edit /etc/profile, but on GuixSD
>> it is not possible currently.  That's why I think there should be
>> provided a possibility to override /etc/profile at first.
>
> Indeed, thanks for the reminder!
>
> In fact, we have this through ‘etc-service-type’, except that currently
> /etc/profile is systematically added.
>
> So an idea that comes to mind is to allow ‘etc-service-type’ to be
> extended with procedures that would be able to filter or otherwise
> change the /etc entries (similar to what we do for PAM):
>
> diff --git a/gnu/services.scm b/gnu/services.scm
> index 7e322c5..9397232 100644
> --- a/gnu/services.scm
> +++ b/gnu/services.scm
> @@ -426,9 +426,13 @@ directory."
>                  (extensions
>                   (list
>                    (service-extension activation-service-type
> -                                     (lambda (files)
> -                                       (let ((etc
> -                                              (files->etc-directory files)))
> +                                     (lambda (files+procs)
> +                                       (let* ((proc (apply compose
> +                                                           (filter procedure?
> +                                                                   files+procs)))
> +                                              (files (filter pair? files+procs))
> +                                              (etc
> +                                               (files->etc-directory (proc files))))
>                                           #~(activate-etc #$etc))))
>                    (service-extension system-service-type etc-entry)))
>                  (compose concatenate)
>
>
> In your config, you could have something like:
>
>   (services (cons (simple-service 'rm-/etc/profile etc-service-type
>                                   (const (lambda (files)
>                                            (assoc-delete "profile" files))))
>                   %base-services))
>
> WDYT?

I think it would be great!  I didn't realize it can be implemented this
way.

> In fact I think we would need to have a more generic mechanism to hook
> into ‘fold-services’, but I’m not sure what it should look like.

Yeah, a more generic way would be better of course, but I think this
mixing of files and procedures is already good enough for now, as it
provides a freedom in customizing a system that we didn't have before.
Besides I will no longer object against the "search-paths" fix for the
bug 20255 :-)

-- 
Alex

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

* Customizing /etc
@ 2017-05-16  8:43 Alex Kost
  2017-05-17  8:28 ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Kost @ 2017-05-16  8:43 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

This is almost the same message as:

  http://lists.gnu.org/archive/html/guix-devel/2016-09/msg01570.html

I mean this is a reminder on the subject.

Ludovic, I think you suggested a good solution to a "Customizing
/etc/profile" problem.  Since I will no longer be a blocker of
<http://bugs.gnu.org/20255> after this fix, would you like to commit
that change, or are there any issues with that?

-- 
Thanks,
Alex

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

* Re: Customizing /etc
  2017-05-16  8:43 Customizing /etc Alex Kost
@ 2017-05-17  8:28 ` Ludovic Courtès
  2017-05-18 13:33   ` Alex Kost
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2017-05-17  8:28 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Hi Alex,

Alex Kost <alezost@gmail.com> skribis:

> This is almost the same message as:
>
>   http://lists.gnu.org/archive/html/guix-devel/2016-09/msg01570.html
>
> I mean this is a reminder on the subject.

Yes, I haven’t forgotten about it, contrary to what one might think.
;-)

> Ludovic, I think you suggested a good solution to a "Customizing
> /etc/profile" problem.  Since I will no longer be a blocker of
> <http://bugs.gnu.org/20255> after this fix, would you like to commit
> that change, or are there any issues with that?

In the message you cite above, I proposed to hack etc-service-type in
the same way we did for PAM.

But then I think we’d better have the generic solution in place (where
any service could be extended “at the end”, i.e., after it’s ‘compose’
and ‘extend’ procedures have been called) before people start relying on
the hack.  I even started working on it long ago, and then moved on to
something else.

I’m sorry that this has not happened yet.  I hope to resume work on it
after the release, but if someone wants to give it a shot, I will
definitely not block it.

Thanks,
Ludo’.

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

* Re: Customizing /etc
  2017-05-17  8:28 ` Ludovic Courtès
@ 2017-05-18 13:33   ` Alex Kost
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Kost @ 2017-05-18 13:33 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2017-05-17 10:28 +0200) wrote:

> Hi Alex,
>
> Alex Kost <alezost@gmail.com> skribis:
>
>> This is almost the same message as:
>>
>>   http://lists.gnu.org/archive/html/guix-devel/2016-09/msg01570.html
>>
>> I mean this is a reminder on the subject.
>
> Yes, I haven’t forgotten about it, contrary to what one might think.
> ;-)

Oh, great!  (you're right, that's what I thought :-))

>> Ludovic, I think you suggested a good solution to a "Customizing
>> /etc/profile" problem.  Since I will no longer be a blocker of
>> <http://bugs.gnu.org/20255> after this fix, would you like to commit
>> that change, or are there any issues with that?
>
> In the message you cite above, I proposed to hack etc-service-type in
> the same way we did for PAM.
>
> But then I think we’d better have the generic solution in place (where
> any service could be extended “at the end”, i.e., after it’s ‘compose’
> and ‘extend’ procedures have been called) before people start relying on
> the hack.  I even started working on it long ago, and then moved on to
> something else.

Wow, a general solution for any service sounds really great!

> I’m sorry that this has not happened yet.  I hope to resume work on it
> after the release, but if someone wants to give it a shot, I will
> definitely not block it.

I see :-)  No hurry, I just was a bit concerned that your solution was
lost, but now I know that it's not, thanks!

-- 
Alex

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

end of thread, other threads:[~2017-05-18 13:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-16  8:43 Customizing /etc Alex Kost
2017-05-17  8:28 ` Ludovic Courtès
2017-05-18 13:33   ` Alex Kost
  -- strict thread matches above, loose matches on Subject: below --
2016-09-14  7:35 User-profile search paths should include system-profile directories Carlos Sánchez de La Lama
2016-09-14 14:58 ` Ludovic Courtès
2016-09-15  7:38   ` Alex Kost
2016-09-19 14:08     ` Customizing /etc Ludovic Courtès
2016-09-20 14:14       ` Alex Kost
     [not found] <877ftschjt.fsf@gmail.com>
     [not found] ` <87fv8fip01.fsf@gnu.org>
     [not found]   ` <87d23j1bxk.fsf@gmail.com>
     [not found]     ` <871tjyfnl8.fsf@gnu.org>
     [not found]       ` <876199q4z1.fsf@gmail.com>
     [not found]         ` <87ioca4ojo.fsf@gnu.org>
     [not found]           ` <87lh9tvcws.fsf@gnu.org>
     [not found]             ` <87h9kguwc4.fsf@gmail.com>
     [not found]               ` <87ziy7d90z.fsf@gnu.org>
     [not found]                 ` <874mgfkxee.fsf@gmail.com>
     [not found]                   ` <87wptb5d1y.fsf@gnu.org>
     [not found]                     ` <87r3jisc76.fsf@gmail.com>
     [not found]                       ` <87lh9q1f2i.fsf@gnu.org>
     [not found]                         ` <877fl9q3gv.fsf@gmail.com>
     [not found]                           ` <87h9kdy6ty.fsf@gnu.org>
     [not found]                             ` <871tbh53rt.fsf@gmail.com>
     [not found]                               ` <87vb8sss7j.fsf@gnu.org>
2015-11-23 20:07                                 ` Adding operating-system field for a custom /etc/profile Alex Kost
2015-11-24 15:22                                   ` 宋文武
2015-11-24 20:03                                     ` Alex Kost
2015-11-27 14:58                                       ` Customizing /etc Ludovic Courtès
2015-11-30  9:11                                         ` Alex Kost

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).