From e83f946f9e1fccd01f0135ac4c3d078b86450dc5 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 4 Feb 2013 07:46:09 -0500 Subject: [PATCH] nixos-install: Respect the build-users-group of the host --- modules/installer/tools/nixos-install.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/installer/tools/nixos-install.sh b/modules/installer/tools/nixos-install.sh index 133353007433..73afc4d2f644 100644 --- a/modules/installer/tools/nixos-install.sh +++ b/modules/installer/tools/nixos-install.sh @@ -85,7 +85,12 @@ mkdir -m 0755 -p \ $mountPoint/nix/var/log/nix/drvs mkdir -m 1775 -p $mountPoint/nix/store -chown root:nixbld $mountPoint/nix/store +build_users_group=$((grep build-users-group "$NIX_CONF_DIR/nix.conf" 2>/dev/null | awk '{ print $3 }') || echo -n "") +if test -n "$build_users_group"; then + chown root:"$build_users_group" $mountPoint/nix/store +else + chown root $mountPoint/nix/store +fi # Get the store paths to copy from the references graph. @@ -109,7 +114,9 @@ export LC_TIME= # Create a temporary Nix config file that causes the nixbld users to # be used. -echo "build-users-group = nixbld" > $mountPoint/tmp/nix.conf +if test -n "$build_users_group"; then + echo "build-users-group = $build_users_group" > $mountPoint/tmp/nix.conf +fi grep binary-caches "$NIX_CONF_DIR/nix.conf" >> $mountPoint/tmp/nix.conf || true export NIX_CONF_DIR=/tmp