2011-10-10 21:11:08 +00:00
|
|
|
package Nix::Config;
|
|
|
|
|
2015-02-04 15:43:32 +00:00
|
|
|
use MIME::Base64;
|
|
|
|
|
2013-11-25 16:38:33 +00:00
|
|
|
$version = "@PACKAGE_VERSION@";
|
2012-07-11 22:05:30 +00:00
|
|
|
|
2020-09-17 08:42:51 +00:00
|
|
|
$binDir = Nix::Store::getBinDir;
|
|
|
|
$storeDir = Nix::Store::getStoreDir;
|
2012-05-10 23:03:23 +00:00
|
|
|
|
2012-07-09 14:57:28 +00:00
|
|
|
%config = ();
|
|
|
|
|
2006-05-31 09:24:54 +00:00
|
|
|
sub readConfig {
|
2017-04-13 18:53:23 +00:00
|
|
|
my $config = "$confDir/nix.conf";
|
|
|
|
return unless -f $config;
|
|
|
|
|
2017-07-30 11:27:57 +00:00
|
|
|
open CONFIG, "<$config" or die "cannot open '$config'";
|
2017-04-13 18:53:23 +00:00
|
|
|
while (<CONFIG>) {
|
|
|
|
/^\s*([\w\-\.]+)\s*=\s*(.*)$/ or next;
|
|
|
|
$config{$1} = $2;
|
2012-07-30 20:09:54 +00:00
|
|
|
}
|
2017-04-13 18:53:23 +00:00
|
|
|
close CONFIG;
|
2006-05-31 09:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|