diff options
author | Hunter Sezen <ovariegata@yahoo.com> | 2015-11-25 17:59:55 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2015-11-28 07:25:59 +0700 |
commit | 9e52f8ff4d01d52018b0c1ec6b5df65b6c33d484 (patch) | |
tree | 69c3836311d9564550a5cb27b92293be2e22ac5d /system | |
parent | ce3fdfd907faed3b1cfbf2640809da5359bfc1ec (diff) | |
download | slackbuilds-9e52f8ff4d01d52018b0c1ec6b5df65b6c33d484.tar.gz |
system/guix: Added (package manager).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r-- | system/guix/README | 45 | ||||
-rw-r--r-- | system/guix/config/rc.guix | 84 | ||||
-rw-r--r-- | system/guix/doinst.sh | 25 | ||||
-rw-r--r-- | system/guix/guix.SlackBuild | 131 | ||||
-rw-r--r-- | system/guix/guix.info | 10 | ||||
-rw-r--r-- | system/guix/pypi-guile-json.diff.gz | bin | 0 -> 958 bytes | |||
-rw-r--r-- | system/guix/slack-desc | 19 |
7 files changed, 314 insertions, 0 deletions
diff --git a/system/guix/README b/system/guix/README new file mode 100644 index 0000000000..e69e02f307 --- /dev/null +++ b/system/guix/README @@ -0,0 +1,45 @@ +GNU Guix provides state-of-the-art package management features such as transactional +upgrades and roll-backs, reproducible build environments, unprivileged package +management, and per-user profiles. It uses low-level mechanisms from the Nix package +manager, but packages are defined as native Guile modules, using extensions to the +Scheme language—which makes it nicely hackable. + +Guix may be run in single or multi-user mode (which requires the guix-daemon). To +have the guix daemon start and stop with your host, add to /etc/rc.d/rc.local: + +if [ -x /etc/rc.d/rc.guix ]; then +/etc/rc.d/rc.guix start +fi + +and to /etc/rc.d/rc.local_shutdown (creating it if needed): + +if [ -x /etc/rc.d/rc.guix ]; then +/etc/rc.d/rc.guix stop +fi + +The daemon requires users for building the guix packages, which should be added +under the 'guixbld' group. + +groupadd --system guixbuild +for i in `seq -w 1 10`; do + useradd -g guixbuild -G guixbuild \ + -d /var/empty -s `which nologin` \ + -c "Guix build user $i" --system \ + guixbuilder$i; +done + +Restricting access to the daemon to only users in the guixbuild group is acheived +by setting file permissions for the daemon's socket's folder. + +chgrp guixbuild /var/guix/daemon-socket +chmod ug=rwx,o= /var/guix/daemon-socket + +Correct permissions must also be set for /var/guix/profiles to give users access. + +By default guix will compile in /tmp, this can be changed by exporting $TMPDIR. +Guix will also by default store its packages in /gnu/store, to save space in the +root partition /gnu can be mounted on another partition. + +Guix can either be built with the nix-daemon instead of the default guix-daemon or along +side nix sharing the same store, both require nix as an optional dependency. To build with +the nix-daemon use NIX="yes" and to share the store with nix use SHARE="yes".
\ No newline at end of file diff --git a/system/guix/config/rc.guix b/system/guix/config/rc.guix new file mode 100644 index 0000000000..a3d80ac6d7 --- /dev/null +++ b/system/guix/config/rc.guix @@ -0,0 +1,84 @@ +#!/bin/sh + +# Short-Description: A purely functional package manager. +# Description: +# GNU Guix provides state-of-the-art package management features such as +# transactional upgrades and roll-backs, reproducible build environments, +# unprivileged package management, and per-user profiles. It uses low-level +# mechanisms from the Nix package manager, but packages are defined as native +# Guile modules, using extensions to the Scheme language—which makes it nicely +# hackable. + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin + +BASE=guix-daemon + +UNSHARE=/usr/bin/unshare +GUIX=/usr/bin/$BASE +GUIX_PIDFILE=/var/run/$BASE.pid +GUIX_LOG=/var/log/guix.log +GUIX_OPTS=--build-users-group=guixbuild + +if [ -f /etc/default/$BASE ]; then + . /etc/default/$BASE +fi + +# Check guix is present +if [ ! -x $GUIX ]; then + echo "$GUIX not present or not executable" + exit 1 +fi + +guix_start() { + echo "starting $BASE ..." + if [ -x ${GUIX} ]; then + # If there is an old PID file (no guix-daemon running), clean it up: + if [ -r ${GUIX_PIDFILE} ]; then + if ! ps axc | grep guix-daemon 1> /dev/null 2> /dev/null ; then + echo "Cleaning up old ${GUIX_PIDFILE}." + rm -f ${GUIX_PIDFILE} + fi + fi + nohup "${UNSHARE}" -m -- "${GUIX}" "${GUIX_OPTS}" >> ${GUIX_LOG} 2>&1 & + echo $! > ${GUIX_PIDFILE} + fi +} + +# Stop guix: +guix_stop() { + echo "stopping $BASE ..." + # If there is no PID file, ignore this request... + if [ -r ${GUIX_PIDFILE} ]; then + kill $(cat ${GUIX_PIDFILE}) + fi + rm -f ${GUIX_PIDFILE} +} + +# Restart guix: +guix_restart() { + guix_stop + guix_start +} + +case "$1" in +'start') + guix_start + ;; +'stop') + guix_stop + ;; +'restart') + guix_restart + ;; +'status') + if [ -f ${GUIX_PIDFILE} ] && ps -o cmd $(cat ${GUIX_PIDFILE}) | grep -q $BASE ; then + echo "status of $BASE: running" + else + echo "status of $BASE: stopped" + fi + ;; +*) + echo "usage $0 start|stop|restart|status" +esac + +exit 0 diff --git a/system/guix/doinst.sh b/system/guix/doinst.sh new file mode 100644 index 0000000000..3e203807ec --- /dev/null +++ b/system/guix/doinst.sh @@ -0,0 +1,25 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.guix.new diff --git a/system/guix/guix.SlackBuild b/system/guix/guix.SlackBuild new file mode 100644 index 0000000000..9b7e5dc229 --- /dev/null +++ b/system/guix/guix.SlackBuild @@ -0,0 +1,131 @@ +#!/bin/sh + +# Slackware build script for Guix + +# Copyright 2015 Hunter Sezen California, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=guix +VERSION=${VERSION:-0.9.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# To share the store with nix +SHARE=${SHARE:-no} +if [ "${SHARE:-yes}" = "yes" ]; then + share="--with-store-dir=/nix/store" + var="--localstatedir=/nix/var" +else + var="--localstatedir=/var" +fi + +# To use the nix-daemon instead of the guix-daemon +NIX=${NIX:-no} +if [ "${NIX:-yes}" = "yes" ]; then nix="--disable-daemon"; else nix=""; fi + +# https://www.mail-archive.com/guix-commits@gnu.org/msg12674.html +zcat $CWD/pypi-guile-json.diff.gz | patch -p1 + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --infodir=/usr/info \ + --mandir=/usr/man \ + --disable-rpath \ + --build=$ARCH-slackware-linux \ + --host=$ARCH-slackware-linux \ + $nix \ + $share \ + $var \ + +make +make install DESTDIR=$PKG + +install -D --mode 0755 $CWD/config/rc.guix $PKG/etc/rc.d/rc.guix.new +mkdir -p $PKG/gnu + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +rm -f $PKG/usr/info/dir +gzip -9 $PKG/usr/info/*.info* + +rm -fr $PKG/usr/lib${LIBDIRSUFFIX}/systemd +rm -rf $PKG/gnu + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a ABOUT-NLS AUTHORS COPYING ChangeLog HACKING INSTALL NEWS README ROADMAP THANKS TODO \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/guix/guix.info b/system/guix/guix.info new file mode 100644 index 0000000000..cd3816044e --- /dev/null +++ b/system/guix/guix.info @@ -0,0 +1,10 @@ +PRGNAM="guix" +VERSION="0.9.0" +HOMEPAGE="https://www.gnu.org/software/guix/" +DOWNLOAD="ftp://alpha.gnu.org/gnu/guix/guix-0.9.0.tar.gz" +MD5SUM="224e0a3cab26a2b95c65be738e4ae7f6" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Hunter Sezen" +EMAIL="ovariegata@yahoo.com" diff --git a/system/guix/pypi-guile-json.diff.gz b/system/guix/pypi-guile-json.diff.gz Binary files differnew file mode 100644 index 0000000000..dc2a9491f1 --- /dev/null +++ b/system/guix/pypi-guile-json.diff.gz diff --git a/system/guix/slack-desc b/system/guix/slack-desc new file mode 100644 index 0000000000..857fcb0e2a --- /dev/null +++ b/system/guix/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +guix: guix (a purely functional package manager) +guix: +guix: GNU Guix provides state-of-the-art package management features such +guix: as transactional upgrades and roll-backs, reproducible build +guix: environments, unprivileged package management, and per-user profiles. +guix: It uses low-level mechanisms from the Nix package manager, but +guix: packages are defined as native Guile modules, using extensions to the +guix: Scheme language—which makes it nicely hackable. +guix: +guix: Homepage: https://www.gnu.org/software/guix/ +guix: |