Skip to content

Commit

Permalink
setup-guix.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
dochang committed Nov 10, 2024
1 parent 4f9eef8 commit c8fe615
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ jobs:
who
echo "aa $USER bb"
echo $UID
GUIX_TEMP_DIR=$(mktemp -d)
INSTALLER="$GUIX_TEMP_DIR/guix-install.sh"
curl -o "$INSTALLER" https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh
chmod +x "$INSTALLER"
sudo "$INSTALLER"
command -v guix
pwd
ls -lA
head ./scripts/setup-guix.sh
sudo "$(pwd)/scripts/setup-guix.sh"
guix install glibc-locales
. $HOME/.guix-profile/etc/profile
guix install hello
workflows:
Expand Down
43 changes: 43 additions & 0 deletions scripts/setup-guix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh

# https://guix.gnu.org/manual/en/html_node/Binary-Installation.html

set -e

GUIX_TEMP_DIR=$(mktemp -d)
ARCHIVE="$GUIX_TEMP_DIR/guix-binary.tar.xz"
ARCHIVE_URL="https://ci.guix.gnu.org/search/latest/archive?query=spec:tarball+status:success+system:x86_64-linux+guix-binary.tar.xz"

download() {
curl --silent --show-error --location "$@"
}

download --output "$ARCHIVE" "$ARCHIVE_URL"

cd "$GUIX_TEMP_DIR"
tar --warning=no-timestamp -xf "$ARCHIVE"
mv -v var/guix /var/ && mv -v gnu /

eval 'ROOT_HOME=~root'
GUIX_PROFILE="$ROOT_HOME/.config/guix/current"

mkdir -p "$(dirname "$GUIX_PROFILE")"
ln -sf /var/guix/profiles/per-user/root/current-guix "$GUIX_PROFILE"

# shellcheck source=/dev/null
. "$GUIX_PROFILE/etc/profile"

GUIX_GROUP=guixbuild
groupadd --system "$GUIX_GROUP"
for i in $(seq -w 1 10); do
useradd -g "$GUIX_GROUP" -G "$GUIX_GROUP" \
-d /var/empty -s "$(command -v nologin)" \
-c "Guix build user $i" --system "guixbuilder$i"
done

nohup "$GUIX_PROFILE/bin/guix-daemon" "--build-users-group=$GUIX_GROUP" >/dev/null &

ln -sf /var/guix/profiles/per-user/root/current-guix/bin/guix /usr/local/bin

guix archive --authorize <"$GUIX_PROFILE/share/guix/ci.guix.gnu.org.pub"
guix archive --authorize <"$GUIX_PROFILE/share/guix/bordeaux.guix.gnu.org.pub"

0 comments on commit c8fe615

Please sign in to comment.