Discussion:
‘guix pack --relocatable’ and the binary installation tarball
Ludovic Courtès
2018-05-11 16:42:11 UTC
Permalink
Hello Guix!

To continue the experiment with ‘guix pack --relocatable’, I made a
binary installation tarball like this:

guix pack -S /bin=bin -S /sbin=sbin --localstatedir -R guix bash-static

The resulting tarball can be sent on a Guix-less machine, and then you
can run the daemon as non-root and build things, though you have to
define a couple of undocumented variables and disable chroot support:

--8<---------------cut here---------------start------------->8---
~/tmp$ NIX_STATE_DIR=$PWD/var/guix NIX_LOG_DIR=$PWD/var/log/guix ./bin/guix-daemon --disable-chroot &
[1] 25103
~/tmp$ NIX_STATE_DIR=$PWD/var/guix ./bin/guix build -e '(@@ (gnu packages commencement) gnu-make-boot0)'
guile: warning: failed to install locale
warning: failed to install locale: Invalid argument
accepted connection from pid 26073, user ludo
/gnu/store/qw5n2f745cb8h71fpwrhha2d62q7x2kp-make-boot0-4.2.1-debug
/gnu/store/f7q38v9fh9zz27qinjwscqip8k7fkirs-make-boot0-4.2.1
~/tmp$ NIX_STATE_DIR=$PWD/var/guix ./bin/guix gc --list-live | wc -l
guile: warning: failed to install locale
warning: failed to install locale: Invalid argument
accepted connection from pid 27833, user ludo
finding garbage collector roots...
guile: warning: failed to install locale
determining live/dead paths...
46
--8<---------------cut here---------------end--------------->8---

Build results are not wrapped though, so you cannot execute them
directly:

--8<---------------cut here---------------start------------->8---
~/tmp$ /gnu/store/f7q38v9fh9zz27qinjwscqip8k7fkirs-make-boot0-4.2.1/bin/make
bash: /gnu/store/f7q38v9fh9zz27qinjwscqip8k7fkirs-make-boot0-4.2.1/bin/make: No such file or directory
--8<---------------cut here---------------end--------------->8---

Instead you have to enter a namespace where /gnu/store is properly
bound, and this is where the ‘bash-static’ we added to the tarball can
be useful:

--8<---------------cut here---------------start------------->8---
~/tmp$ ./bin/sh
~/tmp$ /gnu/store/f7q38v9fh9zz27qinjwscqip8k7fkirs-make-boot0-4.2.1/bin/make --version
GNU Make 4.2.1
Built for x86_64-unknown-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
--8<---------------cut here---------------end--------------->8---

We could probably simplify this use case, though I wonder how far we
need to go here.

Thoughts? :-)

Ludo’.

Loading...