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 via email to