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