diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-04-13T18·53+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-04-13T18·53+0200 |
commit | ba9ad29fdbfda3836bb06b35817f08fd10beaa22 (patch) | |
tree | 565646143793af4e91ee88630e667bb7976e8686 /perl | |
parent | 6bd9576aeb55927cb551736a47b4e8e3fd1063bb (diff) |
Convert Settings to the new config system
This makes all config options self-documenting. Unknown or unparseable config settings and --option flags now cause a warning.
Diffstat (limited to 'perl')
-rw-r--r-- | perl/lib/Nix/Config.pm.in | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/perl/lib/Nix/Config.pm.in b/perl/lib/Nix/Config.pm.in index f494e34a5e7b..4bdee7fd89f9 100644 --- a/perl/lib/Nix/Config.pm.in +++ b/perl/lib/Nix/Config.pm.in @@ -20,22 +20,15 @@ $useBindings = 1; %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; - } - } else { - 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; - $config{$1} = $2; - } - close CONFIG; + 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; + $config{$1} = $2; } + close CONFIG; } return 1; |