unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Alex Kost <alezost@gmail.com>
Cc: 20720@debbugs.gnu.org
Subject: bug#20720: Inconsistency in text fields for 'operating-system'
Date: Wed, 03 Jun 2015 11:52:41 +0200	[thread overview]
Message-ID: <87r3ptw23a.fsf@gnu.org> (raw)
In-Reply-To: <87egludumx.fsf@gmail.com> (Alex Kost's message of "Tue, 02 Jun 2015 17:58:46 +0300")

Alex Kost <alezost@gmail.com> skribis:

> I see some inconsistency in specifying text / text files in an
> operating-system declaration:

Yeah, I agree it is somewhat annoying that there’s no single way to
handle this.  But...

> - ‘sudoers’ and ‘issue’ want plain strings;
>
> - ‘hosts-file’ and ‘mingetty-service’ (#:motd argument) want a
>   'text-file' monadic procedure;
>
> - some other services (‘syslog-service’, ‘lirc-service’, ...) want file
>   names (of the configuration files).

In reality they take a “file”, not a file name.  A file is an object
that within a gexp expands to a file name.  So it can be a ‘local-file’
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 ‘sudoers’ and ‘issue’, that’s normally not
the case, and these are usually small files or computable files, so I
think it’s fine to use strings here (more convenient than files.)

Using monadic values as for ‘hosts-file’ 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’ve just added
‘plain-file’ for that reason.  Now I would change #:motd and
‘hosts-file’ to take a file-like object rather than a monadic value.

WDYT?


This brings up the question of how far we should go on the declarative
side: Similar to ‘local-file’ and ‘plain-file’, should we add more
declarative types, say for ‘gexp->derivation’?

My current inclination would be to not add anything beyond ‘local-file’
and ‘plain-file’: These two are useful in OS configurations, so that’s
fine, but for more elaborate things people should just use the
procedural interface.  Thoughts?

Thanks,
Ludo’.

  reply	other threads:[~2015-06-03  9:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 14:58 bug#20720: Inconsistency in text fields for 'operating-system' Alex Kost
2015-06-03  9:52 ` Ludovic Courtès [this message]
2015-06-04 14:43   ` Alex Kost
2015-06-05 12:30     ` Ludovic Courtès
2015-06-05 13:27       ` Alex Kost
2015-06-05 20:47         ` Ludovic Courtès
2015-06-06 17:38           ` Alex Kost
2015-06-07 15:16             ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3ptw23a.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=20720@debbugs.gnu.org \
    --cc=alezost@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).