aboutsummaryrefslogtreecommitdiff
path: root/perl/lib/Nix/Config.pm.in
blob: f7c6f2484c356d8d271c5c2e9c2447defe1c495e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package Nix::Config;

use MIME::Base64;

$version = "@PACKAGE_VERSION@";

$binDir = Nix::Store::getBinDir;
$storeDir = Nix::Store::getStoreDir;

%config = ();

sub readConfig {
    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;
    }
    close CONFIG;
}

return 1;