diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-30T20·09-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-30T20·09-0400 |
commit | d059bf48e4bd4d1f50593dbe60953de8b2d395c7 (patch) | |
tree | 4dd8fed0eb5c2827000c84fd77719e4454adb627 /perl/lib/Nix/Config.pm.in | |
parent | f9613da18033d0a9835bc57ac2142aca754983cf (diff) |
Pass configuration settings to the substituters
Previously substituters could read nix.conf themselves, but this didn't take --option flags into account.
Diffstat (limited to 'perl/lib/Nix/Config.pm.in')
-rw-r--r-- | perl/lib/Nix/Config.pm.in | 10 |
1 files changed, 9 insertions, 1 deletions
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 (<CONFIG>) { /^\s*([\w|-]+)\s*=\s*(.*)$/ or next; |