[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A postinst equivalent in Guix?

From: Georgi Kirilov
Subject: Re: A postinst equivalent in Guix?
Date: Sat, 21 Jan 2017 16:39:23 +0200
User-agent: NeoMutt/20161126 (1.7.1)

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. Besides, writing to /var on a foreign distro may interfere with the same package installed natively there (if it is installed).

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?
I'm probably missing something, but nothing seems to depend on them.
If there was a way to create a writable customization, that would be the perfect place to put /var directories.


Attachment: var-lib-package.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]