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