unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: raid5atemyhomework <raid5atemyhomework@protonmail.com>
To: Jan Wielkiewicz <tona_kosmicznego_smiecia@interia.pl>
Cc: "guix-devel@gnu.org" <guix-devel@gnu.org>
Subject: Re: A new paradigm for modifying operating system declarations
Date: Tue, 05 Jan 2021 00:46:45 +0000	[thread overview]
Message-ID: <nHUzDBO-kQ26r-w3RHjII8ZVo3EK2mKKgOVuKusl3uOLtQ-vYYxJhA9msmtAM02vXjbmJFjRmGYSXw1VE6rSA7KZQTe1vVf_xGdZSFcwR2E=@protonmail.com> (raw)
In-Reply-To: <20210105002644.383d317a@interia.pl>

Hi Jan,

>
> Better but still don't like it.
> Can't we put the os declaration into a variable and then pass it to a
> procedure?
> Say:
>
> >     (define OS
> >       (operating-system
> >         (kernel linux-libre-5.4)
> >         ; ... other fields ...
> >         ))
> >
> >     (install-zfs OS)
> >     (install-foo OS)
> >     (install-bar OS)
> >     (install-something OS)
> >
> >

No, because `<operating-system>` objects are not mutable (or at least their formal interface doesn't expose any mutation).

What we could do would be:

```scheme
(define os
  (operating-system
    (kernel linux-libre-5.4)
    #;...))

(set! os (install-zfs os))
(set! os (install-foo os))
(set! os (install-bar os))

os
```

However, in many examples I've seen, the `configuration.scm` file looks like this:

```scheme
(use-modules (gnu))
(use-package-modules #;...)
(use-service-modules #;...)

(operating-system
  (host-name "my-system")
  (timezone "Europe/Paris")
  (locale "en_US,utf-8")
  (kernel linux-libre-5.4)
  #;...)
```

What I want to avoid would be to have to nest the existing, usually screens-long, `operating-system` form.

So compare:

```scheme
(use-modules (gnu))
(use-package-modules #;...)
(use-service-modules #;...)

(decorate (install-zfs
           install-foo
           install-bar
           operating-system)
  (host-name "my-system")
  (timezone "Europe/Paris")
  (locale "en_US,utf-8")
  (kernel linux-libre-5.4)
  #;...)
```

versus:

```scheme
(use-modules (gnu))
(use-package-modules #;...)
(use-service-modules #;...)

(define os
  (operating-system
    (host-name "my-system")
    (timezone "Europe/Paris")
    (locale "en_US,utf-8")
    (kernel linux-libre-5.4)
    #;...))
(set! os (install-zfs os))
(set! os (install-foo os))
(set! os (install-bar os))
os
```

I feel the former is better and requires less boilerplate.

Now of course, I ***have*** seen examples as well where the `operating-system` is put in a `define` form as well, but those are rare and the default stuff that come with Guix tend not to use this, and we should consider that new Guix sysads might not be comfortable working with EMACS and prefer nano, so adding even just *one* additional layer of nestedness to a long `operating-system` form is not easy.  Of course, such a sysad might then consider not indenting it correctly.

Thanks
raid5atemyhomework


      reply	other threads:[~2021-01-05  0:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 15:38 A new paradigm for modifying operating system declarations raid5atemyhomework
2021-01-04 20:21 ` Taylan Kammer
2021-01-05  0:32   ` raid5atemyhomework
2021-01-05  6:12     ` Carlo Zancanaro
2021-01-05 10:01       ` raid5atemyhomework
2021-01-04 23:26 ` Jan Wielkiewicz
2021-01-05  0:46   ` raid5atemyhomework [this message]

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='nHUzDBO-kQ26r-w3RHjII8ZVo3EK2mKKgOVuKusl3uOLtQ-vYYxJhA9msmtAM02vXjbmJFjRmGYSXw1VE6rSA7KZQTe1vVf_xGdZSFcwR2E=@protonmail.com' \
    --to=raid5atemyhomework@protonmail.com \
    --cc=guix-devel@gnu.org \
    --cc=tona_kosmicznego_smiecia@interia.pl \
    /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).