summary refs log tree commit diff
path: root/etc/guix-install.sh
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2021-04-08 18:34:43 -0400
committerLeo Famulari <leo@famulari.name>2021-04-14 15:32:51 -0400
commit8e214c53a48a841887a59f24a20e7392b5e59b55 (patch)
treeb7f3ff5d8e6c975077d4e513d7dbb40d9fe77b6c /etc/guix-install.sh
parentdd9e77f81bce7fd3c869ee68b7ce68153d934460 (diff)
downloadguix-8e214c53a48a841887a59f24a20e7392b5e59b55.tar.gz
guix-install.sh: Add the build users to the 'kvm' group.
Fixes <https://bugs.gnu.org/42129>.

* etc/guix-install.sh (sys_create_build_user): If a 'kvm' group exists,
add it to the guixbuilders' lists of supplementary groups.
Diffstat (limited to 'etc/guix-install.sh')
-rwxr-xr-xetc/guix-install.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index c84e7b7577..949ef7719f 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -330,15 +330,20 @@ sys_create_build_user()
         _msg "${PAS}group <guixbuild> created"
     fi
 
+    if [ $(getent group kvm) ]; then
+        _msg "${INF}group kvm exists and build users will be added to it"
+	local KVMGROUP=,kvm
+    fi
+
     for i in $(seq -w 1 10); do
         if id "guixbuilder${i}" &>/dev/null; then
             _msg "${INF}user is already in the system, reset"
-            usermod -g guixbuild -G guixbuild           \
+            usermod -g guixbuild -G guixbuild${KVMGROUP}     \
                     -d /var/empty -s "$(which nologin)" \
                     -c "Guix build user $i"             \
                     "guixbuilder${i}";
         else
-            useradd -g guixbuild -G guixbuild           \
+            useradd -g guixbuild -G guixbuild${KVMGROUP}     \
                     -d /var/empty -s "$(which nologin)" \
                     -c "Guix build user $i" --system    \
                     "guixbuilder${i}";