From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: bug#20720: Inconsistency in text fields for 'operating-system' Date: Thu, 04 Jun 2015 17:43:55 +0300 Message-ID: <87y4jzwn2s.fsf@gmail.com> References: <87egludumx.fsf@gmail.com> <87r3ptw23a.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0WOO-0002BT-Vu for bug-guix@gnu.org; Thu, 04 Jun 2015 10:45:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0WOG-0000x8-9m for bug-guix@gnu.org; Thu, 04 Jun 2015 10:45:12 -0400 Received: from debbugs.gnu.org ([140.186.70.43]:58917) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0WOG-0000wB-6U for bug-guix@gnu.org; Thu, 04 Jun 2015 10:45:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z0WOF-00008H-FC for bug-guix@gnu.org; Thu, 04 Jun 2015 10:45:03 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87r3ptw23a.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 03 Jun 2015 11:52:41 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 20720@debbugs.gnu.org Ludovic Court=C3=A8s (2015-06-03 12:52 +0300) wrote: > Alex Kost skribis: > >> I see some inconsistency in specifying text / text files in an >> operating-system declaration: > > Yeah, I agree it is somewhat annoying that there=E2=80=99s no single way = to > handle this. But... > >> - =E2=80=98sudoers=E2=80=99 and =E2=80=98issue=E2=80=99 want plain strin= gs; >> >> - =E2=80=98hosts-file=E2=80=99 and =E2=80=98mingetty-service=E2=80=99 (#= :motd argument) want a >> 'text-file' monadic procedure; >> >> - some other services (=E2=80=98syslog-service=E2=80=99, =E2=80=98lirc-s= ervice=E2=80=99, ...) want file >> names (of the configuration files). > > In reality they take a =E2=80=9Cfile=E2=80=9D, not a file name. A file i= s an object > that within a gexp expands to a file name. So it can be a =E2=80=98local= -file=E2=80=99 > object, a derivation, etc. Ah, thanks! I didn't realize that =E2=80=98local-file=E2=80=99 or a deriva= tion may be used there. >> As for me, I prefer the latter variant. But I think the best would >> be to add support for any of the above possibilities for all services >> or operating-system fields. > > An important criterion is whether the file needs to contain references > to store items or not. For =E2=80=98sudoers=E2=80=99 and =E2=80=98issue= =E2=80=99, that=E2=80=99s normally not > the case, and these are usually small files or computable files, so I > think it=E2=80=99s fine to use strings here (more convenient than files.) Well, I don't agree about =E2=80=98sudoers=E2=80=99. It may be a really bi= g file. Mine is not so big, but it is 40 lines long (including some useful comments), so I have to use some additional guile code to convert the contents of the file into string. > Using monadic values as for =E2=80=98hosts-file=E2=80=99 and #:motd is no= t nice. These > should be changed to use either a string or a file. > > The best would be to always use a file-like object. I=E2=80=99ve just ad= ded > =E2=80=98plain-file=E2=80=99 for that reason. Now I would change #:motd = and > =E2=80=98hosts-file=E2=80=99 to take a file-like object rather than a mon= adic value. > > WDYT? I beg a pardon, but if I inderstand it correctly (probably not), I don't see a difference from the user point of view. Previously it was: (hosts-file (text-file "hosts" "...")) and now it would be: (hosts-file (plain-file "hosts" "...")) > This brings up the question of how far we should go on the declarative > side: Similar to =E2=80=98local-file=E2=80=99 and =E2=80=98plain-file=E2= =80=99, should we add more > declarative types, say for =E2=80=98gexp->derivation=E2=80=99? > > My current inclination would be to not add anything beyond =E2=80=98local= -file=E2=80=99 > and =E2=80=98plain-file=E2=80=99: These two are useful in OS configuratio= ns, so that=E2=80=99s > fine, but for more elaborate things people should just use the > procedural interface. Thoughts? I think I'm not competent as I have a vague understanding of all this stuff and of user's needs (except mine =E2=98=BA). What I would like to ha= ve, is a possibility to specify my configuration files for various services and operating-system fields. I don't want to write text configs in my os-config.scm file (as it happens now with =E2=80=98hosts-file=E2=80=99). I'm very happy with the current behaviour of =E2=80=98syslog-service=E2=80= =99, =E2=80=98lirc-service=E2=80=99 and =E2=80=98console-keymap-service=E2=80=99= where I just specify file names, e.g.: (syslog-service #:config-file "/home/me/my-favourite-syslog.conf") and I like this =E2=86=91 way of specifying configurations very much! That= 's what I would like to see in =E2=80=98sudoers=E2=80=99 and =E2=80=98hosts-fi= le=E2=80=99 fields. --=20 Thanks, Alex