From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#20720: Inconsistency in text fields for 'operating-system' Date: Wed, 03 Jun 2015 11:52:41 +0200 Message-ID: <87r3ptw23a.fsf@gnu.org> References: <87egludumx.fsf@gmail.com> 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]:60260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z05MC-0005yA-Bd for bug-guix@gnu.org; Wed, 03 Jun 2015 05:53:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z05M6-0003KU-MX for bug-guix@gnu.org; Wed, 03 Jun 2015 05:53:08 -0400 Received: from debbugs.gnu.org ([140.186.70.43]:56519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z05M6-0003KG-JM for bug-guix@gnu.org; Wed, 03 Jun 2015 05:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z05M6-0002iL-5Z for bug-guix@gnu.org; Wed, 03 Jun 2015 05:53:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87egludumx.fsf@gmail.com> (Alex Kost's message of "Tue, 02 Jun 2015 17:58:46 +0300") 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: Alex Kost Cc: 20720@debbugs.gnu.org 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 string= s; > > - =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-se= rvice=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 is = an object that within a gexp expands to a file name. So it can be a =E2=80=98local-f= ile=E2=80=99 object, a derivation, etc. > 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.) Using monadic values as for =E2=80=98hosts-file=E2=80=99 and #:motd is not = 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 added =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 monad= ic value. WDYT? 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-f= ile=E2=80=99 and =E2=80=98plain-file=E2=80=99: These two are useful in OS configurations= , so that=E2=80=99s fine, but for more elaborate things people should just use the procedural interface. Thoughts? Thanks, Ludo=E2=80=99.