Paste number 340722: /gnu/remote/bin/guixr

Index of paste annotations: 1

Paste number 340722: /gnu/remote/bin/guixr
Pasted by: rekado
When:4 years, 8 months ago
Share:Tweet this! | http://paste.lisp.org/+7AWI
Channel:None
Paste contents:
Raw Source | XML | Display As
#!/bin/bash

set -u
set -e

# Configuration
socketfile="${HOME}/.guix-daemon-socket-forwarder-$$"
remote="guix-builder:9999"
guix_root="/gnu/remote"
guix="${guix_root}/guix/pre-inst-env guix"
guix_additional="${guix_root}/guix-bimsb"
guix_profile="/gnu/var/guix/profiles/custom/remote-test"
socat="${guix_profile}/bin/socat"

# Avoid locale warnings.
export GUIX_LOCPATH="${guix_profile}/lib/locale"

# Abort early if we're on the login node.  The profiles are not
# mounted read-writeable on this node, so Guix would fail (late) when
# trying to write to the user profile.
test "$(hostname -s)" = "login-node" && \
    (echo "Sorry, you cannot use Guix on the login node.
Please first start a cluster session with \"qrsh\" or \"qlogin\".
"; exit 1)

# Ensure that the forwarding process is terminated on exit
function cleanup {
    ps -p ${SOCAT_PID} >/dev/null && kill -TERM ${SOCAT_PID}
    rm -f ${socketfile}
}
trap cleanup EXIT

# The socket file may not exist, or else socat will complain.
rm -f ${socketfile}

# Start forwarding
${socat} UNIX-LISTEN:${socketfile} TCP4:${remote} &
SOCAT_PID=$!

# Abort if socat is not running.
ps -p ${SOCAT_PID} >/dev/null || \
    (echo "Socat failed to start.  Aborting.
"; exit 1)

# Include our non-standard package repository
export GUIX_PACKAGE_PATH="$guix_additional${GUIX_PACKAGE_PATH:+:$GUIX_PACKAGE_PATH}"

# Use guix with the given arguments
export GUIX_DAEMON_SOCKET=${socketfile}
${guix} $@

Annotations for this paste:

Annotation number 1: /usr/lib/systemd/system/guix-daemon-tcp-listener.service
Pasted by: rekado
When:4 years, 8 months ago
Share:Tweet this! | http://paste.lisp.org/+7AWI/1
Paste contents:
Raw Source | Display As
[Unit]
Description=Listen on TCP 9999 for RCPs for the guix daemon
Require=network.target
After=remote-fs-pre.target remote-fs.target

[Service]
ExecStart=/root/.guix-profile/bin/socat TCP4-LISTEN:9999,su=nobody,fork,range=XXX.YYY.ZZZ.0/16,reuseaddr UNIX:/gnu/var/guix/daemon-socket/socket
RemainAfterExit=yes
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.