From d059bf48e4bd4d1f50593dbe60953de8b2d395c7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 30 Jul 2012 16:09:54 -0400 Subject: Pass configuration settings to the substituters Previously substituters could read nix.conf themselves, but this didn't take --option flags into account. --- perl/lib/Nix/Config.pm.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'perl/lib/Nix') diff --git a/perl/lib/Nix/Config.pm.in b/perl/lib/Nix/Config.pm.in index ed197821e89f..8c902ab6edc5 100644 --- a/perl/lib/Nix/Config.pm.in +++ b/perl/lib/Nix/Config.pm.in @@ -19,9 +19,17 @@ $useBindings = "@perlbindings@" eq "yes"; %config = (); sub readConfig { + if (defined $ENV{'_NIX_OPTIONS'}) { + foreach my $s (split '\n', $ENV{'_NIX_OPTIONS'}) { + my ($n, $v) = split '=', $s, 2; + $config{$n} = $v; + } + return; + } + my $config = "$confDir/nix.conf"; return unless -f $config; - + open CONFIG, "<$config" or die "cannot open `$config'"; while () { /^\s*([\w|-]+)\s*=\s*(.*)$/ or next; -- cgit 1.4.1