aboutsummaryrefslogblamecommitdiff
path: root/po/pt/LC_MESSAGES/_articles/2020-08-10-guix-inside-sourcehut-builds-sr-ht-ci.po
blob: 23968481ffd1b606927329d5d98672c3d1b2843b (plain) (tree)

















































































                                                                                 







































































                                                                                               
#
msgid ""
msgstr ""

msgid ""
"title: Guix inside sourcehut builds.sr.ht CI\n"
"date: 2020-08-10\n"
"updated_at: 2020-08-19\n"
"layout: post\n"
"lang: en\n"
"ref: guix-inside-sourcehut-builds-sr-ht-ci"
msgstr ""

msgid ""
"After the release of the [NixOS images in "
"builds.sr.ht](https://man.sr.ht/builds.sr.ht/compatibility.md#nixos) and "
"much usage of it, I also started looking at [Guix](https://guix.gnu.org/) "
"and wondered if I could get it on the awesome builds.sr.ht service."
msgstr ""

msgid ""
"The Guix manual section on the [binary "
"installation](https://guix.gnu.org/manual/en/guix.html#Binary-Installation) "
"is very thorough, and even a [shell installer "
"script](https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-"
"install.sh) is provided, but it is built towards someone installing Guix on "
"their personal computer, and relies heavily on interactive input."
msgstr ""

msgid ""
"I developed the following set of scripts that I have been using for some "
"time to run Guix tasks inside builds.sr.ht jobs. First, `install-guix.sh`:"
msgstr ""

msgid ""
"Almost all of it is taken directly from the [binary "
"installation](https://guix.gnu.org/manual/en/guix.html#Binary-Installation) "
"section from the manual, with the interactive bits stripped out: after "
"downloading and extracting the Guix tarball, we create some symlinks, add "
"guixbuild users and authorize the `ci.guix.gnu.org.pub` signing key."
msgstr ""

msgid ""
"After installing Guix, we perform a `guix pull` to update Guix inside "
"`start-guix.sh`:"
msgstr ""

msgid ""
"Then we can put it all together in a sample `.build.yml` configuration file "
"I'm using myself:"
msgstr ""

msgid ""
"We have to add the `guix-daemon` to `~/.buildenv` so it can be started on "
"every following task run. Also, since we used `wget` inside `install-"
"guix.sh`, we had to add it to the images package list."
msgstr ""

msgid ""
"After the `install-guix` task, you can use Guix to build and test your "
"project, or run any `guix environment --ad-hoc my-package -- my script` :)"
msgstr ""

msgid "Improvements"
msgstr ""

msgid ""
"When I originally created this code I had a reason why to have both a `sudo`"
" call for `sudo ./scripts/install-guix.sh` and `sudo` usages inside "
"`install-guix.sh` itself. I couldn't figure out why (it feels like my past "
"self was a bit smarter 😬), but it feels ugly now. If it is truly required I "
"could add an explanation for it, or remove this entirely in favor of a more "
"elegant solution."
msgstr ""

msgid ""
"I could also contribute the Guix image upstream to builds.sr.ht, but there "
"wasn't any build or smoke tests in the original "
"[repository](https://git.sr.ht/~sircmpwn/builds.sr.ht), so I wasn't inclined"
" to make something that just \"works on my machine\" or add a maintainence "
"burden to the author. I didn't look at it again recently, though."
msgstr ""

msgid ""
"#!/usr/bin/env bash\n"
"set -x\n"
"set -Eeuo pipefail\n"
"\n"
"VERSION='1.0.1'\n"
"SYSTEM='x86_64-linux'\n"
"BINARY=\"guix-binary-${VERSION}.${SYSTEM}.tar.xz\"\n"
"\n"
"cd /tmp\n"
"wget \"https://ftp.gnu.org/gnu/guix/${BINARY}\"\n"
"tar -xf \"${BINARY}\"\n"
"\n"
"sudo mv var/guix /var/\n"
"sudo mv gnu /\n"
"sudo mkdir -p ~root/.config/guix\n"
"sudo ln -fs /var/guix/profiles/per-user/root/current-guix ~root/.config/guix/current\n"
"\n"
"GUIX_PROFILE=\"$(echo ~root)/.config/guix/current\"\n"
"source \"${GUIX_PROFILE}/etc/profile\"\n"
"\n"
"groupadd --system guixbuild\n"
"for i in $(seq -w 1 10);\n"
"do\n"
"  useradd -g guixbuild                       \\\n"
"          -G guixbuild                       \\\n"
"          -d /var/empty                      \\\n"
"          -s \"$(command -v nologin)\"         \\\n"
"          -c \"Guix build user ${i}\" --system \\\n"
"          \"guixbuilder${i}\";\n"
"done\n"
"\n"
"mkdir -p /usr/local/bin\n"
"cd /usr/local/bin\n"
"ln -s /var/guix/profiles/per-user/root/current-guix/bin/guix .\n"
"ln -s /var/guix/profiles/per-user/root/current-guix/bin/guix-daemon .\n"
"\n"
"guix archive --authorize < ~root/.config/guix/current/share/guix/ci.guix.gnu.org.pub\n"
msgstr ""

msgid ""
"#!/usr/bin/env bash\n"
"set -x\n"
"set -Eeuo pipefail\n"
"\n"
"sudo guix-daemon --build-users-group=guixbuild &\n"
"guix pull\n"
"guix package -u\n"
"guix --version\n"
msgstr ""

msgid ""
"image: debian/stable\n"
"packages:\n"
"  - wget\n"
"sources:\n"
"  - https://git.sr.ht/~euandreh/songbooks\n"
"tasks:\n"
"  - install-guix: |\n"
"      cd ./songbooks/\n"
"      ./scripts/install-guix.sh\n"
"      ./scripts/start-guix.sh\n"
"      echo 'sudo guix-daemon --build-users-group=guixbuild &' >> ~/.buildenv\n"
"      echo 'export PATH=\"${HOME}/.config/guix/current/bin${PATH:+:}$PATH\"' >> ~/.buildenv\n"
"  - tests: |\n"
"      cd ./songbooks/\n"
"      guix environment -m build-aux/guix.scm -- make check\n"
"  - docs: |\n"
"      cd ./songbooks/\n"
"      guix environment -m build-aux/guix.scm -- make publish-dist\n"
msgstr ""