mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-14 01:33:10 +00:00
nixos-install: Don't grep nix.conf directly, use nix perl bindings instead
This commit is contained in:
parent
99623e9940
commit
6199d4bb8e
@ -85,7 +85,7 @@ mkdir -m 0755 -p \
|
||||
$mountPoint/nix/var/log/nix/drvs
|
||||
|
||||
mkdir -m 1775 -p $mountPoint/nix/store
|
||||
build_users_group=$((grep build-users-group "${NIX_CONF_DIR:-/etc/nix}/nix.conf" 2>/dev/null | awk '{ print $3 }') || echo -n "")
|
||||
build_users_group=$(@perl@/bin/perl -e 'use Nix::Config; Nix::Config::readConfig; print $Nix::Config::config{"build-users-group"};')
|
||||
if test -n "$build_users_group"; then
|
||||
chown root:"$build_users_group" $mountPoint/nix/store
|
||||
else
|
||||
@ -117,7 +117,10 @@ export LC_TIME=
|
||||
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:-/etc/nix}/nix.conf" >> $mountPoint/tmp/nix.conf || true
|
||||
binary_caches=$(@perl@/bin/perl -e 'use Nix::Config; Nix::Config::readConfig; print $Nix::Config::config{"binary-caches"};')
|
||||
if test -n "$binary_caches"; then
|
||||
echo "binary-caches $binary_caches" >> $mountPoint/tmp/nix.conf
|
||||
fi
|
||||
export NIX_CONF_DIR=/tmp
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user