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