aboutsummaryrefslogtreecommitdiff
path: root/site/posts/2018-07-15-running-guix-on-nixos.org
blob: ebf5400773fc714dee83971fbbb826141b90608e (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: Running Guix on NixOS
date: 2018-07-15
---
https://riot.im/app/#/room/#freenode_#guix:matrix.org/$1531510045400627zjGbq:matrix.org
* h1
** h2
#+BEGIN_SRC nix -n
  # FIXME: add line number
  { config, pkgs, ...}:

  {

    # NixOS usual config

    users = {
      mutableUsers = false;

      extraUsers =
        let
          andrehUser =  {
            andreh = {
              # my custom user config
            };
          };
          # From the Guix manual:
          # https://www.gnu.org/software/guix/manual/en/html_node/Build-Environment-Setup.html#Build-Environment-Setup
          buildUser = (i:
            {
              "guixbuilder${i}" = {                   # guixbuilder$i
                group = "guixbuild";                  # -g guixbuild
                extraGroups = ["guixbuild"];          # -G guixbuild
                home = "/var/empty";                  # -d /var/empty
                shell = pkgs.nologin;                 # -s `which nologin`
                description = "Guix build user ${i}"; # -c "Guix buid user $i"
                isSystemUser = true;                  # --system
              };
            }
          );
        in
          # merge all users
          pkgs.lib.fold (str: acc: acc // buildUser str)
                        andrehUser
                        # for i in `seq -w 1 10`
                        (map (pkgs.lib.fixedWidthNumber 2) (builtins.genList (n: n+1) 10));

      extraGroups.guixbuild = {
        name = "guixbuild";
      };
    };
  }
#+END_SRC