nesting with-imported-modules

2020-02-01 Thread Ricardo Wurmus
Hi Guix,

it seems that it is impossible to nest with-imported-modules.  A gexp
that is wrapped in multiple layers of with-imported-modules won’t depend
on the list of all mentioned modules but only on the outermost.

This is because with-imported-modules sets the current-imported-modules
parameter without checking if the parameter already has a value.

Should nesting be supported?  It seems useful.

--
Ricardo



Thoughts on stateful services in Guix

2020-02-01 Thread Alex Sassmannshausen
Hello,

As a result of FOSDEM conversations today I felt inspired to put some
thoughts on paper about an area where I think we currently run into
complications.

Not sure if it is appropriate to write this blog-post-ish contribution
here, but as I don't have a blog, and it's about Guix development, I
figured it might be OK.

Best wishes,

Alex

1 Introduction
══

  Guix is amazing.  A large part of why it continues to be amazing is
  because it provides strong guarantees to the end-user and developer.
  As such it makes reasoning about packages and deployments relatively
  straight-forward.

  The functional paradigm cleary works fantastically for packages.
  Unfortunately it is not quite clear that it works just as well for
  services.  The reason for this is that too many useful services are
  inherently stateful.  Their statefulness means they have side-effects,
  which in turn cause issues when relying on Guix features such as
  roll-back or automated deployment & guaranteed reproducability.

  Disciplined developers can implement many services in such a way that
  their statefulness is delegated to other dedicated services.  In this
  way the problem of statefulness can be isolated.  However, many
  existing useful services /have not/ been implemented in such a way.

  These notes are an attempt to think through ways of formalising how we
  mitigate stateful services in Guix.

  The notes below are organised around the example of a popular PHP
  content management system, Drupal.  Similar problems will apply to
  many other end-user services.

  My intent here is to communicate my thinking in the hopes that others
  can point to obvious flaws in my reasoning — or to stimulate
  conversation about the topic.  I hope at the very least that it is an
  interesting read!


2 Learning by Doing: Packaging & Deploying Drupal
═

2.1 Problem (1): the Drupal tarball is a binary blob!
─

  Released Drupal tarballs are shipped with a bunch of PHP dependencies,
  as well as compiled JS files.  A fully source-distributed installation
  of Drupal would:
  1) delete all shipped PHP dependencies
  2) independently build all PHP dependencies and make them available to
 Drupal (through it's vendor directory as symlinks?)
  3) delete all compiled JS files & libraries
  4) independently build the JS dependencies and make them avalable to
 Drupal.


2.2 Packages must always be stateless!
──

  What does this mean in practice?  Let's look at Drupal again.  When
  you download Drupal, the resulting tarball contains the source code,
  and an empty sites/ folder.  The sites folder is intended to contain
  /state/ files.  The normal installation procedure is to simply drop
  the drupal distribution in your web root directory, and for state
  files to live underneath sites/ within your webroot.

  In Guix, Drupal is packaged so that it is installed in the store.

  The store is read-only and hence no /state/ files can live under the
  sites/ directory in the store.

  How do we get around this?
  1) either we patch drupal to expect the sites/ directory outside of
 its own folder tree.
  2) or we symlink /gnu/store/…drupal…/sites/ to a different location on
 the filesystem (e.g. /var/lib/drupal/sites/)

  The latter solution, while easy, means that a *successful*
  installation of the package Drupal in Guix results in an installation
  in the store with a *broken symlink* pointing outside the store.

  But the package itself has been rendered stateless!


2.3 Drupal: a stateful service
──

  Services in Guix are rich and multidimensional entities.  At core they
  are promises of things that will have happened when a system is up and
  running.  These promises can be arbitrary, like generating a
  configuration file every boot; or they can be an extension of other,
  already existing services.

  A particularly popular service to extend is the shepherd service,
  which ensures that particular daemons are started as soon as possible
  after the system has started.

  What would a Drupal service look like?  Essentially the software is
  just a bunch of files in a webroot — so at it's heart it simply
  extends a web service (e.g. nginx) with new location directives.

  On the other hand it also requires that tha web server, a sql backend
  and php-fpm are running, so that drupal can actually function.

  These two requirements are easily met with the usual service
  infrastructure: simply extend nginx with a location definition
  pointing to the Drupal folder in the store as the webroot and extend
  shepherd to require mysql, nginx and php-fpm.


2.3.1 Enter the state dragon


  But hang-on… if Mysql service is a dependency, and we store state in a
  Mysql DB, what happens when we upgrade to a newer version of Drupal,

Re: Rust packaging coordination

2020-02-01 Thread John Soo
Hi Andreas and everyone,

Patches for exa are in #39382

> I have started packaging i3status-rust[1]. This is motivated primarily
> by scratching my own itch, and to become more familiar with Guix
> packaging.

Excellent! Welcome and have fun!

> - The dependency tree includes a portion of Rusts async universe not yet
>   packaged, `rust-futures-0.3` and `rust-tokio-0.2`. Preview versions of
>   the latter are already packaged -- there should probably be an effort
>   to update their reverse dependencies and switch to the "release"
>   versions of those.

I would imagine that the package authors start using the release async soon.
The release of async seemed like a big deal in the rust community.

> - It includes bindings for libpulse (`rust-libpulse-bindings`),
>   inotify (`rust-inotify`), and libdbus (`rust-dbus`).

Oh that's good! Maybe those can go in sooner than i3status-rust.
Smaller batches with the async libraries, dbus and inotify seem pretty
likely to be reused.

> - I've encountered two crates with a not-already-defined license,
>   namely "0BSD" (`maildir` and `mailparse`). I've "faked" it for now with:
>
>   (define license:bsd-0
> (license:fsf-free "https://spdx.org/licenses/0BSD.html;
>   "BSD Zero Clause License"))

I'm not sure what to do for a new license, but that reminds me that
the importer doesn't understand the bsd-2 clause.

Thanks and happy hacking,

John



Re: Rust packaging coordination

2020-02-01 Thread Andreas Rottmann
John Soo  writes:

> Hi rust packagers,
>
> We have: ripgrep, tokei, cbindgen.
>
> [ ... exa and alacritty ]
>
> I also have: racer, rustfmt, fd and pijul.
>
> What should we do next?
>
I have started packaging i3status-rust[1]. This is motivated primarily
by scratching my own itch, and to become more familiar with Guix
packaging. I'm still in the process of import-ing the required
dependencies; some notes so far:

- The dependency tree includes a portion of Rusts async universe not yet
  packaged, `rust-futures-0.3` and `rust-tokio-0.2`. Preview versions of
  the latter are already packaged -- there should probably be an effort
  to update their reverse dependencies and switch to the "release"
  versions of those.

- It includes bindings for libpulse (`rust-libpulse-bindings`),
  inotify (`rust-inotify`), and libdbus (`rust-dbus`).

- I've encountered two crates with a not-already-defined license,
  namely "0BSD" (`maildir` and `mailparse`). I've "faked" it for now with:

  (define license:bsd-0
(license:fsf-free "https://spdx.org/licenses/0BSD.html;
  "BSD Zero Clause License"))

The so-far accumulated list of crates from crates.io is:

rust-assert-matches-1.3
rust-chrono-tz-0.5
rust-cpuprofiler
rust-dbus
rust-futures-0.3
rust-futures-channel-0.3
rust-futures-core-0.3
rust-futures-executor-0.3
rust-futures-io-0.3
rust-futures-macro-0.3
rust-futures-sink-0.3
rust-futures-task-0.3
rust-futures-util-0.3  
rust-i3ipc
rust-inotify-0.8
rust-inotify-sys-0.1
rust-libdbus-sys
rust-libpulse-binding-2
rust-libpulse-sys-1
rust-maildir-0.3
rust-mailparse-0.10
rust-notmuch-0.6
rust-parse-zoneinfo
rust-progress-0.2
rust-supercow-0.1
rust-tokio-0.2

If someone wants to tackle any of these, don't hold off; I don't know
how long I'll take until I actually can build `i3status-rust`. Once I
get to that point, I know that my package definitions are not totally
broken, and will try to turn them into patches.

[1]: https://github.com/greshake/i3status-rust