all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Georgi Kirilov <kirilov.georgi.s@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: A postinst equivalent in Guix?
Date: Sat, 21 Jan 2017 16:34:55 +0100	[thread overview]
Message-ID: <87wpdojujk.fsf@gnu.org> (raw)
In-Reply-To: <20170121143923.vdmmljvc3ngksuze@gmail.com> (Georgi Kirilov's message of "Sat, 21 Jan 2017 16:39:23 +0200")

Georgi Kirilov <kirilov.georgi.s@gmail.com> skribis:

> On Fri, Jan 20, 2017 at 03:09:25PM +0100, Ludovic Courtès wrote:
>>
>>> A program in a package I created is trying to access /var, but has no
>>> permissions. (Well, /gnu/store/.../var)
>>
>>First, you probably need to pass --localstatedir=/var to this package’s
>>configure state, since at run time it won’t be able to write to
>>/gnu/store/…/var anyway.
>>
>>Second, it will try and fail to create /var.  The way to address that is
>>by simply commenting out or patching out the offending commands.  See
>>for instance ‘avahi-localstatedir.patch’ or ‘mcron-install.patch’.
>
> That's what happened indeed. When I removed the writes to /var the
> build passed. But the programs in the package couldn't write to the
> system /var directory, since they expect /var/lib/<package>/ to exist
> and be writable.

Right, but this is typically for daemons and programs that expect to be
installed system-wide.

In that case, the trick is to define a GuixSD service providing an
“activation” snippet that makes sur /var/lib/PACKAGE exists and has the
right permissions beforehand.  For Avahi, this happens here:

  http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/avahi.scm#n93

> Besides, writing to /var on a foreign distro may interfere with the
> same package installed natively there (if it is installed).

Yeah, but I don’t think there’s much we can do.  Again, these are
typically daemons, and for any given daemon there can usually only be
one instance running.

>>> is there anything in Guix that can do things at install time, like postinst
>>> scripts in Debian?
>>
>>No.  There are “profile hooks” in (guix profiles) that are used to a
>>similar effect, for instance to assemble the ‘dir’ file that contains
>>pointers to Info documentation.
>
> This looks to me much better than the system-wide /var. It is not only
> user-specific, but generation-specific. Really nice mechanism.
> I tried to write a new hook, to scan the installed packages and if
> they have a /var/lib/<package>/ inside, to create a writable copy in
> the user's profile, so the programs can write to it without
> interfering with anything on the system.
>
> It didn't work because the hook's output turned out to be immutable...
> Whatever chmod or chown I tried inside the hook, the files always
> ended up '-r--r--r-- root root'
>
> Why are these customizations immutable?

All of /gnu/store is purposefully immutable and profiles live in
/gnu/store.  This is what allows Guix to support reproducible setups,
transactional upgrades, and roll-backs.

By definition /var (aka. ‘localstatedir’) is for mutable state, so it
has to be outside of the store.

To make things more concrete, we could discuss specific packages you are
interested in and see how we could provide them in Guix{,SD}.

HTH!

Ludo’.

  reply	other threads:[~2017-01-21 15:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 18:30 A postinst equivalent in Guix? Georgi Kirilov
2017-01-20  6:23 ` John Darrington
2017-01-20 14:09 ` Ludovic Courtès
2017-01-21 14:39   ` Georgi Kirilov
2017-01-21 15:34     ` Ludovic Courtès [this message]
2017-01-21 16:36       ` Georgi Kirilov
2017-01-23  9:34         ` Ludovic Courtès
2017-01-25  0:26           ` Christopher Allan Webber
2017-01-25 13:15             ` Ludovic Courtès
2017-01-25 13:42               ` John Darrington
2017-01-25 16:19                 ` Christopher Allan Webber
2017-01-25 14:54           ` Georgi Kirilov

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

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

  git send-email \
    --in-reply-to=87wpdojujk.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=kirilov.georgi.s@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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.