diff options
author | EuAndreh <eu@euandre.org> | 2020-02-06 00:19:36 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-02-06 00:19:36 -0300 |
commit | c097bdb3ba09b0292d944fcc518a1cad6ab03ff2 (patch) | |
tree | c7a105ac4315162bd1390a04a8b9a74df05a2cf8 /_posts/2018-07-17-running-guix-on-nixos.md | |
parent | Use custom date format for pt (diff) | |
download | euandre.org-c097bdb3ba09b0292d944fcc518a1cad6ab03ff2.tar.gz euandre.org-c097bdb3ba09b0292d944fcc518a1cad6ab03ff2.tar.xz |
Sanitize markdown content
Diffstat (limited to '')
-rw-r--r-- | _posts/2018-07-17-running-guix-on-nixos.md | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/_posts/2018-07-17-running-guix-on-nixos.md b/_posts/2018-07-17-running-guix-on-nixos.md index c0d4611..c12a417 100644 --- a/_posts/2018-07-17-running-guix-on-nixos.md +++ b/_posts/2018-07-17-running-guix-on-nixos.md @@ -7,15 +7,13 @@ ref: running-guix-on-nixos --- 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), +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. -I couldn\'t just install GuixSD because my wireless network card -doesn\'t have any free/libre drivers (yet). +I couldn't just install GuixSD because my wireless network card +doesn't have any free/libre drivers (yet). -Creating `guixbuilder` users ----------------------------- +## Creating `guixbuilder` users Guix requires you to create non-root users that will be used to perform the builds in the isolated environments. @@ -25,7 +23,7 @@ The already provides you with a ready to run (as root) command for creating the build users: -``` {.bash .numberLines startFrom=""} +```bash groupadd --system guixbuild for i in `seq -w 1 10`; do @@ -38,10 +36,10 @@ done 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 +which means that even if I run the above command it means that they'll be removed once I rebuild my OS: -``` {.shell .numberLines startFrom=""} +```shell $ sudo nixos-rebuild switch (...) removing user ‘guixbuilder7’ @@ -60,7 +58,7 @@ removing user ‘guixbuilder5’ Instead of enabling `users.mutableUsers` I could add the Guix users by adding them to my system configuration: -``` {.nix .numberLines startFrom=""} +```nix { config, pkgs, ...}: { @@ -106,13 +104,12 @@ adding them to my system configuration: Here I used `fold` and the `//` operator to merge all of the configuration sets into a single `extraUsers` value. -Creating the `systemd` service ------------------------------- +## Creating the `systemd` service One other thing missing was the `systemd` service. -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 +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. That was a little easier than creating the users, all I had to do was @@ -120,7 +117,7 @@ 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 -``` {.ini .numberLines startFrom=""} +```ini # This is a "service unit file" for the systemd init system to launch # 'guix-daemon'. Drop it in /etc/systemd/system or similar to have # 'guix-daemon' automatically started. @@ -146,7 +143,7 @@ WantedBy=multi-user.target This sample `systemd` configuration file became: -``` {.nix .numberLines startFrom=""} +```nix guix-daemon = { enable = true; description = "Build daemon for GNU Guix"; @@ -165,7 +162,7 @@ guix-daemon = { There you go! After running `sudo nixos-rebuild switch` I could get Guix up and running: -``` {.bash .numberLines startFrom=""} +```bash $ guix package -i hello The following package will be installed: hello 2.10 /gnu/store/bihfrh609gkxb9dp7n96wlpigiv3krfy-hello-2.10 @@ -186,11 +183,9 @@ Hello, world! Some improvements to this approach are: -1. looking into [NixOS - modules](https://nixos.org/nixos/manual/index.html#sec-writing-modules) +1. 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; -2. [build Guix from - source](https://www.gnu.org/software/guix/manual/en/html_node/Requirements.html#Requirements) +2. [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. Happy Guix/Nix hacking! |