aboutsummaryrefslogblamecommitdiff
path: root/po/pt/LC_MESSAGES/_articles/2018-07-17-running-guix-on-nixos.po
blob: c76ab514f19a0ead99b4928b95bb4ba838f01702 (plain) (tree)



















                                                                              











































































                                                                                               
































































































































                                                                                                                    









                                                                                 
#
msgid ""
msgstr ""

msgid ""
"title: Running Guix on NixOS\n"
"date: 2018-07-17\n"
"layout: post\n"
"lang: en\n"
"ref: running-guix-on-nixos"
msgstr ""

msgid ""
"I wanted to run Guix on a NixOS machine. Even though the Guix manual "
"explains how to do it [step by "
"step](https://www.gnu.org/software/guix/manual/en/html_node/Binary-"
"Installation.html#Binary-Installation), I needed a few extra ones to make it"
" work properly."
msgstr ""

msgid "Creating `guixbuilder` users"
msgstr ""

msgid ""
"Guix requires you to create non-root users that will be used to perform the "
"builds in the isolated environments."
msgstr ""

msgid ""
"The [manual](https://www.gnu.org/software/guix/manual/en/html_node/Build-"
"Environment-Setup.html#Build-Environment-Setup) already provides you with a "
"ready to run (as root) command for creating the build users:"
msgstr ""

msgid ""
"However, In my personal NixOS I have disabled "
"[`users.mutableUsers`](https://nixos.org/nixos/manual/index.html#sec-user-"
"management), which means that even if I run the above command it means that "
"they'll be removed once I rebuild my OS:"
msgstr ""

msgid ""
"Instead of enabling `users.mutableUsers` I could add the Guix users by "
"adding them to my system configuration:"
msgstr ""

msgid ""
"Here I used `fold` and the `//` operator to merge all of the configuration "
"sets into a single `extraUsers` value."
msgstr ""

msgid "Creating the `systemd` service"
msgstr ""

msgid "One other thing missing was the `systemd` service."
msgstr ""

msgid ""
"First I couldn't just copy the `.service` file to `/etc` since in NixOS that"
" folder isn't writable. But also I wanted the service to be better "
"integrated with the OS."
msgstr ""

msgid ""
"That was a little easier than creating the users, all I had to do was "
"translate the provided [`guix-"
"daemon.service.in`](https://git.savannah.gnu.org/cgit/guix.git/tree/etc/guix-"
"daemon.service.in?id=00c86a888488b16ce30634d3a3a9d871ed6734a2) configuration"
" to an equivalent Nix expression"
msgstr ""

msgid "This sample `systemd` configuration file became:"
msgstr ""

msgid ""
"There you go! After running `sudo nixos-rebuild switch` I could get Guix up "
"and running:"
msgstr ""

msgid "Some improvements to this approach are:"
msgstr ""

msgid ""
"looking into [NixOS modules](https://nixos.org/nixos/manual/index.html#sec-"
"writing-modules) and trying to bundle everything together into a single "
"logical unit;"
msgstr ""

msgid ""
"[build Guix from "
"source](https://www.gnu.org/software/guix/manual/en/html_node/Requirements.html#Requirements)"
" and share the Nix store and daemon with Guix."
msgstr ""

msgid "Happy Guix/Nix hacking!"
msgstr ""

msgid ""
"groupadd --system guixbuild\n"
"for i in `seq -w 1 10`;\n"
"do\n"
"  useradd -g guixbuild -G guixbuild           \\\n"
"          -d /var/empty -s `which nologin`    \\\n"
"          -c \"Guix build user $i\" --system    \\\n"
"          guixbuilder$i;\n"
"done\n"
msgstr ""

msgid ""
"$ sudo nixos-rebuild switch\n"
"(...)\n"
"removing user ‘guixbuilder7’\n"
"removing user ‘guixbuilder3’\n"
"removing user ‘guixbuilder10’\n"
"removing user ‘guixbuilder1’\n"
"removing user ‘guixbuilder6’\n"
"removing user ‘guixbuilder9’\n"
"removing user ‘guixbuilder4’\n"
"removing user ‘guixbuilder2’\n"
"removing user ‘guixbuilder8’\n"
"removing user ‘guixbuilder5’\n"
"(...)\n"
msgstr ""

msgid ""
"{ config, pkgs, ...}:\n"
"\n"
"{\n"
"\n"
"  # ... NixOS usual config ellided ...\n"
"\n"
"  users = {\n"
"    mutableUsers = false;\n"
"\n"
"    extraUsers =\n"
"      let\n"
"        andrehUser =  {\n"
"          andreh = {\n"
"            # my custom user config\n"
"          };\n"
"        };\n"
"        buildUser = (i:\n"
"          {\n"
"            \"guixbuilder${i}\" = {                   # guixbuilder$i\n"
"              group = \"guixbuild\";                  # -g guixbuild\n"
"              extraGroups = [\"guixbuild\"];          # -G guixbuild\n"
"              home = \"/var/empty\";                  # -d /var/empty\n"
"              shell = pkgs.nologin;                 # -s `which nologin`\n"
"              description = \"Guix build user ${i}\"; # -c \"Guix buid user $i\"\n"
"              isSystemUser = true;                  # --system\n"
"            };\n"
"          }\n"
"        );\n"
"      in\n"
"        # merge all users\n"
"        pkgs.lib.fold (str: acc: acc // buildUser str)\n"
"                      andrehUser\n"
"                      # for i in `seq -w 1 10`\n"
"                      (map (pkgs.lib.fixedWidthNumber 2) (builtins.genList (n: n+1) 10));\n"
"\n"
"    extraGroups.guixbuild = {\n"
"      name = \"guixbuild\";\n"
"    };\n"
"  };\n"
"}\n"
msgstr ""

msgid ""
"# This is a \"service unit file\" for the systemd init system to launch\n"
"# 'guix-daemon'.  Drop it in /etc/systemd/system or similar to have\n"
"# 'guix-daemon' automatically started.\n"
"\n"
"[Unit]\n"
"Description=Build daemon for GNU Guix\n"
"\n"
"[Service]\n"
"ExecStart=/var/guix/profiles/per-user/root/guix-profile/bin/guix-daemon --build-users-group=guixbuild\n"
"Environment=GUIX_LOCPATH=/root/.guix-profile/lib/locale\n"
"RemainAfterExit=yes\n"
"StandardOutput=syslog\n"
"StandardError=syslog\n"
"\n"
"# See <https://lists.gnu.org/archive/html/guix-devel/2016-04/msg00608.html>.\n"
"# Some package builds (for example, go@1.8.1) may require even more than\n"
"# 1024 tasks.\n"
"TasksMax=8192\n"
"\n"
"[Install]\n"
"WantedBy=multi-user.target\n"
msgstr ""

msgid ""
"guix-daemon = {\n"
"  enable = true;\n"
"  description = \"Build daemon for GNU Guix\";\n"
"  serviceConfig = {\n"
"    ExecStart = \"/var/guix/profiles/per-user/root/guix-profile/bin/guix-daemon --build-users-group=guixbuild\";\n"
"    Environment=\"GUIX_LOCPATH=/root/.guix-profile/lib/locale\";\n"
"    RemainAfterExit=\"yes\";\n"
"    StandardOutput=\"syslog\";\n"
"    StandardError=\"syslog\";\n"
"    TaskMax= \"8192\";\n"
"  };\n"
"  wantedBy = [ \"multi-user.target\" ];\n"
"};\n"
msgstr ""

msgid ""
"$ guix package -i hello\n"
"The following package will be installed:\n"
"   hello        2.10    /gnu/store/bihfrh609gkxb9dp7n96wlpigiv3krfy-hello-2.10\n"
"\n"
"substitute: updating substitutes from 'https://mirror.hydra.gnu.org'... 100.0%\n"
"The following derivations will be built:\n"
"   /gnu/store/nznmdn6inpwxnlkrasydmda4s2vsp9hg-profile.drv\n"
"   /gnu/store/vibqrvw4c8lacxjrkqyzqsdrmckv77kq-fonts-dir.drv\n"
"   /gnu/store/hi8alg7wi0wgfdi3rn8cpp37zhx8ykf3-info-dir.drv\n"
"   /gnu/store/cvkbp378cvfjikz7mjymhrimv7j12p0i-ca-certificate-bundle.drv\n"
"   /gnu/store/d62fvxymnp95rzahhmhf456bsf0xg1c6-manual-database.drv\n"
"Creating manual page database...\n"
"1 entries processed in 0.0 s\n"
"2 packages in profile\n"
"$ hello\n"
"Hello, world!\n"
msgstr ""

msgid ""
"I couldn't just install GuixSD because my wireless network card doesn't have"
" any free drivers (yet)."
msgstr ""

#~ msgid ""
#~ "I couldn't just install GuixSD because my wireless network card doesn't have"
#~ " any free/libre drivers (yet)."
#~ msgstr ""