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
|
|
|
|
|
2016-08-12 16:44:01 +03:00
|
|
|
|
$binDir = $ENV{"NIX_BIN_DIR"} || "@nixbindir@";
|
|
|
|
|
$libexecDir = $ENV{"NIX_LIBEXEC_DIR"} || "@nixlibexecdir@";
|
|
|
|
|
$stateDir = $ENV{"NIX_STATE_DIR"} || "@nixlocalstatedir@/nix";
|
|
|
|
|
$logDir = $ENV{"NIX_LOG_DIR"} || "@nixlocalstatedir@/log/nix";
|
|
|
|
|
$confDir = $ENV{"NIX_CONF_DIR"} || "@nixsysconfdir@/nix";
|
|
|
|
|
$storeDir = $ENV{"NIX_STORE_DIR"} || "@nixstoredir@";
|
2011-10-11 00:11:08 +03:00
|
|
|
|
|
2012-06-29 21:26:31 +03:00
|
|
|
|
$bzip2 = "@bzip2@";
|
|
|
|
|
$xz = "@xz@";
|
2011-10-11 00:11:08 +03:00
|
|
|
|
$curl = "@curl@";
|
2006-05-31 12:24:54 +03:00
|
|
|
|
|
2016-08-12 16:44:01 +03:00
|
|
|
|
$useBindings = 1;
|
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;
|
|
|
|
|
|
|
|
|
|
open CONFIG, "<$config" or die "cannot open ‘$config’";
|
|
|
|
|
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;
|