1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Pass configuration settings to the substituters

Previously substituters could read nix.conf themselves, but this
didn't take --option flags into account.
This commit is contained in:
Eelco Dolstra 2012-07-30 16:09:54 -04:00
parent f9613da180
commit d059bf48e4
5 changed files with 37 additions and 6 deletions

View file

@ -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;